#!/usr/local/bin/perl # READ ME HERE: This form must be opened with Notepad (or the Simple Text # editor if you are using a MAC). You will need to follow instructions # labeled -----CHANGE HERE------. There are 4 of them in this form. # After you are done, save this script and ftp it in your public_html directory. # You must ftp it as an ASCII file both from the server and back into # the server. # Reference this script
from your HTML page # Telnet into shell.best.com - type: cd public_html - type: chmod 755 feedback.cgi # That's all you need to do. # Define fairly-constants # This should match the mail program on your system. $mailprog = 'sendmail'; # -----CHANGE HERE------ : replace yourname with your actual login name $recipient = 'yourname@best.com'; # Print out a content-type for HTTP/1.0 compatibility print "Content-type: text/html\n\n"; # Print a title and initial heading print "Order Form"; # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Stop people from using subshells to execute commands # Not a big deal when using sendmail, but very important # when using UCB mail (aka mailx). $value =~ s/~!/ ~!/g; # Uncomment for debugging purposes #print "Setting $name to $value

"; $FORM{$name} = $value; print # "\$FORM{ ", $name," } to ",$FORM{ '$name' },"

"; } # If the description is blank, then give a "blank form" response &blank_response("Name:") unless $FORM{'your_name'}; #$FORM{'name'} =~ s/ /_/g; # Now send mail to $recipient # -----CHANGE HERE------ : replace yourname with your actual login name open (MAIL, "|$mailprog $recipient") || die "Unable to send request\nPlease send e-mail to yourname@best.com, Thank you\n"; print MAIL "Reply-to: $FORM{'email_address'}\n"; print MAIL "Subject: Reply form\n"; print MAIL "\n\n"; # -----CHANGE HERE------ : replace tags with the actual tags from your HTML form. # Make sure each tag is one word - you can not have spaces incide (you can use underscore) # Call your name tag (or your first tag) your_name on your HTML form - this form will look for # this file specifically. # Add new entries following the same examples below print MAIL "Name: $FORM{'your_name'}\n"; print MAIL "Address: $FORM{'address'}\n"; print MAIL "City: $FORM{'city'}\n"; print MAIL "E-mail: $FORM{'email'}\n"; print MAIL "Fax#: $FORM{'fax'}\n"; print MAIL "Phone#: $FORM{'phone'}\n"; print MAIL "-----------------------------------------------\n"; close (MAIL); # -----CHANGE HERE (Optional)------ Make the person feel good for writing to you print "Your request has been sent

"; print '

Back to Home Page

'; # ------------------------------------------------------------ # subroutine blank_response sub blank_response { print "

Your request is incomplete.

"; print "You left the following required field blank:

$_[0]

"; print "You may use your Web Browser to go back.

"; exit; }