#!/usr/local/bin/perl 



$lt = localtime();



$header = "./reflectorHead.pl";
$body   = "./reflectorBody.pl";

use CGI qw/:standard/;

$CGI::POST_MAX = 1024* 1; #00;  # limits size of posts
$CGI::DISABLE_UPLOADS = 1;    # blocks uploads
      
      
$uploaded_file = param('upload');

if (cgi_error())
{
    require $header;
    require $body;
    print "<p style=\"color: rgb(175, 0, 0);\">POST size it too large!</p>\n";
    exit(0);
}
elsif (!$uploaded_file && uc($ENV{'REQUEST_METHOD'}) eq "PUT")
{
    require $header;
    require $body;
    print "<p style=\"color: rgb(175, 0, 0);\">File upload is not supported!</p>\n";
    exit(0);
}

$q = new CGI;
$rhost   = $ENV{'REMOTE_HOST'};
$radd    = $ENV{'REMOTE_ADDR'};
$ruser   = $ENV{'REMOTE_USER'};
$qString = $ENV{'QUERY_STRING'};
$cLength = $ENV{'CONTENT_LENGTH'};


require $header;
require $body;

if ($rhost ne "")
{
        print "Call from <i>" . $rhost . "</i> at ";
}

print "<p><strong>Time:</strong> $lt</p>\n";

if (($qString ne "" and length($qString) < 1000) or ($cLength ne "" and $cLength < 100000))
{
    if ($cLength > 0)
    {
        print "<br /><b>Method</b>: POST<br />Content length: $cLength<br />\n";
    }

    if ($qString > 0 )
    {
        print "<br /><b>Method</b>: GET<br />Query string: " . length($qString) . "<br />\n";
    }
    print "<br /> Your form contains the following fields/values:<br /><br />\n";

    print $q->Dump();
}
else
{
    print "<br /><b>Request too large to handle!</b><br /><br />Resubmit a smaller form for testing.\n"; 
}

print $q->end_html;                  # end the HTML