Viewing file: approve.cgi (1.07 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/perl
$thankyoufile="verificationthanks.html";
read (STDIN, $FormDataString, $ENV{'CONTENT_LENGTH'}); @FormDataArray = split(/&/,$FormDataString);
for ($n=0; $n<=$#FormDataArray; $n++) { $FormDataArray[$n] =~ s/\+/ /g; #turn plusses into spaces $FormDataArray[$n] =~ s/%(..)/pack("c",hex($1))/ge; #turn hexed into ascii %Form = (%Form, (split /\=/,$FormDataArray[$n],2)); };
$Form{'email'} =~ s/[^A-Za-z0-9\-\_\.\@\+\&\/]//g ; if ($Form{'email'} !~ /^[^\@]+\@[^\@]+\.[^\@]+$/) { &rejection; } $Form{'email'} =~ tr/A-Z/a-z/; open (APPROVED, ">>/home/goodluck/public_html/mail/controls/approved.txt"); print APPROVED ("$Form{'email'}\n"); close (APPROVED);
print ("Content-Type: text/html\n\n"); open (THANKYOU, "$thankyoufile"); @thankyou = <THANKYOU>; close (THANKYOU); foreach $line (@thankyou) { print ($line); } exit;
sub rejection { print <<EOF; Content-Type: text/html
<HTML><HEAD></HEAD><BODY bgcolor="#FFFFFF"><center><b> Error in E-Mail Format<BR> Please go "back" and resubmit. <P> Thank you. </b></center> </BODY></HEAD> EOF ; exit; }
|