#!/usr/local/bin/perl


print "Content-type: text/html\n\n";
print "\n";

&formParse;

print "<HTML>\n";
print "<HEAD>";
print "        <TITLE>Claim Errors</TITLE>";
print "</HEAD>";

print "<BODY BGCOLOR=\"#FFFFFF\">";
print "<P>Errors:<BR>";

print "$FORM{errorString}\n";
print "</BODY>";
print "</HTML>\n ";

exit;
sub formParse
{
        if ($ENV{'REQUEST_METHOD'}eq 'GET')
        {
                $buffer = $ENV{'QUERY_STRING'};
        }
        else
        {
                read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
        }

        @pairs = split(/&/, $buffer);

        foreach $pair (@pairs)
        {
                ($name, $value) = split(/=/, $pair);
                $value =~ tr/+/ /;
                $name =~ tr/+/ /;
                $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
		$value =~ s/\'/\`/g;
                $FORM{$name} = $value;
        }
}        
