#! /usr/bin/perl -w # enrollform.pl # # creates a new license request. sends e-mail to administrator. # # copyleft Phil Hurvitz # 2001.06.29 # Not supported. Use at your own risk and pleasure. # -------------------------------------------------------------------- # Set some local variables # Name of the server $site_host = "gis.washington.edu"; # parent directory in web space # this directory MUST exist, or the system will fail. $web_dir = "/ESRI/uc"; # you also need to have a directory # $web_dir/users owned by the account running httpd. # full directory pathname to the apache docs dir $htdocs = "/var/www/html"; # cgi directory (relative to web root) $site_cgi = "/cgi-bin/uc"; # Site Manager $site_manager = "Phil Hurvitz"; $site_email = "phurvitz\@u.washington.edu"; # set the right contact for e-mail for local use %admins = ( 'ctc.edu' => "slloyd\@ghc.ctc.edu", 'cwu.edu' => "nancyh\@cwu.ed", 'evergreen.edu' => "rip\@evergreen.edu", 'ewu.edu' => "swarren\@ewu.edu", 'washington.edu' => "phurvitz\@u.washington.edu", 'wsu.edu' => "gill\@wsu.edu", 'wwu.edu' => "rob\@cc.wwu.edu" ); # set the right contact for e-mail for statewide use %campuses = ( 'ctc.edu' => "CTC", 'cwu.edu' => "CWU", 'evergreen.edu' => "ESC", 'ewu.edu' => "EWU", 'washington.edu' => "UW", 'wsu.edu' => "WSU", 'wwu.edu' => "WWU" ); # sendmail $sendmail = "/usr/sbin/sendmail"; # myesri ID $esriID = "146620SITE2"; #======================================= # STOP EDITING HERE (but see below for more edits to make) #======================================= # Directory where the metadata profiles are stored $site_pfiled = "$htdocs/ESRI/uc/users"; # Today's date $today = `date +%Y%m%d`; # check that method POST is used if ($ENV{'REQUEST_METHOD'} ne 'POST' && $ENV{'REQUEST_METHOD'} ne 'post') { &html_header; print "

$ENV{'REQUEST_METHOD'}\n"; print "

\n"; print "We were unable to process the form sent by your browser.\n"; print "Please send your feedback by regular email to $site_email .\n"; &html_trailer; exit; } # method POST specifies form will come from stdin read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # split the name-value pairs on '&' @pairs = split(/&/, $buffer); # Go through the pairs and determine the name # and value for each form variable foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } # Now all the form variables are in the %FORM associative array $paper = $FORM{'paper'}; $fname = $FORM{'fname'}; $lname = $FORM{'lname'}; $title = $FORM{'title'}; $institution = $FORM{'institution'}; $mail1 = $FORM{'mail1'}; $mail2 = $FORM{'mail2'}; $city = $FORM{'city'}; $state = $FORM{'state'}; $postal_code = $FORM{'postal_code'}; $phone = $FORM{'phone'}; $fax = $FORM{'fax'}; $email = $FORM{'email'}; $position = $FORM{'position'}; $unit = $FORM{'acad_unit'}; $email_reference = $FORM{'email_reference'}; $educ = $FORM{'educ'}; $reason = $FORM{'reason'}; $emergency_contact = $FORM{'emergency_contact'}; $emergency_relationship = $FORM{'emergency_relationship'}; $emergency_phone = $FORM{'emergency_phone'}; # check each widget @widgets = ($fname, $lname, $title, $institution, $mail1, $mail2, $city, $state, $postal_code, $phone, $fax, $email, $position, $unit, $educ, $reason, $emergency_contact, $email_reference, $emergency_relationship, $emergency_phone, $paper); foreach $widget (@widgets) { if ( ! $widget ) { &html_header; &html_warning; print "

\n"; print "Please back up in your browser, correct, then resubmit.
\n"; print "FName $fname
\n"; print "LName $lname
\n"; print "Title $title
\n"; print "Inst $institution
\n"; print "Mail1 $mail1
\n"; print "Mail2 $mail2
\n"; print "City $city
\n"; print "State $state
\n"; print "Zip $postal_code
\n"; print "Phone $phone
\n"; print "Fax $fax
\n"; print "Email $email
\n"; print "Position $position
\n"; print "Unit $unit
\n"; print "EdUC $educ
\n"; print "Reason $reason
\n"; print "Email_reference $email_reference
\n"; print "EContact $emergency_contact
\n"; print "ERelationship $emergency_relationship
\n"; print "EPhone $emergency_phone
\n"; print "Paper $paper
\n"; &html_trailer; exit; } } #======================================= # START EDITING HERE #======================================= # get the correct local admin e-mail address while ( ($domain, $email_campus_admin) = each %admins) { if ( $domain eq "ctc.edu" ) { $local_mail = $email_campus_admin; } elsif ( $domain eq "cwu.edu" ) { $local_mail = $email_campus_admin; } elsif ( $domain eq "evergreen.edu" ) { $local_mail = $email_campus_admin; } elsif ( $domain eq "ewu.edu" ) { $local_mail = $email_campus_admin; } elsif ( $domain eq "washington.edu" ) { $local_mail = $email_campus_admin; } elsif ( $domain eq "wsu.edu" ) { $local_mail = $email_campus_admin; } elsif ( $domain eq "wwu.edu" ) { $local_mail = $email_campus_admin; } } # get the correct campus while ( ($domain, $initials) = each %campuses) { if ( $domain eq "ctc.edu" ) { $campus_initials = $initials; } elsif ( $domain eq "cwu.edu" ) { $campus_initials = $initials; } elsif ( $domain eq "evergreen.edu" ) { $campus_initials = $initials; } elsif ( $domain eq "ewu.edu" ) { $campus_initials = $initials; } elsif ( $domain eq "washington.edu" ) { $campus_initials = $initials; } elsif ( $domain eq "wsu.edu" ) { $campus_initials = $initials; } elsif ( $domain eq "wwu.edu" ) { $campus_initials = $initials; } } #======================================= # STOP EDITING HERE #======================================= &write_file; &html_header; &post_message; &html_trailer; exit; #=================================================== sub write_file { # write out the text open (MFILE, ">$site_pfiled/$institution.$lname.$fname.html"); print MFILE "Date: $today \n"; print MFILE "
\n"; print MFILE "

\n"; print MFILE " Paper:
\n"; print MFILE " First Name:
\n"; print MFILE " Last Name:
\n"; print MFILE " Title:
\n"; print MFILE " Institution:
\n"; print MFILE " Mailing Address 1
\n"; print MFILE " Mailing Address 2
\n"; print MFILE " City
\n"; print MFILE " State
\n"; print MFILE " Postal code
\n"; print MFILE " Phone
\n"; print MFILE " FAX
\n"; print MFILE " E-mail
\n"; print MFILE " Postion
\n"; print MFILE " Unit
\n"; print MFILE " Email reference
\n"; print MFILE " EdUC
\n"; print MFILE " Reason
\n"; print MFILE " Emergency Contact
\n"; print MFILE " Emergency Relationship
\n"; print MFILE " Emergency Phone
\n"; print MFILE "

\n"; close (MFILE); } exit; # ==================================================================== # This subroutine starts an html document. # ==================================================================== sub html_header { print < ESRI Conference Registration Request <\head> end_header } # ==================================================================== # This subroutine finishes off the html stream # ==================================================================== sub html_trailer { print < Please report any problems with this system to $site_manager. end_trailer } # ==================================================================== # This subroutine responds to a posted entry # ==================================================================== # Thank the user and acknowledge the feedback sub post_message { #----------------- # send email to the State license administrator open(MESSAGE, "| $sendmail -t"); # Create mail headers print MESSAGE "From: ESRI UC Request <$email>\n"; print MESSAGE "To: WIPHE ESRI License Administrator <$site_email>\n"; print MESSAGE "Subject: UC Request: $institution ($lname, $fname)\n"; # Write the message body print MESSAGE "ESRI UC Request\n"; print MESSAGE "Date: $today"; print MESSAGE "First Name: $fname\n"; print MESSAGE "Last Name: $lname\n"; print MESSAGE "Paper: $paper\n"; print MESSAGE "Title: $title\n"; print MESSAGE "Institution: $institution\n"; print MESSAGE "Mailing Address 1: $mail1\n"; print MESSAGE "Mailing Address 2: $mail2\n"; print MESSAGE "City: $city\n"; print MESSAGE "State: $state\n"; print MESSAGE "Postal code: $postal_code\n"; print MESSAGE "Phone: $phone\n"; print MESSAGE "FAX: $fax\n"; print MESSAGE "E-mail: $email\n"; print MESSAGE "Postion: $position\n"; print MESSAGE "Unit: $unit\n"; print MESSAGE "Email reference: $email_reference\n"; print MESSAGE "EdUC: $educ\n"; print MESSAGE "Reason: $reason\n"; print MESSAGE "Emergency Contact: $emergency_contact\n"; print MESSAGE "Emergency Relationship: $emergency_relationship\n"; print MESSAGE "Emergency Phone: $emergency_phone\n"; close(MESSAGE); #----------------- #----------------- # also send mail to the campus contact open(MESSAGE, "| $sendmail -t"); print MESSAGE "From: ESRI User Conference Seat Request \n"; print MESSAGE "To: $initials ESRI Administrator <$site_email>\n"; print MESSAGE "Subject: UC Request: $institution ($lname, $fname)\n"; # Write the message body print MESSAGE "ESRI UC Request\n"; print MESSAGE "Date: $today"; print MESSAGE "First Name: $fname\n"; print MESSAGE "Last Name: $lname\n"; print MESSAGE "Paper: $paper\n"; print MESSAGE "Title: $title\n"; print MESSAGE "Institution: $institution\n"; print MESSAGE "Mailing Address 1: $mail1\n"; print MESSAGE "Mailing Address 2: $mail2\n"; print MESSAGE "City: $city\n"; print MESSAGE "State: $state\n"; print MESSAGE "Postal code: $postal_code\n"; print MESSAGE "Phone: $phone\n"; print MESSAGE "FAX: $fax\n"; print MESSAGE "E-mail: $email\n"; print MESSAGE "Postion: $position\n"; print MESSAGE "Unit: $unit\n"; print MESSAGE "Email reference: $email_reference\n"; print MESSAGE "EdUC: $educ\n"; print MESSAGE "Reason: $reason\n"; close(MESSAGE); close(MESSAGE); #----------------- #----------------- # also send mail to the requester open(MESSAGE, "| $sendmail -t"); print MESSAGE "From: ESRI User Conference Seat Request \n"; print MESSAGE "To: \"$lname, $fname\" <$email>\n"; print MESSAGE "Subject: ESRI UC Request\n"; # Write the message body print MESSAGE "Your request for a seat at the UC has been entered.\n"; print MESSAGE "You will be notified when selections have been made.\n\n"; print MESSAGE "ESRI UC Request\n"; print MESSAGE "Date: $today"; print MESSAGE "First Name: $fname\n"; print MESSAGE "Last Name: $lname\n"; print MESSAGE "Paper: $paper\n"; print MESSAGE "Title: $title\n"; print MESSAGE "Institution: $institution\n"; print MESSAGE "Mailing Address 1: $mail1\n"; print MESSAGE "Mailing Address 2: $mail2\n"; print MESSAGE "City: $city\n"; print MESSAGE "State: $state\n"; print MESSAGE "Postal code: $postal_code\n"; print MESSAGE "Phone: $phone\n"; print MESSAGE "FAX: $fax\n"; print MESSAGE "E-mail: $email\n"; print MESSAGE "Postion: $position\n"; print MESSAGE "Unit: $unit\n"; print MESSAGE "Email reference: $email_reference\n"; print MESSAGE "EdUC: $educ\n"; print MESSAGE "Reason: $reason\n\n"; print MESSAGE "When selections have been made, you will be contacted for a\n"; print MESSAGE "final confirmation that you intend to attend. If you fail\n"; print MESSAGE "to respond to this confirmation, your seat will be given\n"; print MESSAGE "to someone else.\n"; close(MESSAGE); print <UC Request Acknowledgement Your request for a UC seat has been accepted.

You will be notified when selections have been made. end_ack } # ==================================================================== # This subroutine posts warning banner # ==================================================================== sub html_warning { print "\n"; print "\n"; print "ESRI UC Request Verification\n"; print "\n\n"; print "\n"; print "

ESRI UC Entry Warning


\n"; }