parse_form.cgi to HTML.

index -|- end

Generated: Tue Feb 2 17:54:52 2010 from parse_form.cgi 2007/06/08 670.

#!/usr/bin/perl
# scraped from the web
read(STDIN, $buffer,$ENV{'CONTENT_LENGTH'});
$buffer =~ tr/+/ /;
$buffer =~ s/\r/ /g;
$buffer =~ s/\n/ /g;
$buffer =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
$buffer =~ s/<!--(.|\n)*-->/ /g;
$buffer =~ tr/\\|[|]|<|!|"|$|{|}|*|#|'|>|||;|%/ /; 
@pairs = split(/&/,$buffer);
foreach $pair(@pairs){
($key,$value)=split(/=/,$pair);
$formdata{$key}.="$value";
}
$first=$formdata{'first'};
$last=$formdata{'last'}; 
print "Content-type:text/html\n\n";
print <<End_of_Doc;
<html>
<head><title>Sample Response Page</title></head>
<body>
<p>Thank you: $first $last</p>
</body>
</html>
End_of_Doc

index -|- top

checked by tidy  Valid HTML 4.01 Transitional