my php code makes the system go in infinite loop

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ahmedyk
Forum Newbie
Posts: 7
Joined: Mon Jan 05, 2009 2:09 am

my php code makes the system go in infinite loop

Post 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.
mattpointblank
Forum Contributor
Posts: 304
Joined: Tue Dec 23, 2008 6:29 am

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

Post 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?
Post Reply