#!/usr/local/bin/perl use CGI; $q = new CGI; $thefile = "email.txt"; $my_email = "webmaster\@itsmeagain.com"; $email_entered = $q->param('email'); #check for email valid $FORM = $q->param('email') . ","; if ($q->param('email')) { unless ($FORM =~ /\w+@\w+.\w+/) { print $q->header(-type=>'text/html', accept=>'*/*'); print $q->start_html(-title=>'Bad Email'); #print "Content-type: text/html\n\n"; print "Bad E-mail\n"; print "

Bad E-mail


The e-mail address that you've\n"; print "entered, $FORM is invalid. Please click back and\n"; print "try again.\n"; print $q->end_html; exit; } #chk for cookie $JSCRIPT=<cookie( "email" ); if ($chkcookie eq $email_entered){ print $q->header(-type=>'text/html', accept=>'*/*'); print $q->start_html(-title=>'Already Entered This Email', script=>$JSCRIPT); print "

You just entered this email address!

---Click back to continue or wait and I'll send you!"; print $q->end_html; } else { &filewritee; } } else { print $q->header(-type=>'text/html', accept=>'*/*'); print $q->start_html(-title=>'Nothing Entered'); print "

Nothing Entered.



\n"; print "You didn't enter anything, Pls go back and enter a valid email address"; print $q->end_html; } sub filewritee{ open (EMAILADDRESS, ">> $thefile") or die "Can't open file: $!"; flock EMAILADDRESS, 2; print EMAILADDRESS $FORM; close EMAILADDRESS; &sendmail; } sub sendmail{ open (MAIL, "| /usr/vde/bin/sendmail -t") or die "couldnt open sendmail: $!"; print MAIL <) { print MAIL; } close FILE; close (MAIL); &successs; } sub successs{ $JSCRIPTT=<header(-type=>'text/html', accept=>'*/*'); print $q->start_html(-title=>'-Email Added Successfully!', -script=>$JSCRIPTT); print "

SUCCESS!



\n"; print <Your Email address:
\"$email_entered\" was added successfully!
You should be getting your first mail shortly!

ENDOF print $q->end_html; exit; }