eoin has asked for the wisdom of the Perl Monks concerning the following question:
C:\Perl\bin>perl reg.cgi -c Found = in conditional, should be == at reg.cgi line 34. syntax error at reg.cgi line 24, near ") my " Global symbol "$dateofbirth" requires explicit package name at reg.cgi + line 24. Global symbol "$datofbirth" requires explicit package name at reg.cgi +line 27. Global symbol "$title" requires explicit package name at reg.cgi line +32. Global symbol "$body" requires explicit package name at reg.cgi line 3 +2. Global symbol "$title" requires explicit package name at reg.cgi line +35. Global symbol "$body" requires explicit package name at reg.cgi line 3 +5. Global symbol "$title" requires explicit package name at reg.cgi line +38. Global symbol "$body" requires explicit package name at reg.cgi line 3 +8. Global symbol "$title" requires explicit package name at reg.cgi line +42. Global symbol "$body" requires explicit package name at reg.cgi line 4 +2. reg.cgi has too many errors.
use strict; use warnings; use CGI; my $q = new CGI; my $user_name = $q->param('user_name'); my $gender = $q->param('gender'); my $real_name = $q->param('real_name'); my $city = $q->param('city'); my $country = $q->param('country'); my $email = $q->param('email'); my $confirmemail = $q->param('confirmemail'); my $mm = $q->param('birthmm'); my $dd = $q->param('birthdd'); my $yy = $q->param('birthyy'); #--------------------------------------------------------------------- #START OF MAIN PROGRAM #--------------------------------------------------------------------- my $password = &password(5) my $dateofbirth = ("$dd/$mm/$yy"); my @info = ($user_name, $password, $email, $gender, $real_name, $datof +birth, $city, $country); open(USRNF,"pass") or die "Couldn't find user file.\n"; if ($email ne $confirmemail){ ($title, $body) = &email_invalid();} elsif (&check_user_email($user_name,$email) = "good"){ ($title, $body) = &good(@info);} else { ($title, $body) = &check_user_email($user_name,$email); } print qq(Content-type: text/html\n <html> <head><title>$title</title></head> $body </html>); #--------------------------------------------------------------------- #END OF MAIN PROGRAM:BEGINING OF VERIFICATION #--------------------------------------------------------------------- sub email_invalid { my $title = "Email's do not match!!"; my $body = q(<body bgcolor="black" text="red"> <h3>Your e-mail doesn't match.</h3><br><br> <h2>Please click on your browsers back button and try again.</h2></a>< +hr> </body>); return ($title, $body); } #--------------------------------------------------------------------- sub check_user_email{ while(<USRNF>){ chomp; my $user = @_; my $email = @_; my (@userinfo) = split(/\t/, $_); if ( (@userinfo[0] ne $user) && (@userinfo[2] ne $email) ){ return "good"; } elsif ( @userinfo[0] eq $user ){ my title = "User name already in use.!"; my body = q(<body bgcolor="black" text="red"> <h3>The username $user is already in use.</h3><br><br> <h2>Please click on your browser's back button and try a different +one.</h2></a><hr> </body>); return ($title, $body); } else { my title = "Account already activated.!"; my body = q(<body bgcolor="black" text="red"> <h3>Our records show that you already have a valid account.</h3><br +><br> <h2>If you wish to create another one you must first delete the old + one.<br> </h2><h3>Please email me<a href="mailto:eoinmurphy@dubli +n.com"> here</a> to edit any account info. <hr> </body>); return ($title, $body); close(USRNF); } } #--------------------------------------------------------------------- sub good{ my @info = @_; my $title = "Registration successful!"; my $body = q(<body> <h1>Registration Confirmation</h1> <hr> <p>Dear , $real_name</p> <p>Thank you for registering with us. You have supplied us with the following information:</p> <blockquote> <p><strong>Real name:</strong>\t$real_name <br> <strong>Username:</strong>\t$user_name <br> <strong>Password:</strong>\t$password <br> <strong>E-mail:</strong>\t$email <br> <strong>Date of Birth:</strong>\t$dateofbirth <br> <strong>City:</strong>\t$city <br> <strong>Country:</strong>\t$country <br> </p> </blockquote> <p>If any of this information is incorrect, please email me <a href="mailto:eoinmurphy@dublin.com">here</a> to change it. I reserve the right to delete any user if he\she use this account for illegal purposes.</p> <blockquote> <blockquote> <blockquote> <p>Sincerely,</p> <p><em>Webmaster, Eoin.</em></p> </blockquote> </blockquote> </blockquote> <hr> <h5>You may return to the feedback form by using the <em>Back</em> button in your browser.</h5> <h5>Revised: <!--webbot bot="TimeStamp" startspan s-type="EDITED" s-format="%B %d, %Y" -->December 31, 2002<!--webbot bot="TimeStamp" i-checksum="39470" endspan -->.</h5> </body>); open(USRNF,">>pass") or die "Couldn't find user file.\n"; prinf USRNF "$info[0] $info[1] $info[2] $info[3]. $info[4] + $info[5] $info[6] $info[7]"; close(USRNF); return($title, $body); } sub password{ $s = @_; srand($s ^ time); @c=split(/ */, "bcdfghjklmnpqrstvwxyz"); @v=split(/ */, "aeiou"); for($i = 1; $i <=4; $i +=1;){ return($c[int(rand(20))], $v[int(rand(5))]) } #--------------------------------------------------------------------- #END #---------------------------------------------------------------------
Edit by tye, add READMORE
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: To register or not to register, that is the question!
by virtualsue (Vicar) on Dec 31, 2002 at 14:24 UTC | |
|
Re: To register or not to register, that is the question!
by Anonymous Monk on Dec 31, 2002 at 14:14 UTC | |
|
Re: To register or not to register, that is the question!
by metadatum (Scribe) on Dec 31, 2002 at 14:20 UTC | |
by JamesNC (Chaplain) on Dec 31, 2002 at 14:40 UTC | |
|
Re: To register or not to register, that is the question!
by poj (Abbot) on Dec 31, 2002 at 14:43 UTC |