Make your own free website on
#!/usr/bin/perl if ($ENV{'REQUEST_METHOD'} eq 'POST') { # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); # Load the FORM variables foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } open (MESSAGE,"| /usr/lib/sendmail -t"); # Format email header information print MESSAGE "To: $FORM{submitaddress}\n"; if ($FORM{email} ne "") { print MESSAGE "Reply-To: $FORM{email}\n"; } # Write the actual email message print MESSAGE "Subject: Feedback from $FORM{name} at $ENV{'REMOTE_HOST'}\n\n"; if ($FORM{email} ne "") { print MESSAGE "Email: $FORM{email}\n"; } if ($FORM{reply} eq "yes") { print MESSAGE "Please reply.\n\n"; } print MESSAGE "What sayeth thou?\n\n"; print MESSAGE "$FORM{feedback}\n"; close (MESSAGE); # Thank the user and acknowledge # the feedback &thank_you; } &sub_error; sub sub_error { # Format an error message for the user print "Content-type: text/html\n\n"; print "<HTML>\n"; print "<HEAD>\n"; print "<TITLE>Request Form Error</TITLE>\n"; print "</HEAD>\n"; print "<BODY>\n"; print "<H1>Request Form Error</H1>\n"; print "<HR>\n"; print "<P>\n"; print "Form input was not proccessed. Please mail your "; print "remarks to $FORM{submitaddress}\n"; print "</body>\n"; print "</HTML>\n"; } sub evil_characters { print "Content-type: text/html\n\n"; print "<HTML>\n"; print "<HEAD>\n"; print "<TITLE>Illegal Email Address</TITLE>\n"; print "</HEAD>\n"; print "<BODY>\n"; print "<H1>Illegal Email Address</H1>\n"; print "<HR>\n"; print "<P>\n"; print "The Email address you entered contains illegal"; print "characters. Please back up and correct, then resubmit.\n"; print "</body>\n"; print "</HTML>\n"; } sub thank_you { print "Content-type: text/html\n\n"; print "<HTML>\n"; print "<HEAD>\n"; print "<TITLE>Thank You!</TITLE>\n"; print "</HEAD>\n"; print "<BODY BGCOLOR=#FFFFFF TEXT=#000000>\n"; print "<H1>Thank You!</H1>\n"; print "\n"; print "<P>\n"; print "<H3>Your feedback is greatly appreciated.<BR>\n"; print "Click here to <A HREF=$ENV{'REFERRER'}>Back</A>.\n"; print "<P>\n"; print "</body>\n"; print "</HTML>\n"; exit(0); }