Newbie123456
Technical User
i have a problem with my script. its not parsing the form:
please tell me whats wrong and how to fix it. thanks.
Code:
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
use CGI qw/:standard/;
# SUBROUTINES!
$action = param('action');
if ($action eq "") {
&intro;
}
if ($action eq "send") {
&send;
}
# PARSE FORM!
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
} else {
$buffer = $ENV{'QUERY_STRING'};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$in{'$name'} = $value;
}
sub intro {
print<<THIS;
[b]NOT SHOWN[/b]
THIS
}
sub send {
[b]NOT SHOWN[/b]
}
sub MessageError {
$ErrorMessage = shift;
print<<THIS;
[b]NOT SHOWN[/b]
THIS
exit;
}
1;
please tell me whats wrong and how to fix it. thanks.