#!/bin/perl # Define fairly-constants # This should match the mail program on your system. $mailprog = '/usr/lib/sendmail'; # This should be set to the username or alias that runs your # WWW server. $recipient = 'sales@sevcon.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 "Thank you"; #print "

Thank you

"; # 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; } # If the comments are blank, then give a "blank form" response &blank_response unless $FORM{'Name'}; &blank_response unless $FORM{'Company'}; &blank_response unless $FORM{'Address'}; # Now send mail to $recipient open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n"; print MAIL "Reply-to: $FORM{'E-mail'} ($FORM{'Name'})\n"; print MAIL "Subject: Enquiry form submission\n\n"; print MAIL "$FORM{'Name'} (from $FORM{'Company'}) sent the following\n"; print MAIL "Form submitted from Sevcon Enquiry Page:\n\n"; print MAIL "------------------------------------------------------------\n"; print MAIL "$FORM{'Name'}\n"; print MAIL "$FORM{'Company'}\n"; print MAIL "$FORM{'Position'}\n"; print MAIL "$FORM{'Address'}\n"; print MAIL "$FORM{'Telephone'}\n"; print MAIL "$FORM{'Fax'}\n"; print MAIL "$FORM{'E-mail'}\n"; print MAIL "Preferred Reply: $FORM{'Preferredres'}\n"; print MAIL "Product Type: $FORM{'Productype'}\n"; print MAIL "Info Type: $FORM{'Infotype'}\n"; print MAIL "Add to updates: $FORM{'updateyes'} $FORM{'updateno'}"; print MAIL "\n------------------------------------------------------------\n"; print MAIL "Server protocol: $ENV{'SERVER_PROTOCOL'}\n"; print MAIL "Remote host: $ENV{'REMOTE_HOST'}\n"; print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n"; close (MAIL); # Make the person feel good for writing to us #print "Thank you for sending your enquiry to Sevcon Ltd!

"; #print "Please follow this link to return to our home page

"; #start good response... print ""; print ""; print ""; print "Thank you"; print ""; print ""; print "

"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
\"sevcon
Thank you for submitting your enquiry, your request will be dealt with as soon as possible."; print "

Please click on the Sevcon logo to return to our home page.

\"back\"
"; print "
"; print ""; # ------------------------------------------------------------ # subroutine blank_response sub blank_response { #print "One of the required fields appears to be blank, and thus were not sent "; #print "to our webmasters. Please re-enter your details, or "; #print "return to our home page

"; print ""; print ""; print ""; print "Thank you"; print ""; print ""; print "

"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
\"sevcon
Sorry your request has been unsuccessful, please use the back button and ensure that the name, company and address field has been filled."; print "

Or, alternatively E-mail: sales@sevcon.com
"; print "

"; print "

Please click on the Sevcon logo to return to our home page.

"; print "

\"back\"
"; print "
"; print ""; exit; }