An MLDBM-Using Verification Script

The changes to the verify.cgi script are also simple, as the verify2.cgi script given in Example 20-3 shows.

Example 20-3. The verify2.cgi script

#!/usr/bin/perl -Tw # verify2.cgi # # verifies receipt of the member's verification code, and activates the # member's account by: # # 1) writing their information to the $member_file, # 2) adding their username/password pair to the .htpasswd file, # 3) adding them to the appropriate group in the .htgroup file, and # 4) deleting their entry from the submission queue. use strict; use CGI qw(:standard); use Fcntl qw(:flock); use Apache::Htpasswd; use GDBM_File; use MLDBM qw(GDBM_File Storable); use lib '/home/jbc/lib'; use Socalsail::Make_page; $ENV{PATH} = ''; my $notify_email = ''; my $sendmail = '/usr/lib/sendmail'; my $queue_file = '/w1/s/socalsail/maint/data/pending_memberships.gdbm'; my $queue_file_semaphore = $queue_file . '.sem'; my $member_file = '/w1/s/socalsail/maint/data/members.gdbm'; my $member_file_semaphore = $member_file . '.sem'; my $htgroup_file = '/w1/s/socalsail/maint/data/.htgroup'; my $htgroup_semaphore = $htgroup_file . '.sem'; my $htpasswd_file = '/w1/s/socalsail/maint/data/.htpasswd'; my $username = param('username'); my $verify = param('verify'); my $content = ''; unless ($username and $verify) { # they didn't come by clicking on the email link my $form = make_form( ); $content = <<"EOF"; <H2 ALIGN="center">Membership Verification</H1> <P>In order to activate ...

Get Perl for Web Site Management now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.