From: Sneex <bill>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<perldoc CGI>=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! &nbsp;";#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 .= '<BR><font color="#009999" size=+1>Erc:</font> &nbsp;Salutation missing...' #	unless ((param($FCCJ::select2)) || ($FCCJ::select2 ne 'NI'));$ercBuffer .= '<BR><font color="#009999" size=+1>Erc:</font> &nbsp;Name missing...' 	unless ((param($FCCJ::textfield)) || ($FCCJ::textfield ne ''));$ercBuffer .= '<BR><font color="#009999" size=+1>Erc:</font> &nbsp;Address missing...' 	unless ((param($FCCJ::textfield2)) || ($FCCJ::textfield2 ne ''));# apartment portion of Address is optional (field name:  textfield3)$ercBuffer .= '<BR><font color="#009999" size=+1>Erc:</font> &nbsp;City missing...' 	unless ((param($FCCJ::textfield4)) || ($FCCJ::textfield4 ne ''));$ercBuffer .= '<BR><font color="#009999" size=+1>Erc:</font> &nbsp;State missing...' 	unless ((param($FCCJ::select)) || ($FCCJ::select ne 'NI'));$ercBuffer .= '<BR><font color="#009999" size=+1>Erc:</font> &nbsp;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 .= '<BR><font color="#009999" size=+1>Erc:</font> &nbsp;E-Mail UserID missing...' 	unless ((param($FCCJ::textfield10)) || ($FCCJ::textfield10 ne ''));$ercBuffer .= '<BR><font color="#009999" size=+1>Erc:</font> &nbsp;E-Mail ISP Domain missing...' 	unless ((param($FCCJ::textfield11)) || ($FCCJ::textfield11 ne ''));# Format for testing:#$ercBuffer .= '<BR><font color="#009999" size=+1>Erc:</font> &nbsp;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;<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><TITLE>Error! Required Data Missing!</TITLE></HEAD><BODY bgcolor="#ffffff"><FONT SIZE=5><P align="left"><a href="http://www.fccj.org/"><img src="/logoforinfo.gif"                                                     align="absmiddle"                                                    name="fccjTitle"                                                     border="0"                                                     alt="FCCJ Home"                                                     width="125"                                                    height="183"></a></P><!--  Erc Message(s) between these comment bars... --><P><font color="#00CC66" size=+2 face=sans-serif>ERROR!</font><font face=sans-serif>Required fields missing:<P>$ercBuffer<P>Please hit the browser's Back button and fill these required fields in.</font><!--  Erc Message(s) between these comment bars... --></BODY></HTML>_Erc	exit;    }print <<_1SOH;<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><TITLE>Your Request Was Sent!</TITLE></HEAD><BODY bgcolor="#ffffff"><FONT SIZE=5><P align="left"><a href="http://www.fccj.org/"><img src="/logoforinfo.gif"                                                    align="absmiddle"                                                    name="fccjTitle"                                                    border="0"                                                    alt="FCCJ Home"                                                    width="125"                                                    height="183"></a></P>_1SOHprint "<P><font size=+1 face=sans-serif>Your processed request is indicated below; a copy of which will be e-mailed to you.<P><BR>";my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime;my $sltime = "$sec$min$hour$mday$mon$year$wday";my $stime  = scalar localtime;print <<_1EOBA;<P>Hello from the FCCJ (info) E-Mail infoRequest CGI :]<BR>Your request was received by the CGI on $stime.<BR>This request was assigned the following <BR>(dss) Security Number: $sltime.<P>=== Your Name and Address information:<P>_1EOBAprint "$FCCJ::select2" unless ($FCCJ::select2 eq 'NI');print " $FCCJ::textfield";print "<BR>$FCCJ::textfield2 &nbsp;";print "&nbsp; Apt: $FCCJ::textfield3" if ((param($FCCJ::textfield3)) || ($FCCJ::textfield3 ne ''));print "<BR>$FCCJ::textfield4, $FCCJ::select $FCCJ::textfield5<P>Phone: ($FCCJ::textfield6) $FCCJ::textfield7-$FCCJ::textfield8 ";print "Ext: $FCCJ::textfield9" if ((param($FCCJ::textfield9)) || ($FCCJ::textfield9 ne ''));print "<P>E-Mail: $FCCJ::textfield10\@$FCCJ::textfield11<P>=== Your request consisted of:";print "<BR>";print "<BR>Career Interest: $FCCJ::textfield12" if (param($FCCJ::textfield12));print "<BR>Application Packet requested." if (param($FCCJ::apCB));print "<BR>Catalog requested." if (param($FCCJ::catCB));# fapCB = fap2000SummerCB (Financial Aid Packet checkbox for Summer 2000 only...)print "<P>Financial Aid Packet, for Summer 2000 only, requested." if ($FCCJ::fapCB ne '');print "<BR>";if (param($FCCJ::csRB) && $FCCJ::csRB ne '') {# csRB = csFall (Credit Schedule radiobutton) (Also available are csSpring & csSummer...)print "<BR>Fall Credit Schedule requested." if ($FCCJ::csRB eq 'csFall');print "<BR>Spring Credit Schedule requested." if ($FCCJ::csRB eq 'csSpring');print "<BR>Summer Credit Schedule requested." if ($FCCJ::csRB eq 'csSummer');}print "<BR>";if (param($FCCJ::cesRB) && $FCCJ::cesRB ne '') {# cesRB = cesFall (Continuing Education Schedule radiobutton) (" " " cesSpring & cesSummer...)print "<BR>Fall Continuing Education Schedule requested." if ($FCCJ::cesRB eq 'cesFall');print "<BR>Spring Continuing Education Schedule requested." if ($FCCJ::cesRB eq 'cesSpring');print "<BR>Summer Continuing Education Schedule requested." if ($FCCJ::cesRB eq 'cesSummer');}print "<BR>";if (param($FCCJ::fapRB) && $FCCJ::fapRB ne '') {# fapRB  = fapFall (Financial Aid Packet for 2001 Fall) (" " " fapSpring & fapSummer...)print "<BR>Financial Aid Packet for 2001 Fall requested." if ($FCCJ::fapRB eq 'fapFall');print "<BR>Financial Aid Packet for 2001 Spring requested." if ($FCCJ::fapRB eq 'fapSpring');print "<BR>Financial Aid Packet for 2001 Summer requested." if ($FCCJ::fapRB eq 'fapSummer');}print <<_EOBB;<P>=== end of request ===<P>Note:_EOBBprint "<P>This request will be sent to the FCCJ Information office for	\n<BR>processing. &nbsp;You will get a copy for your records		\n<BR>if you entered a valid e-mail address.				\n<P>If you need to modify your request, please hit the back button.</font></BODY></HTML>";# 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