#!/usr/local/bin/perl ########################## THE README FILE ####################### #All of the installation instructions are in funform.cgi #IT really is that easy. # #BE SURE TO ISSUE THE FOLLOWING COMMANDS: # # chmod 755 Funform # chmod 755 Funform/funform.cgi # #This program is meant to be used in conjunction with #BigNoseBird.Com's Series on CGI-BIN Programming. Feel #free to use it as you wish. # #This is how it works.... # #You create a form anyway you want, with as many fields #as you see fit for your purposes. # #This program then chops up the information, formats it #and e-mails it to the intended recipient. # #What is nice about this program is that you can have more #than one form go to various people, without having to have #more than one program. # #Be sure to give each field a MEANINGFULL NAME! For instance: # # NAME="FIRST_NAME" is okay # NAME="FIRST NAME" is NOT. # #Do not put spaces in the NAME. # #EACH form MUST have the following entries: # # # # #When you are done testing, set the SEND_MAIL="Y" in the funform.cgi #to allow mail to be sent. # #Good luck and enjoy! # ###### END OF THE README FILE ############## # A general purpose form decoder for use with all forms. # # what it does is accept any information from ANY HTML form # formats it, and mails it. # # To operate properly, the form must have the following # entries: # # # This way the person receiving the mail knows where it came from # The MAIL_TO is the person you want to receive the submission # # 1997 by bruce gronich for the public domain. #This program is intended to be used as a learning tool. It #is given freely AS IS and comes with no warranty. The author #is not responsible for any damages caused by its use or #misuse. #cp the funform.html to your html root directory. #modify the funform.html to meet your needs. #change the name of the path of the /cgi-bin/ if needed #BNB SAYS- Configure this to your sendmail $mail_program="/usr/lib/sendmail -t "; #BNB SAYS- Set these options to meet your needs #let SEND_MAIL="Y" when you are done testing and want mail to be sent $SEND_MAIL="N"; ###################################################################### ###### THIS IS WHERE OUR PROGRAM STARTS! ############################# ###################################################################### #This first part of the program splits up our data and gets it #ready for formatting and mailing. $i=0; read(STDIN,$temp,$ENV{'CONTENT_LENGTH'}); @pairs=split(/&/,$temp); foreach $item(@pairs) { ($key,$content)=split(/=/,$item,2); $content=~tr/+/ /; $content=~s/%(..)/pack("c",hex($1))/ge; $fields{$key}=$content; $i++; $item{$i}=$key; $response{$i}=$content; } #Re-assign a couple of variables for readability reasons $send_to = $fields{MAIL_TO}; $form_id = $fields{FORM_NAME}; $msg_from = $fields{E_MAIL}; #Set up our HTML Result Form print "Content-type: text/html\n\n"; print "\n"; print "
\n"; print "\n"; print "
\n"; print "
"; print ""; print "
\n"; print " SUBMISSION FORM: $form_id\n"; print " E-MAIL TARGET: $send_to\n"; print "
\n"; $i=1; while ( $item{$i} gt " ") { if ($SEND_MAIL eq "Y") { print MAIL " $item{$i}: $response{$i}\n"; } print " $item{$i}: $response{$i}\n"; $i++; } print "