#!/usr/bin/perl # # Quick and dirty Web form processing script. Emails the data # to the recipient. adapted from a file called grainne.pl #that i found in the cgi bin # #Conor Houghton houghton@maths.tcd.ie 8 Oct 2001 # #so the improvment over grainne.pl is that it parses the input to #find the Course name and returns to the corresponding page # #linked from http://www.maths.tcd.ie/~houghton/Commentform.html # $recipient = 'houghton@maths.tcd.ie'; $subject= 'Feedback Form'; # Print out a content-type for HTTP/1.0 compatibility print "Content-type:text/html\n\n"; # Get the input and turn it into something legible read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); $postinput = $buffer; $postinput =~ s/&/\n/g; $postinput =~ s/\+/ /g; $postinput =~ s/%([\da-f]{1,2})/pack(C,hex($1))/eig; #extract the course @values = split(/&/,$buffer); @course=split(/=/,$values[0]); # Now send mail to $recipient open (MAIL, "|mail -s '$subject' $recipient") || die "Can't open $mailprog!\n"; print MAIL "\n\n"; print MAIL $postinput; print MAIL "\n\n"; print MAIL "________________________________________________________________________________"; print MAIL "\n"; close (MAIL); #changes the course value to match the page addresses if ($course[1] eq 'None+Selected'){ $course[1]='' } else{ $course[1]="$course[1].html" } #this is the feedback received page, the meta command bounces to the #appropriate page after 2 seconds print < Thanks a million

Your Feedback has been sent



Last updated 25 October, 2004. EndofHTML # the end.