#!/usr/local/bin/perl # The first line should be where perl resides on the local system. $company = "chang\@cs.pitt.edu"; $webmaster = "chang\@cs.pitt.edu"; # You can have a list of e-mail addresses in the memberlist. $memberlist = " "; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $mon = $mon + 1; if ($ENV{'REQUEST_METHOD'} eq 'POST') { # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); # Load the FORM variables 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; } # Write the registration information into file mmm09p { open (MESSAGE, "> t1"); print MESSAGE "(CS2310, "; print MESSAGE "$FORM{firstname}, "; print MESSAGE "$FORM{lastname}, "; print MESSAGE "$FORM{email}; "; print MESSAGE "*$FORM{password}, q1=0, q2=0, e1=0, e2=0, e3=0, e4=0, e5=0, e6=0, m=0, p=0, b=0, f=0)\n"; close (MESSAGE); $ans=`cat mmm09p t1 > t2`; $ans=`cp t2 mmm09p`; } # Thank the user and acknowledge the order &thank_you; } else { # Format an error message for the user print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "Message Form Error\n"; print "\n"; print "\n"; print "

CS2310 Message Form Error

\n"; print "
\n"; print "

\n"; print "Form input was not processed. Please mail your "; print "registration to $company\n"; print "\n"; print "\n"; } sub thank_you { print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "Thank You\n"; print "\n"; print "\n"; print "

Thank You

\n"; print "
\n"; print "

\n"; print "Your CS2310 registration has been processed.\n"; print "\n"; print "\n"; }