#!/usr/local/bin/perl # $Id: hyper.cgi,v 1.3 2003/04/08 20:04:01 jfrancis Exp $ # Clean up stupid percent stuff in http data. sub http_unquote { $_ = $_[0]; s/\+/ /g; s/\\(.)/$1/g; s/%(..)/sprintf ("%c", hex $1)/ge; s/\r//g; $_; } # Grab the POST data and stuff it into %passed if ($ENV{'REQUEST_METHOD'} eq 'POST') { sysread(STDIN, $ENV{'QUERY_STRING'}, $ENV{'CONTENT_LENGTH'}); } @pairs = split(/&/, $ENV{'QUERY_STRING'}); foreach (@pairs) { $_ = &http_unquote ($_); ($name, $val) = split(/=/,$_, 2); $passed{$name} = $val; } $query = $passed{'query'}; if($passed{'d'} eq "") { $passed{'d'}="0.03"; } # Don't internally buffer STDOUT since we're a CGI script. $|=1; # Spew the top part of the web page. printf("Content-type: text/html\n\n"); printf("
"); if(($passed{'L'} eq "") || ($passed{'L'} eq "")) { # Form definition... printf("