#!/opt/gnu/bin/perl5 -w use CGI qw(:standard :netscape); $ENV{'SYBASE'} = '/usr/local/sybase'; use Sybase::DBlib; print "Content-type: text/html\n\n"; ####################################################################### # Application Information # ######################################################################## # Application Name: Extropia's WebResponder # Application Authors: Eric Tachibana (Selena Sol) and Gunther Birznieks # Version: 5.0 # Last Modified: 17NOV98 # # Copyright: # # You may use this code according to the terms specified in # the "Artistic License" included with this distribution. The license # can be found in the "Documentation" subdirectory as a file named # README.LICENSE. If for some reason the license is not included, you # may also find it at www.extropia.com. # # Though you are not obligated to do so, please let us know if you # have successfully installed this application. Not only do we # appreciate seeing the wonderful things you've done with it, but we # will then be able to contact you in the case of bug reports or # security announcements. To register yourself, simply send an # email to register@extropia.com. # # Finally, if you have done some cool modifications to the scripts, # please consider submitting your code back to the public domain and # getting some community recognition by submitting your modifications # to the Extropia Cool Hacks page. To do so, send email to # hacks@extropia.com # # Description: # # This form processing script allows a site administrator to process # multiple HTML forms with one script. By taking advantage of various # hidden tags which this script can understand, the admin can use this # one script to process all of her forms in multiple ways from dynamic # email to building a database. We have included three examples of how # you might use this script including a Jump Box, a Download Form and a # Simple Feedback form. # # Basic Usage: # # 1. Read the README.CHANGES, README.LICENSE, and README.SECURITY # files and follow any directions contained there # # 2. Change the first line of each of the scripts so that they # reference your local copy of the Perl interpreter. (ie: # #!/usr/local/bin/perl) (Make sure that you are using Perl 5.0 or # higher.) # # 3. Set the read, write and access permissions for files in the # application according to the instructions in the # README.INSTALLATION file. # # 4. Define the global variables in the Setup File (choose any # in the Setup_files directory by default) according to the # instructions in the README.INSTALLATION file. # # 5. Point your web browser at the form specified in the setup file # (i.e.: http://www.yourdomain.com/cgi-bin/Form_processor/Forms/feedback.cgi) # # More Information # # You will find more information in the Documentation sub-directory. # We recommend opening the index.html file with your web browser to # get a listing of supporting documentation files. ######################################################################## # Application Code # ######################################################################## # The script begins by telling the Perl interpreter that # it should continuously flush its buffer so that text # from this script is sent directly to the Web Browser. # We do this to streamline debugging and make sure that # the script operates with the flow we want it to. #$| = 1; ####################################################################### # Read and Parse Form Data # ####################################################################### # Next, the ReadParse subroutine in cgi-lib.pl is used to # read the incoming form data. However, the subroutine is # sent "form_data" as a parameter so that the associative # array of form keys/values comes back with a descriptive # name rather than just %in. &require_supporting_libraries (__FILE__, __LINE__, "./Library/cgi-lib.pl"); #&ReadParse(*form_data); ####################################################################### # Load Supporting Files # ####################################################################### # Once it has read the incoming form data, the script # will be able to determine which setup file it should # use to process the incoming form data. # # Perhaps a bit of explanation is in order. # # Every HTML form which utilizes this application as a # backend MUST include a "hidden" form variable called # "setup_file" using the following syntax somewhere # between the
tags: # # # # For example, the following code would define a setup # file called download.setup: # # # # This variable will provide the name of the file which # this script will use to define all of the customizable # aspects of its operation. For example, the setup file # defines who the script should E-mail form responses to # and what the script should send to the Web Browser as a # response when a user submits some information. # # The reason for this is that this one script can handle # an infinite amount of unique forms. # # Each form has a corresponding setup file which defines # how the script performs. The logic (and programming) # remains the same for all forms. All that changes are # the variables and subroutines in the setup files. This # makes it very easy for you to quickly generate diverse # forms with the one backend. # # So the script first takes the value of "setup_file" # coming in from the form (which cgi-lib.pl has already # parsed into the %form_data associative array) and # assigns it to the variable $setup_file. # # Then it uses the subroutine # require_supporting_libraries documented later in this # script to actually load the setup file and all of its # configuration options. # # Once the setup file has been loaded, the script also # uses the require_supporting_libraries subroutine to # load the mail library which we will use to send email to # the form administrator. $setup_file = param('setup_file'); $setup_file =~ /([\w-.]+setup[\w-.]+)/; $untainted_setup_file = $1; &require_supporting_libraries (__FILE__, __LINE__, "./Setup_files/$untainted_setup_file"); &require_supporting_libraries (__FILE__, __LINE__, "$location_of_mail_lib"); #print "setup_file = $setup_file