|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/eei/cgi-bin/ |
Upload File : |
#!/usr/bin/perl -w
# Send the MIME header
print "Content-type: text/plain\n\n";
print "formtest-2.pl.cgi\n";
print "Form test report:\n\n";
# display the relevant CGI variables
print "HTTP_USER_AGENT = $ENV{'HTTP_USER_AGENT'}\n";
print "REQUEST_METHOD = $ENV{'REQUEST_METHOD'}\n";
print "SCRIPT_NAME = $ENV{'SCRIPT_NAME'}\n";
print "QUERY_STRING = $ENV{'QUERY_STRING'}\n";
print "REMOTE_HOST = $ENV{'REMOTE_HOST'}\n";
print "REMOTE_ADDR = $ENV{'REMOTE_ADDR'}\n";
print "CONTENT_TYPE = $ENV{'CONTENT_TYPE'}\n";
print "CONTENT_LENGTH = $ENV{'CONTENT_LENGTH'}\n";
# query string is used for get
# put the QUERY_STRING into a variable
# $qs = $ENV{'QUERY_STRING'};
# print "\ninput1 =", $qs, "\n";
# put the data into a variable
$cl = $ENV{'CONTENT_LENGTH'};
read(STDIN, $qs, $cl);
print "\ninput2 =", $qs,"\n";
print "\ninput3 =", $cl, "\n";
# split it up into an array by the '&' character
@qs = split(/&/,$qs);
foreach $i (0 .. $#qs)
{
# convert the plus chars to spaces
$qs[$i] =~ s/\+/ /g;
# convert the hex characters
$qs =~ s/%(..)/pack("c",hex($1))/ge;
# split each one into name and value
($name, $value) = split(/=/,$qs[$i],2);
# create the associative element
$qs{$name} = $value;
}
print "\nVariables:\n\n";
foreach $name (sort keys(%qs))
{ print "$name=", $qs{$name}, "\n" }