Rob Bloodgood wrote:
> 
> So, like many of you, I've got a signup system in place for bringing on new
> customers.
> 
> My signup script is reasonably straightforward.  I use CGI::Validate to make
> my parameters pass muster (along with a little judicious JavaScript on the
> signup form), Apache::Session::Oracle to maintain state between the multiple
> pages of the signup, CGI::FastTemplate to print a pretty success page, and
> DBI to create the account records at successful creation.
> 
> At one time it was straight CGI but I've since updated it for mod_perl.
> 
> Anyway, my only problem is that I can't seem to prevent duplicate signups,
> e.g. reloading the last page to create multiple accounts.
> 
> This is my dupe detection code:
> 
> if (my (%post) = cookie('Signup')) {
>     local $^W = 0;
>     my $match = 0;
>     foreach (qw/ email url password / ) {
>         $match++ if param($_) and $post{$_} eq param($_)
>     }
>     if ($match == 3) {
>         # I tried this first, but some browsers are stupid.
>         # print header(-status=>'204 No Content');
>         print header(-status=>'304 Not Modified');
>         exit;
>     }
> }
> 
> Naturally, I set the corresponding cookie in the Header of the "Thank you
> for signing up" template output.
> 
> But it doesn't work.  I still get duplicate accounts, and I'm at a loss as
> to how to attack this problem.  (this is the 3rd or 4th approach I've
> tried).
> 
> Suggestions?
> 
> TIA!
> 
> L8r,
> Rob
> 
> #!/usr/bin/perl -w
> use Disclaimer qw/:standard/;



i might suggest making your database use stronger indexing
to prevent duplicate data in the database
that way the db would throw an error
that could be caught

we use first name last 
name and email address 
to create a combined
index 
that seems to do fine

Reply via email to