sub GetParams
{
my $webparams;
if ($ENV{'QUERY_STRING'} ne '')
{
$webparams = "$ENV{'QUERY_STRING'}";
}
else
{
read(STDIN, $webparams, $ENV{'CONTENT_LENGTH'});
}
return $webparams;
}
####
$hash{input_name}[0]
$hash{input_name}[1]
##
##
sub GetParamsHash
{
my $type = shift; # type = 0 or not included returns a hash
# type = 1 returns a hash of arrays
my $webparams = shift;
my $webparams2;
my %webparams3;
if(!$webparams)
{
if ($ENV{'QUERY_STRING'} ne '')
{
$webparams = "$ENV{'QUERY_STRING'}";
}
else
{
read(STDIN, $webparams, $ENV{'CONTENT_LENGTH'});
}
}
if($type == 1)
{
$webparams2 = $webparams;
$webparams2 =~ s/\&/\n/g;
$_ = $webparams2;
while(/^(.*?)=(.*)$/gm){ push @{$webparams3{$1}}, $2; }
}
else
{
$webparams2 = $webparams;
$webparams2 =~ s/\&/\n/g;
$_ = $webparams2;
%webparams3 = /^(.*?)=(.*)$/gm;
}
return %webparams3;
}
##
##
sub DecodeURL
{
my $text = shift;
$text =~ tr/\+/ /;
$text =~ s/%([a-f0-9][a-f0-9])/chr(hex($1))/eig;
return $text;
}