Page 1 of 1

my php code makes the system go in infinite loop

Posted: Mon Jan 05, 2009 2:17 am
by ahmedyk
the following code is working fine on windows server but when i run it on Linux Redhat server it goes into infinite loop:
<?
if (!session_start()) {
$chronerr->halt(22,"Session Management");
}
else {
if (!session_is_registered("loggedin") && $FileName != "login") {
header("Location: login.php");
}
else {
if (!$loggedin && $FileName != "login") {
header("Location: login.php");
}
}
}
?>

Can someone help me in pointing out the error?

Thank You.

Re: my php code makes the system go in infinite loop

Posted: Mon Jan 05, 2009 5:03 am
by mattpointblank
If the latter two outputs of your if statement send the user to the same page, why not just combine them into one 'else' step?