Web Hosting Talk







View Full Version : Internal Server Error


NickMahon
09-22-2002, 03:27 PM
Hello,

Having more troubles :o

Why does this login script return an internal server error on submit?

Code:


<?

require("../includes/common.php");

if(session_is_registered("username")){
header("Location: loggedin.php");
}

if(!$Submit){
dosimpleheader();
?>
<form method="post" action="login.php?Submit=Go" name="login">
<b>Please enter your administrator login and password.</b><br />
Username:
<input type="text" name="username" />
<br />
Password:
<input type="password" name="password" />
<br />
<input type="submit" name="Submit" value="Go" />
</form>
<?
dosimplefooter();
}
if($Submit=="Go"){
$result = mysql_query("SELECT * FROM pp_admin WHERE password = '$password' && username = '$username'");
$num_rows = mysql_num_rows($result);
if($num_rows!=1){
dosimpleheader();
echo("Incorrect username or password. <a href=\"login.php\">Try again</a>.");
dosimplefooter();
} elseif($num_rows==1){
session_register("username");
session_register("password");
header("Location: loggedin.php");
}
}

// EoF =======================
?>

NickMahon
09-22-2002, 03:43 PM
The error I get in apache is "Premature end of script headers"

YUPAPA
09-22-2002, 04:16 PM
something wrong with your apache...

for php, when you get an error, it should show something like this for the output

Error line 3: blah blah error


for perl, you will get internal server error.

priyadi
09-22-2002, 05:19 PM
Probably your PHP is installed as CGI mode. Make sure your PHP script is chmoded +x.

Try executing your PHP script from shell. If that work, try looking in your suexec log if you are using it.

NickMahon
09-22-2002, 05:20 PM
Yeah, I'm just working on it online now, so it's working.

The sessions threw off PHP on Apache or something.

Odd.