{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\f0\fs20 #!/usr/bin/perl\par
\par
##!/usr/bin/perl\par
#    chfeedback.pl Feedback Form Perl Script Ver 2.2.4\par
#    Generated by thesitewizard.com's Feedback Form Wizard.\par
#    Copyright 2000-2009 by Christopher Heng. All rights reserved.\par
#\par
#    thesitewizard and thefreecountry are trademarks of Christopher Heng.\par
#\par
#    Get the latest version, free, from:\par
#        http://www.thesitewizard.com/wizards/feedbackform.shtml\par
#\par
#\tab You can read the Frequently Asked Questions (FAQ) at:\par
#\tab\tab http://www.thesitewizard.com/wizards/faq.shtml\par
#\tab\par
#\tab I can be contacted at:\par
#\tab\tab http://www.thesitewizard.com/feedback.php\par
#\tab Note that I do not normally respond to questions that have\par
#\tab already been answered in the FAQ, so *please* read the FAQ.\par
#\par
#\par
#    LICENCE TERMS\par
#    \par
#    1. You may use this script on your website, with or\par
#    without modifications, free of charge.\par
#    \par
#    2. You may NOT distribute or republish this script, whether\par
#    modified or not. The script can only be distributed by the author,\par
#    Christopher Heng.\par
#    \par
#    3. THE SCRIPT AND ITS DOCUMENTATION ARE PROVIDED\par
#    "AS IS", WITHOUT WARRANTY OF ANY KIND, NOT EVEN THE\par
#    IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A\par
#    PARTICULAR PURPOSE. YOU AGREE TO BEAR ALL RISKS AND\par
#    LIABILITIES ARISING FROM THE USE OF THE SCRIPT,\par
#    ITS DOCUMENTATION AND THE INFORMATION PROVIDED BY THE\par
#    SCRIPTS AND THE DOCUMENTATION.\par
#\par
#    If you cannot agree to any of the above conditions, you\par
#    may not use the script. \par
#    \par
#    Although it is NOT required, I would be most grateful\par
#    if you could also link to thesitewizard.com at:\par
#\par
#       http://www.thesitewizard.com/\par
#\par
\par
\par
# ---------- USER CONFIGURATION SECTION ---------------\par
# Before this script will do anything useful, the following\par
# variables must be set.\par
#\par
# MANDATORY VARIABLES\par
# $mailprog - the location of your mail program and the parameters\par
#           to pass to it.\par
#\tab\tab\tab eg $mailprog = "/usr/lib/sendmail" ;\par
# $mailto - email address where the feedback will be sent\par
#           eg, $mailto = 'yourname@example.com' ;\par
# $subject - the subject line in the email sent by the feedback form\par
#           eg $subject = "Feedback Form" ;\par
#\par
# $formurl - the URL of your feedback form\par
#           eg $formurl = "http://www.example.com/feedback.html" ;\par
# $thankyouurl - the URL of your thank you page\par
#           eg $thankyouurl = "http://www.example.com/thanks.html" ;\par
# $errorurl - the URL of your error page\par
#           eg $errorurl = "http://www.example.com/error.html" ;\par
\par
$mailprog = "/usr/lib/sendmail" ;\par
$mailto = 'request@5starsigning.com' ;\par
$subject = "Signing Request" ;\par
$formurl = "https://www.5starsigning.com" ;\par
$errorurl = "https://www.5starsigning.com" ;\par
$thankyouurl = "https://www.5starsigning.com/thankyou.txt" ;\par
\par
# ---------- END OF USER CONFIGURATION SECTION ------------\par
\par
# ---------- functions -----------\par
sub redirect_url \{\par
\tab my ( $url )\tab = shift ;\par
\tab print "Location: $url\\n\\n" ;\par
\}\par
\par
sub parse_form_data \{\par
\tab my ($request_method, $input_string, $content_length) ;\par
\tab my (@vars, $indiv_var, $name, $value);\par
\tab my (%form) ;\par
\par
\tab $request_method\tab = $ENV\{'REQUEST_METHOD'\} ;\par
\tab $content_length\tab = $ENV\{'CONTENT_LENGTH'\} ;\par
\par
\tab # load the entire string into $input_string\par
\tab if ($request_method\tab =~ /post/i) \{\par
\tab\tab $input_string\tab = "" ;\par
\tab\tab read( STDIN, $input_string, $content_length ) ;\par
\tab\}\par
\tab else \{\par
\tab\tab $input_string\tab = $ENV\{ 'QUERY_STRING' \};\par
\tab\}\par
\tab unless (defined $input_string) \{\par
\tab\tab $input_string\tab = "" ;\par
\tab\}\par
\par
\tab # put all the variable pairs (name=value) into an array\par
\tab @vars\tab = split( /&/, $input_string );\par
\par
\tab # process each individual name, value pair, putting them\par
\tab # into a hash for easy access\par
\tab foreach $indiv_var ( @vars ) \{\par
\par
\tab\tab # separate the pair\par
\tab\tab ($name, $value)\tab = split( /=/, $indiv_var, 2 );\par
\par
\tab\tab # translate encoding\par
\tab\tab $name\tab =~ s/%([\\da-fA-F]\{2\})/pack("C", hex($1))/eg;\par
\tab\tab $name\tab =~ tr/+/ /;\par
\tab\tab unless (defined $value) \{\par
\tab\tab\tab # just in case there was no equals as in ISINDEX\par
\tab\tab\tab $value\tab = "" ;\par
\tab\tab\}\par
\tab\tab $value\tab =~ s/%([\\da-fA-F]\{2\})/pack("C", hex($1))/eg;\par
\tab\tab $value\tab =~ tr/+/ /;\par
\par
\tab\tab # put the pair in the hash for easy access\par
\tab\tab $form\{$name\}\tab = $value ;\par
\tab\}\par
\par
\tab return wantarray ? %form : undef ;\par
\}\par
\par
sub send_email \{\par
\tab my ($mailprog, $email, $name, $mailto, $subject, $message) = @_ ;\par
\par
\tab if (open MAIL, "|$mailprog -t") \{\par
\tab\tab print MAIL "To: $mailto\\n" ;\par
\tab\tab print MAIL "From: \\"$name\\" <$email>\\n" ;\par
\tab\tab print MAIL "Reply-To: \\"$name\\" <$email>\\n" ;\par
\tab\tab print MAIL "X-Mailer: chfeedback.pl 2.2.4\\n" ;\par
\tab\tab print MAIL "Subject: $subject\\n\\n" ;\par
\tab\tab print MAIL $message ;\par
\tab\tab close MAIL ;\par
\tab\}\par
\tab # ignore fails, just don't do anything\par
\par
\tab return ;\par
\}\par
\par
# ----------- main program ------\par
\par
my %form = parse_form_data();\par
\par
my $email ;\par
if (exists $form\{"email"\}) \{\par
\tab $email\tab = $form\{"email"\} ;\par
\}\par
else \{\par
\tab redirect_url( $formurl );\par
\tab exit ;\par
\}\par
if (($email eq "") || ($email =~ /[\\r\\n]/)) \{\par
\tab redirect_url( $errorurl );\par
\tab exit ;\par
\}\par
\par
my $name = $form\{"fullname"\} ;\par
if (($name eq "") || ($name\tab =~ /[\\r\\n]/)) \{\par
\tab redirect_url( $errorurl );\par
\tab exit ;\par
\}\par
\par
my $comments = $form\{'comments'\} ;\par
if ($comments eq "") \{\par
\tab redirect_url( $errorurl );\par
\tab exit ;\par
\}\par
\par
my $http_referer = $ENV\{ 'HTTP_REFERER' \};\par
my $message\tab =\par
\tab "This message was sent from:\\n" .\par
\tab "$http_referer\\n" .\par
\tab "------------------------------------------------------------\\n" .\par
\tab "Name of sender: " . $name . "\\n" .\par
\tab "Email of sender: " . $email . "\\n" .\par
\tab "------------------------- COMMENTS -------------------------\\n\\n" .\par
\tab $comments .\par
\tab "\\n\\n------------------------------------------------------------\\n" ;\par
\par
send_email ( $mailprog, $email, $name, $mailto, $subject, $message );\par
redirect_url( $thankyouurl );\par
}
 