Everytime I run this script, I get a "Premature end of header script". Permissions are at 755 so that's not it. Any ideas?
Thanks
-Mike
Code:
#!/usr/bin/perl
#Look! Look! This is the password!!!! Shhhhhh! Don't tell anyone!
$user_michael = "***";
$password_michael = "***";
#$user_travis = "***";
#$password_travis = "***";
#$user_julie = "***";
#$password_julie= "***";
# The following code deals with the form data
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
# Load the FORM variables
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
}
# Does the password equal what the user wrote?
if(($user_michael eq $FORM{usr})&&($password_michael eq $FORM{pw}))
{
$file = "admin.htm";
open(FILE, $file);
while(<FILE>)
{
print $_;
}
close(FILE);
}
elsif((($user_travis eq $FORM{usr})&&($password_travis eq $FORM{pw}))||(($user_julie eq $FORM{usr})&&($password_julie eq $FORM{pw})))
{
$file = "reviewers.htm";
open(FILE, $file);
while(<FILE>)
{
print $_;
}
close(FILE);
}
#Otherwise, print out this page
else
{
print "Content-type: text/html\n\n";
print "<HTML>";
print "<TITLE>Wrong!</TITLE>";
print "<BODY BGCOLOR=#FFFFCC>";
print "<CENTER><FONT COLOR=red Size = +4> Incorrect Password</FONT></CENTER><P>";
print "</BODY>";
print "</HTML>";
}
Thanks
-Mike