#!/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 "\n";
print "\n";
print "Request Form Error\n";
print "\n";
print "\n";
print "Request Form Error
\n";
print "
\n";
print "\n";
print "Form input was not proccessed. Please mail your ";
print "remarks to $FORM{submitaddress}\n";
print "\n";
print "\n";
}
sub evil_characters {
print "Content-type: text/html\n\n";
print "\n";
print "
\n";
print "Illegal Email Address\n";
print "\n";
print "\n";
print "Illegal Email Address
\n";
print "
\n";
print "\n";
print "The Email address you entered contains illegal";
print "characters. Please back up and correct, then resubmit.\n";
print "\n";
print "\n";
}
sub thank_you {
print "Content-type: text/html\n\n";
print "\n";
print "
\n";
print "Thank You!\n";
print "\n";
print "\n";
print "Thank You!
\n";
print "\n";
print "\n";
print "
Your feedback is greatly appreciated.
\n";
print "Click here to Back.\n";
print "
\n";
print "\n";
print "\n";
exit(0);
}