From: Sneex Date: Saturday, April 1, 2000 10:25 AM #!/usr/local/bin/perl -w =pod =head1 NAME infoRequest - A script for obtaining Requests for Information and immediately replying. =head1 SYNOPSIS /cgi/infoRequest.cgi =head1 DESCRIPTION I'll enter a longer description later... =head1 INSTALLATION Install this script into /cgi/ of relevant WWW server... =head1 SCRIPT CATEGORIES cgi mail stuff =head1 PREREQUISITES None... =head1 OSNAMES any OS using sendmail or a compatible mail server =head1 AUTHOR -Sneex- :] Systems Hacker FCCJ 501 W State St jacksonville, Fl 32202 Email: bill@fccj.org =head1 SEE ALSO L =cut # Uncomment when Debugging & Error Checking ... use strict; use diagnostics; # CGI Processing ... use CGI qw(:all); use CGI::Carp qw/fatalsToBrowser/; my($fccjPointer) = new CGI; $fccjPointer->import_names('FCCJ'); # Troubleshooting! Comment out when in production! #print "Content-type: text/html\n\n'Use Diagnostics' - Initialized!  "; #print $fccjPointer->dump; ############################################################################ # # Configurable section # ############################################################################ my $REPLY_TO = 'info@fccj.org'; my $SENDMAIL = '/usr/lib/sendmail'; # Use an entry like # # info-owner: /dev/null # # to suppress error messages from info-responder replies. # ############################################################################ # Was infoRequest.cgi called directly? If so, redirect ... unless ((param($FCCJ::x) && param($FCCJ::y)) || ($FCCJ::x + $FCCJ::y) > 0) { print "Content-type: text/html\n\n"; print `cat infoRequest.html`; exit; } # Globals ... my $required = 0; my $ercBuffer = ''; # Execute the logical stuff... &_verify(); &_main(); sub _verify() { # Optional field: #$ercBuffer .= '
Erc:  Salutation missing...' # unless ((param($FCCJ::select2)) || ($FCCJ::select2 ne 'NI')); $ercBuffer .= '
Erc:  Name missing...' unless ((param($FCCJ::textfield)) || ($FCCJ::textfield ne '')); $ercBuffer .= '
Erc:  Address missing...' unless ((param($FCCJ::textfield2)) || ($FCCJ::textfield2 ne '')); # apartment portion of Address is optional (field name: textfield3) $ercBuffer .= '
Erc:  City missing...' unless ((param($FCCJ::textfield4)) || ($FCCJ::textfield4 ne '')); $ercBuffer .= '
Erc:  State missing...' unless ((param($FCCJ::select)) || ($FCCJ::select ne 'NI')); $ercBuffer .= '
Erc:  Zip Code missing...' unless ((param($FCCJ::textfield5)) || ($FCCJ::textfield5 ne '')); # area code portion of Phone number is optional (field name: textfield6) # exchange portion of Phone number is optional (field name: textfield7) # 4 digit number portion of Phone number is optional (field name: textfield8) # extension portion of Phone number is optional (field name: textfield9) $ercBuffer .= '
Erc:  E-Mail UserID missing...' unless ((param($FCCJ::textfield10)) || ($FCCJ::textfield10 ne '')); $ercBuffer .= '
Erc:  E-Mail ISP Domain missing...' unless ((param($FCCJ::textfield11)) || ($FCCJ::textfield11 ne '')); # Format for testing: #$ercBuffer .= '
Erc:  Salutation missing...' # unless ((param($FCCJ::select2)) || ($FCCJ::select2 ne 'NI')); # Optional fields: # textfield12 = Career Interest # apCB = apCB (Application Packet checkbox) # catCB = catCB (Catalog checkbox) # csRB = csFall (Credit Schedule radiobutton) (Also available are csSpring & csSummer...) # cesRB = cesFall (Continuing Education Schedule radiobutton) (" " " cesSpring & cesSummer...) # fapCB = fap2000SummerCB (Financial Aid Packet checkbox for Summer 2000 only...) # fapRB = fapFall (Financial Aid Packet for 2001 Fall) (" " " fapSpring & fapSummer...) $required = 1 if ($ercBuffer =~ /Erc/gi); } sub _main() { print "Content-type: text/html\n\n"; if ($required) { print <<_Erc; Error! Required Data Missing!

FCCJ Home

ERROR! Required fields missing:

$ercBuffer

Please hit the browser's Back button and fill these required fields in. _Erc exit; } print <<_1SOH; Your Request Was Sent!

FCCJ Home

_1SOH print "

Your processed request is indicated below; a copy of which will be e-mailed to you.


"; my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime; my $sltime = "$sec$min$hour$mday$mon$year$wday"; my $stime = scalar localtime; print <<_1EOBA;

Hello from the FCCJ (info) E-Mail infoRequest CGI :]
Your request was received by the CGI on $stime.
This request was assigned the following
(dss) Security Number: $sltime.

=== Your Name and Address information:

_1EOBA print "$FCCJ::select2" unless ($FCCJ::select2 eq 'NI'); print " $FCCJ::textfield"; print "
$FCCJ::textfield2  "; print "  Apt: $FCCJ::textfield3" if ((param($FCCJ::textfield3)) || ($FCCJ::textfield3 ne '')); print "
$FCCJ::textfield4, $FCCJ::select $FCCJ::textfield5

Phone: ($FCCJ::textfield6) $FCCJ::textfield7-$FCCJ::textfield8 "; print "Ext: $FCCJ::textfield9" if ((param($FCCJ::textfield9)) || ($FCCJ::textfield9 ne '')); print "

E-Mail: $FCCJ::textfield10\@$FCCJ::textfield11

=== Your request consisted of:"; print "
"; print "
Career Interest: $FCCJ::textfield12" if (param($FCCJ::textfield12)); print "
Application Packet requested." if (param($FCCJ::apCB)); print "
Catalog requested." if (param($FCCJ::catCB)); # fapCB = fap2000SummerCB (Financial Aid Packet checkbox for Summer 2000 only...) print "

Financial Aid Packet, for Summer 2000 only, requested." if ($FCCJ::fapCB ne ''); print "
"; if (param($FCCJ::csRB) && $FCCJ::csRB ne '') { # csRB = csFall (Credit Schedule radiobutton) (Also available are csSpring & csSummer...) print "
Fall Credit Schedule requested." if ($FCCJ::csRB eq 'csFall'); print "
Spring Credit Schedule requested." if ($FCCJ::csRB eq 'csSpring'); print "
Summer Credit Schedule requested." if ($FCCJ::csRB eq 'csSummer'); } print "
"; if (param($FCCJ::cesRB) && $FCCJ::cesRB ne '') { # cesRB = cesFall (Continuing Education Schedule radiobutton) (" " " cesSpring & cesSummer...) print "
Fall Continuing Education Schedule requested." if ($FCCJ::cesRB eq 'cesFall'); print "
Spring Continuing Education Schedule requested." if ($FCCJ::cesRB eq 'cesSpring'); print "
Summer Continuing Education Schedule requested." if ($FCCJ::cesRB eq 'cesSummer'); } print "
"; if (param($FCCJ::fapRB) && $FCCJ::fapRB ne '') { # fapRB = fapFall (Financial Aid Packet for 2001 Fall) (" " " fapSpring & fapSummer...) print "
Financial Aid Packet for 2001 Fall requested." if ($FCCJ::fapRB eq 'fapFall'); print "
Financial Aid Packet for 2001 Spring requested." if ($FCCJ::fapRB eq 'fapSpring'); print "
Financial Aid Packet for 2001 Summer requested." if ($FCCJ::fapRB eq 'fapSummer'); } print <<_EOBB;

=== end of request ===

Note: _EOBB print "

This request will be sent to the FCCJ Information office for \n
processing.  You will get a copy for your records \n
if you entered a valid e-mail address. \n

If you need to modify your request, please hit the back button."; # Set your locahost, default host; and localdomain, default domain: my $defaulthost = "astro"; my $defaultdomain = "fccj.org"; # I'll get your host and userID (who will get these reports?) # Or Set a recipient at the end of the first command here: #chomp(my $userid = `/usr/ucb/whoami` || `/usr/bin/whoami` || 'info'); my $userid = 'info'; # Forced... chomp(my $host = `/bin/hostname` || `/bin/uname -n` || $defaulthost); chomp(my $domain = `/bin/domainname` || $defaultdomain); open (MAIL, "| $SENDMAIL $FCCJ::textfield10\@$FCCJ::textfield11, $REPLY_TO") || die ("$0: Can't open $SENDMAIL: $!\n"); # Use these mail header lines... #print MAIL "Reply-to: $REPLY_TO, $FCCJ::textfield10\@$FCCJ::textfield11\n"; # How to get both? Hmmm? print MAIL "Reply-to: $FCCJ::textfield10\@$FCCJ::textfield11\n"; print MAIL "From: \"$host.infoRequest\" \<$userid\@$host.$domain\>, \"$REPLY_TO\" \<$REPLY_TO\>\n"; print MAIL "To: $FCCJ::textfield10\@$FCCJ::textfield11, $REPLY_TO\n"; print MAIL "Subject: FCCJ Information Request; received at ", scalar localtime, "\n"; print MAIL "\n"; print MAIL "=================================================================\n"; print MAIL "NOTE: This message was sent through the infoRequest Perl System,\n"; print MAIL " infoRequest v1.05n (Alpha) by -Sneex- :] (WC Jones), JaxPM\n"; print MAIL "=================================================================\n"; print MAIL "\n\n"; print MAIL <<_1EOMA; Hello from the FCCJ (info) E-Mail infoRequest CGI :] Your request was received by the CGI on $stime. This request was assigned the following (dss) Security Number: $sltime. === Your Name and Address information:\n\n _1EOMA print MAIL "$FCCJ::select2" unless ($FCCJ::select2 eq 'NI'); print MAIL " $FCCJ::textfield\n"; print MAIL "$FCCJ::textfield2 "; print MAIL "- Apt: $FCCJ::textfield3" if ((param($FCCJ::textfield3)) || ($FCCJ::textfield3 ne '')); print MAIL "\n$FCCJ::textfield4, $FCCJ::select $FCCJ::textfield5\n\n Phone: ($FCCJ::textfield6) $FCCJ::textfield7-$FCCJ::textfield8 "; print MAIL "- Ext: $FCCJ::textfield9\n\n" if ((param($FCCJ::textfield9)) || ($FCCJ::textfield9 ne '')); print MAIL "\n\nE-Mail: $FCCJ::textfield10\@$FCCJ::textfield11\n\n === Your request consisted of:"; print MAIL "\n"; print MAIL "\nCareer Interest: $FCCJ::textfield12" if (param($FCCJ::textfield12)); print MAIL "\nApplication Packet requested." if (param($FCCJ::apCB)); print MAIL "\nCatalog requested." if (param($FCCJ::catCB)); print MAIL "\n"; # fapCB = fap2000SummerCB (Financial Aid Packet checkbox for Summer 2000 only...) print MAIL "Financial Aid Packet, for Summer 2000 only, requested." if ($FCCJ::fapCB ne ''); print MAIL "\n"; if (param($FCCJ::csRB) && $FCCJ::csRB ne '') { # csRB = csFall (Credit Schedule radiobutton) (Also available are csSpring & csSummer...) print MAIL "\nFall Credit Schedule requested." if ($FCCJ::csRB eq 'csFall'); print MAIL "\nSpring Credit Schedule requested." if ($FCCJ::csRB eq 'csSpring'); print MAIL "\nSummer Credit Schedule requested." if ($FCCJ::csRB eq 'csSummer'); } print MAIL "\n"; if (param($FCCJ::cesRB) && $FCCJ::cesRB ne '') { # cesRB = cesFall (Continuing Education Schedule radiobutton) (" " " cesSpring & cesSummer...) print MAIL "\nFall Continuing Education Schedule requested." if ($FCCJ::cesRB eq 'cesFall'); print MAIL "\nSpring Continuing Education Schedule requested." if ($FCCJ::cesRB eq 'cesSpring'); print MAIL "\nSummer Continuing Education Schedule requested." if ($FCCJ::cesRB eq 'cesSummer'); } print MAIL "\n"; if (param($FCCJ::fapRB) && $FCCJ::fapRB ne '') { # fapRB = fapFall (Financial Aid Packet for 2001 Fall) (" " " fapSpring & fapSummer...) print MAIL "\nFinancial Aid Packet for 2001 Fall requested." if ($FCCJ::fapRB eq 'fapFall'); print MAIL "\nFinancial Aid Packet for 2001 Spring requested." if ($FCCJ::fapRB eq 'fapSpring'); print MAIL "\nFinancial Aid Packet for 2001 Summer requested." if ($FCCJ::fapRB eq 'fapSummer'); } print MAIL<<_EOMB; === end of request === Notice: If any of the above information is incorrect, please reply to and correct this e-mailed copy. WARNING: You must use the 'Reply All' button to send corrections back to FCCJ! Thank you, we appreciate your time in sending your request(s)! _EOMB print MAIL "\n\nEnd of E-Mail...\n"; close (MAIL); exit; } __END__ End of program