@flds = split(/&/,$ENV{"QUERY_STRING"});
foreach $fld (@flds) {
    ($fkey, $fval) = split(/=/,$fld);
    $fval =~ tr/+/ /;
    $fval =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $fkey =~ tr/+/ /;
    $fkey =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $in{$fkey} = $fval;
}
if ($in{"url"} eq ""){
    print "Content-type: text/html\n";
    print "\n";
    print "<HTML>\n";
    print "<HEAD>\n";
    print "<TITLE>Error</TITLE>";
    print "</HEAD>\n";
    print "<BODY>\n";
    print "<H1>Error</H1>";
    print "<P>No URL supplied for redirection</P><P>";
    for $key (sort keys %in) {
        print "$key=$in{$key}<BR>\n";
    }
    print "</P></BODY>\n";
    print "</HTML>\n";
}else{
    print "Location: " . $in{"url"} . "\n\n";
}
