#!/usr/bin/perl ####################################################### #-----------------------------------------------------# # BS Form (version 1.3) # #-----------------------------------------------------# # Copyright 1999 Brian Stanback # # # # http://www.stanback.net # #-----------------------------------------------------# # You are free to change this script in any way you # # want, as long as the copyright and this message # # remain intact. I will not be held responsable for # # any damage this script may cause. If you use this # # script I would appreciate a link back to my site # # (stanback.net). Enjoy! :-) # ####################################################### # This is a simple form which will take in a users name, # email, phone number, message, and message subject and # email it to you. It can read from a file and automatically # send it to the user. Script does not require SSI. ######################### # Declare the variables # ######################### $mailprogram = "/usr/lib/sendmail"; # Sendmail $myemail = 'brian@stanback.net'; @required = ('email','subject'); # Required Fields $auto_response = "False"; # Do you want an autoresponse? # True = yes and False = no $auto_response_file = "response.txt"; # File with the message you want to give the user # automatically when (s)he sends the form. ##################################################### # You don't need to change anything below this line # ##################################################### # Parse the form read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/\;//g; $value =~ s/\|//g; $value =~ s/\>/g; $value =~ s/\>/</g; $FORM{$name} = $value; } $FORM{'email'} =~ s/^([^ ]+) (.*)/$1/g; # Check for all required fields foreach $check(@required) { unless ($FORM{$check}) { print "Content-type: text/html\n\n"; print "\n
\n\n"; } print "