For those who have been following along with my past few nodes I'm still working on the same script and running into the same problems. No matter how many times I rewrite the script from the ground up I still run into the same mixup while everything else runs fine.

In this revision I am using two databases instead of one thinking it would be easier to have one database for their email address and ID and the other database for just their email address. That was the major update so instead of thinking it's the database itself that's having problems I'm thinking it my method of checking the url params to the database to see if their identical.

The entire script is below, I noted the part where I think the problem might be. I've rewritten this so many times and I'm not getting any closer to getting it done, what in the heck am I doing wrong??

#!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser); use CGI; use POSIX; require SDBM_File; # # Define our constants # my $sendmail = "/usr/lib/sendmail"; my $adminmail = "test\@test.com"; my($verified, $unverified, $ID); my @chars = ( "A" .. "Z", "a" .. "z", 0 .. 9, qw(! @ $ % ^ & * ) ); # # Define our dynamic input # my $query = CGI->new; print $query->header; my %form = %{$query->Vars}; my $accountID = $query->url_param('accountID'); my $accountAD = $query->url_param('accountAD'); my (%dbm1, %dbm2); my $dbm1 = "unverified.dbm"; my $dbm2 = "verified.dbm"; tie (%dbm1, 'SDBM_File', $dbm1, O_CREAT|O_RDWR, 0644) || die "Died tying database\nReason: $!\n"; tie (%dbm2, 'SDBM_File', $dbm2, O_CREAT|O_RDWR, 0644) || die "Died tying database\nReason: $!\n"; # # If form was completed generate an ID, store them to database, email +user # if ($form{'usermail'}) { &generate_id; &email; print "An email has been sent to $form{'usermail'} for verification. +<br><br>\n"; $dbm1{$form{'usermail'}} = "$ID"; } # # Or if url param's are present and checked add them to other DB and r +emove them from $unverified # ***************The error is probably in this segment*** else { my $unverified = $accountID; my $verified = "$accountAD"; if ($dbm1{"$accountAD"} && $dbm1{"$accountAD"} =~ /^$accountAD$/) { $dbm2{"$verified"} = "$accountAD"; print "You have been added to the mailing list successfully!\n"; } else { print "Registration failed!<br><br>\n"; print "\$accountID: $accountID .<br>\n"; print "\$accountAD: $accountAD .<br>\n"; } } ***** error probably above this line sub email { $accountAD = "$form{'usermail'}"; open (MAIL, "|$sendmail -t") or die "Cannot access mail"; print MAIL "To: $form{'usermail'}\n"; print MAIL "From: $adminmail\n"; print MAIL "Subject: Verify your Email Address\n\n"; print MAIL "http://sulfericacid.perlmonk.org/evs/revised.pl?accountI +D=$accountID&accountAD=$accountAD\n"; close (MAIL); } sub generate_id { do { $accountID = join '', map { $chars[ rand @chars ] } 1..17; } while grep {$_ eq $ID} my @used; print $ID; # my @unverified_emails=($form{'usermail'}, $accountID); # $unverified = join "::",@unverified_emails; #$dbm{"$unverified"}= join "::",@unverified_emails; #foreach my $mail (split /::/, $dbm{'notverified'}) { # print "$mail is not verified!\n"; #} } untie(%dbm1); untie(%dbm2);


"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

In reply to Registration Error by sulfericacid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.