I have a simple form, if the user enters a correct username and password, then the page will be redirect to a new page, but the result is the perl script print the code "Location: ' and does not redirect. The following is my script:
#!/usr/bin/perl
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
print "Content-type: text/html\n\n";
print "<HTML><HEAD>";
print "<TITLE>Confirm Login</TITLE>";
print "</HEAD>";
print "<BODY>";
if ($FORM{'Name'} eq "test" ){
if ($FORM{'Password'} eq "test" ){
print "Location: ' }
else{
print "The 'Password' is incorrect, please <a href='../medialogin.htm'> go back</a> and try again.";
}
}
else{
print "The 'Name' is incorrect, please <a href='../medialogin.htm'> go back</a> and try again.";
}
print "</BODY></HTML>"
Any suggestion would be appreciated.
#!/usr/bin/perl
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
print "Content-type: text/html\n\n";
print "<HTML><HEAD>";
print "<TITLE>Confirm Login</TITLE>";
print "</HEAD>";
print "<BODY>";
if ($FORM{'Name'} eq "test" ){
if ($FORM{'Password'} eq "test" ){
print "Location: ' }
else{
print "The 'Password' is incorrect, please <a href='../medialogin.htm'> go back</a> and try again.";
}
}
else{
print "The 'Name' is incorrect, please <a href='../medialogin.htm'> go back</a> and try again.";
}
print "</BODY></HTML>"
Any suggestion would be appreciated.