#!/usr/local/bin/perl -- -*-perl-*- # Define fairly-constants # This should match the mail program on your system. $mailprog = '/usr/ucb/mail'; # File to store the registrations. $store = ">>/home/wrri/www/pub_html/conf/rgrj/regis.txt"; $store1 = ">>/home/staff/TransboundaryRiversConference/registration/regis.txt"; $record = ""; # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); #print $buffer; # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Stop people from using subshells to execute commands # Not a big deal when using sendmail, but very important # when using UCB mail (aka mailx). # $value =~ s/~!/ ~!/g; # Uncomment for debugging purposes # print "Setting $name to $value
"; $FORM{$name} = $value; } # If the comments are blank, then give a "blank form" response &blank_response unless $FORM{'fname'}; &blank_response unless $FORM{'lname'}; &blank_response unless $FORM{'email'}; &blank_response unless $FORM{'address'}; &blank_response unless $FORM{'city'}; &blank_response unless $FORM{'state'}; &blank_response unless $FORM{'zip'}; &blank_response unless $FORM{'pay'}; #$record = "\" \" "; $date = `date '+ %m/%d/%y %H:%M:%S'`; chop $date; $record = "\"$date\" "; $record .= "\"$FORM{'fname'}\" "; if ( $FORM{'mi'} eq '' ) { $record .= "\" \" "; } else { $record .= "\"$FORM{'mi'}\" "; } $record .= "\"$FORM{'lname'}\" "; if ( $FORM{'bname'} eq '' ) { $record .= "\"$FORM{'fname'} $FORM{'lname'}\" "; } else {$record .= "\"$FORM{'bname'}\" "; } if ( $FORM{'affil'} eq '' ) { $record .= "\" \" "; } else {$record .= "\"$FORM{'affil'}\" "; } if ( $FORM{'dept'} eq '' ) { $record .= "\" \" "; } else {$record .= "\"$FORM{'dept'}\" "; } $record .= "\"$FORM{'address'}\" "; $record .= "\"$FORM{'city'}\" "; $record .= "\"$FORM{'state'}\" "; $record .= "\"$FORM{'zip'}\" "; $record .= "\"$FORM{'email'}\" "; $record .= "\"mailto:$FORM{'email'}\" "; if ( $FORM{'phone1'} eq '' ) { $record .= "\" \" "; } else {$record .= "\"$FORM{'phone1'}-$FORM{'phone2'}-$FORM{'phone3'}\" "; } if ( $FORM{'fax1'} eq '' ) { $record .= "\" \" "; } else {$record .= "\"$FORM{'fax1'}-$FORM{'fax2'}-$FORM{'fax3'}\" "; } if ( $FORM{'pay'} eq 'both' ) { $record .= "\"Yes\" "; } else {$record .= "\"No\" "; } if ( $FORM{'pay'} eq 'thur' ) { $record .= "\"Yes\" "; } else {$record .= "\"No\" "; } if ( $FORM{'pay'} eq 'frid' ) { $record .= "\"Yes\" "; } else {$record .= "\"No\" "; } if ( $FORM{'eat'} eq 'yes' ) { $record .= "\"Yes\" "; } else {$record .= "\"No\" "; } $record .= "\n"; open(INDEX, "$store") || die ; select(INDEX); print INDEX "$record"; close(INDEX); open(INDEX, "$store1") || die ; select(INDEX); print INDEX "$record"; close(INDEX); select(STDOUT); # print out a thank you screen in html format # Print out a content-type for HTTP/1.0 compatibility print "Content-type: text/html\n\n"; print ""; print "
"; print "You will receive a registration confirmation via email.
"; print "We look forward to seeing you.
"; print "Return to the Conference home page, if you want.
"; print ""; $recipient = $FORM{'email'}; $sender = "nmwrri@wrri.nmsu.edu"; $subject = "Transboundary Water Crisis Conference"; open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n"; select(MAIL); print MAIL "Reply-to: prisner@wrri.nmsu.edu\n"; print MAIL "Subject: Transboundary Water Crisis Conference \n\n"; print MAIL "-------------------------------------------------------------------------------------\n"; print MAIL "Dear $FORM{'fname'} $FORM{'lname'}:\n\n"; print MAIL "Your registration has been confirmed for the Transboundary Water Crisis Conference\n"; print MAIL "to be held in Corbett Center, NMSU, Las Cruces, NM on January 22 - 23, 2009.\n\n"; print MAIL "Conference materials will be available to you at the registration desk on January 22.\n\n"; print MAIL "If you have any questions or corrections, please call our office at 575-646-4337 or\n"; print MAIL "email Peggy Risner at prisner@wrri.nmsu.edu.\n\n"; print MAIL "Thank you for your advance registration. We look forward to seeing you at this\n"; print MAIL "year's conference.\n\n"; print MAIL "Please do not reply to this email. This mailbox is not monitored and\n"; print MAIL "you will not receive a response.\n"; print MAIL "\n-----------------------------------------------------------------------------------\n"; close (MAIL); # ------------------------------------------------------------ # subroutine blank_response sub blank_response { # print out an error screen in html format for any missing items. # Print out a content-type for HTTP/1.0 compatibility print "Content-type: text/html\n\n"; print ""; print "
"; print "First Name missing" unless $FORM{'fname'}; print "
"; print "Last Name missing" unless $FORM{'lname'}; print "
"; print "Email missing" unless $FORM{'email'}; print "
"; print "Address missing" unless $FORM{'address'}; print "
"; print "City missing" unless $FORM{'city'}; print "
"; print "State missing" unless $FORM{'state'}; print "
"; print "Zip missing" unless $FORM{'zip'}; print "
"; if ( $FORM{'pay'} eq '') { print "Attendance not specified
"; } print "