#!/usr/bin/perl # # copyright meng weng wong # freely distributable under the terms of the gnu public license # version 2.0 # this perl program will do basically the same thing as # post-query, only it's written in perl, not hexadecimal. # see http://www.seas.upenn.edu/~mengwong/forms/ ################################################## initialization #-------------------------------------------------------------------- # WARNING: IF YOU WANT TO USE THE FEATURE THAT MAILS TO A SPECIFIC USER # THE VARIABLES FOUND ON YOUR FORM, YOU MUST SET THE $USER VARIABLE TO # THE CORRECT EMAIL ADDRESS. #-------------------------------------------------------------------- $USER = "noemi\@bayarea.net"; push(@INC,"/usr/local/cgi-bin/"); require 'cgi-lib.pl'; $MAILPROG = "/usr/bin/mail"; @httpdenv = ( AUTH_TYPE, CONTENT_LENGTH, CONTENT_TYPE, DOCUMENT_ROOT, GATEWAY_INTERFACE, HTTP_ACCEPT, HTTP_USER_AGENT, PATH, PATH_INFO, PATH_TRANSLATED, QUERY_STRING, REMOTE_ADDR, REMOTE_HOST, REMOTE_IDENT, REMOTE_USER, REQUEST_METHOD, SCRIPT_NAME, SERVER_NAME, SERVER_PORT, SERVER_PROTOCOL, SERVER_SOFTWARE, ); ################################################## get input &ReadParse; print &PrintHeader; #-------------------------------------------------------------------- # The following statements cause the html statement to be displayed # to the user that invoked this form. #-------------------------------------------------------------------- print <<"header"; Generic Form Response

Thank you for using this form

header #-------------------------------------------------------------------- # The following statements display the variables found. #-------------------------------------------------------------------- print "

The Variables found are:

"; print &PrintVariablesShort(%in); print "
\n"; #-------------------------------------------------------------------- # The following statements display additional environment variables found #-------------------------------------------------------------------- print "

Furthermore, the following environment variables were set by the server:\n"; foreach $key (sort(@httpdenv)) { print " ", $key, '=', $ENV{$key}, "
"; } #-------------------------------------------------------------------- # Uncomment out the next few lines if you want to send mail to # the user defined in $USER above. #-------------------------------------------------------------------- #open (MAIL, "|$MAILPROG -s cgi-form $USER"); #foreach $key (sort(keys %in)) { # print MAIL "\t", $key, " = ", $in{$key}, "\n"; #} #close MAIL; #-------------------------------------------------------------------- # The following statems write out the variables to a world writeable # directory # NOTE: THIS IS NOT RECOMMENDED SINCE IT CAN POTENTIALLY LEAD TO # OTHER USERS TO WRITE TO YOUR DIRECTORY. #-------------------------------------------------------------------- #open (TO_DISK_FILE, ">/tmp/worldwrite"); # foreach $key (sort(keys %in)) { # print TO_DISK_FILE "\t", $key, " = ", $in{$key}, "\n"; # } #close (TO_DISK_FILE);