Changeset 447 for branches/htmlform/cgi-bin/CommonWeb.pm
- Timestamp:
- 07/27/10 13:15:56 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/htmlform/cgi-bin/CommonWeb.pm
r415 r447 16 16 $VERSION = 1.00; 17 17 @ISA = qw(Exporter); 18 @EXPORT_OK = qw(&p arse_post &printFooter &printHeader &printError &printAndExit &desanitize &cleanInput &desanitize);18 @EXPORT_OK = qw(&printFooter &printHeader &printError &printAndExit &desanitize &cleanInput &desanitize); 19 19 20 20 @EXPORT = (); #export nothing by default 21 %EXPORT_TAGS = ( ALL => [qw( &p arse_post &printFooter &printHeader &printError21 %EXPORT_TAGS = ( ALL => [qw( &printFooter &printHeader &printError 22 22 &printAndExit &desanitize &cleanInput )], 23 lean => [qw( &p arse_post &printFooter &printHeader &printError23 lean => [qw( &printFooter &printHeader &printError 24 24 &printAndExit &cleanInput )] 25 25 ); 26 27 sub parse_post {28 my $buffer;29 if ($ENV{'REQUEST_METHOD'} eq "GET") {30 $buffer=$ENV{'QUERY_STRING'}31 } elsif ($ENV{'REQUEST_METHOD'} eq 'POST' && $ENV{'CONTENT_TYPE'} eq "application/x-www-form-urlencoded") {32 read(STDIN, $buffer, $ENV{CONTENT_LENGTH});33 } else {34 $buffer = $ENV{'QUERY_STRING'};35 $buffer || read(STDIN, $buffer, $ENV{CONTENT_LENGTH});36 }37 my @pairs = split(/&/, $buffer);38 my %webvarLocal;39 foreach my $pair (@pairs) {40 my ($name, $value) = split(/=/, $pair);41 $name =~ tr/+/ /;42 $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;43 $value =~ tr/+/ /;44 $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;45 $value =~ s/\'/\\\'/g;46 $webvarLocal{$name} = $value;47 }48 return %webvarLocal;49 }50 26 51 27
Note:
See TracChangeset
for help on using the changeset viewer.