#!/usr/local/bin/perl ######################################################################### # This file is "feedback.pl": # # Perl script to mail HTML forms interface info supplied by a student # # to an instructor. # # # # Created: 19 Aug 1996 Randall J. Scalise # # Last Modified: 7 Mar 1999 Randall J. Scalise # ######################################################################### # Define Variables $adminAdd = 'scalise@mail.physics.smu.edu'; $recipient = 'scalise@mail.physics.smu.edu'; $mailProg = '/usr/sbin/sendmail'; # Get the input read(STDIN, $cgiBuffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $cgiBuffer); foreach $pair (@pairs){ ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $formData{$name} = $value; } # Print return MIME header print "Content-type: text/html\n\n"; # Send the mail message open (MAIL, "| $mailProg -t") || die "Can't open $mailProg!\n"; print MAIL "To: $recipient\n"; print MAIL "Subject: Feedback: E&M Lab - Fall 2001\n\n"; # print MAIL "Expected Grade: $formData{'Grade'}\n\n"; # print MAIL "Hours per Week: $formData{'Hours'}\n\n"; # print MAIL "Instructor: $formData{'Instructor'}\n\n"; # print MAIL "Experiments: $formData{'Experiments'}\n\n"; # print MAIL "Manual: $formData{'Manual'}\n\n"; # print MAIL "Prelabs: $formData{'Prelabs'}\n\n"; # print MAIL "Exams: $formData{'Exams'}\n\n"; # print MAIL "Web page: $formData{'Web'}\n\n"; # print MAIL "Overall Evaluation: $formData{'Overall'}\n\n"; # print MAIL "Comments: $formData{'Comments'}\n\n"; # close (MAIL); # Successful HTML response print "
The feedback information that you supplied has been\n"; print "sent to: $recipient \n\n
Thank you.\n\n"; print "
If you notice any strange behavior, please contact\n"; print "Randall J. Scalise at \n"; print "scalise\@mail.physics.smu.edu.\n"; print "
The information sent to this mailing program is inconsistent.\n"; print "Most of you who see this message should know what it means ...\n"; print "
... and shame on you.\n"; print "
If, however, this message happens to arise from an innocent \n"; print "attempt to use the mailer, please send email describing what you \n"; print "did to cause the error to the administrator at \n"; print "$adminAdd.\n\n\n"; exit; }