#!/usr/bin/perl ####### Version 12.28.03 ####### This file should be called formwrite.cgi ####### and it should be chmod 755 # # # This does not have require any data in the form to make work. # It will send anything from the form to a file. #--------------------------------------------------------------# ## the $done_url is the page to send people to after ## they press the submit button. ## YOU MUST CHANGE THE NEXT LINE !! $done_url="http://www.coastlandtech.com/spam.html"; ## MAKE a file $outfile = "/home/temp/work/userid.txt"; &mkdate; ## You should not need to change this next line for users on my CoastlandTech.com servers. ## On other server this line could need changing. Ask your System Admin ## You MAY NEED TO CHANGE .. $mailprog = '/usr/sbin/sendmail'; &parse_form; $body="$data "; &dowork; print "Location: $done_url\n\n"; exit; sub mkdate { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); if ($year > 100) { $year= $year-100 ; } if ($year < 10 ) { $year = "0$year"; } $month = ($mon + 1); @months = ("January","February","March","April","May","June","July","August","September","October","November","December"); $the_date = "$months[$mon] $mday, 20$year Time: $hour:$min "; } # Parse Form Subroutine sub parse_form { $data = "Submission from FantasticDentist.com:\n\n"; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs){ ($val1, $val2) = split(/=/, $pair); $val1 =~ tr/+/ /; $val1 =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $val2 =~ tr/+/ /; $val2 =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; ##Hacked 11/29/2003 FIX.. ###$item =~ s/"/"/g; $val2 =~ s/bcc:/SPAM1/g; $val2 =~ s/To:/SPAM2/g; $val2 =~ s/to:/SPAM3/g; $val2 =~ s/to:/SPAM4/g; $val2 =~ s/Subject:/SPAM5/g; $val2 =~ s/bcc:/SPAM6/g; $val2 =~ s/cc:/SPAM7/g; $val2 =~ s/CC:/SPAM8/g; $val2 =~ s/cC:/SPAM9/g; $val2 =~ s/Cc:/SPAM10/g; $val2 =~ s/From:/SPAM11/g; ## if ($FORM{$val1}) { $FORM{$val1} = "$FORM{$val1}, $val2"; } else { $FORM{$val1} = $val2; } if ($val2) { $data = "$data $val1: $val2 \n\n"; } } } sub dowork { ## DO NOT MOVE THIS LINE FROM THIS LOCATION AND ## PUT IN YOUR EMAIL ADDRESS HERE. THIS IS DONE HERE FOR SECURITY !! ## THIS IS A TEST PROGRAM TO CHECK FOR SPAM open (WRITE, ">>$outfile") || Die; print WRITE "$body"; close (WRITE); ################################# ### This is only to send a email to let you know to look at the data.. ################################# # open (MAIL, "|$mailprog -t") || Die; # print MAIL "To: admin\@coastlandtech.com\n", # "From: TestScript\n", # "Subject: Check Data\n\n", # "Check $outfile"; # close (MAIL); ############################# } 1;