#!/usr/local/bin/perl # define file to be edited $filename = '/tools/www/common/db/student.html'; # Print out a content-type for HTTP/1.0 compatibility print "Content-type: text/html\n\n"; # Print a title and initial heading print "Thank you\n"; print "

Thank you

\n"; # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); $i = 0; 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; $name =~ tr/+/ /; $name =~ 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

"; $FORMVALUE{$i} = $value; $FORMNAME{$i} = $name; $i = $i + 1; } $end = $i; # open file and start writing open(STUDENT, ">> /tools/www/common/db/student.html"); # || die "Can't open $filename!\n"; printf STUDENT "\n"; printf STUDENT "\n"; printf STUDENT "\t $FORMVALUE{1} \n"; printf STUDENT "\tby $FORMVALUE{2}\n"; printf STUDENT "
\n"; close (STUDENT); # say thank you? Just to be polite print "Your link has been added to the"; print ""; print " EECS Student Home Pages!";