Hi,
I have developed a login page and if the username and password are correct it will create session variables then redirect to the main page. if the user tries to go to main page without logging in it will not allow using sessions.
login.php:
ob_start();
session_start();
if($count == 1) {
$_SESSION["loggedin"] = true;
header('Location: http://www.xyz.org/main.php', True);
}
main.php:
session_start();
if !(isset($_SESSION['loggedin'])) {
header('Location: http://www.xyz.org/login.php', True);
} else {
echo $_SESSION['loggedin'];
}
and below is the php settings in my web hosting plan (sessions enabled)!
so I am not sure where is the error in this. the output, it is not redirected to main.php and stays in login.php but when I try to login again it will go to main.php (2nd time only)! So, I am guessing it is saving the session variable but needs some sort of uodate or refresh!
Thanks,
I have developed a login page and if the username and password are correct it will create session variables then redirect to the main page. if the user tries to go to main page without logging in it will not allow using sessions.
login.php:
ob_start();
session_start();
if($count == 1) {
$_SESSION["loggedin"] = true;
header('Location: http://www.xyz.org/main.php', True);
}
main.php:
session_start();
if !(isset($_SESSION['loggedin'])) {
header('Location: http://www.xyz.org/login.php', True);
} else {
echo $_SESSION['loggedin'];
}
and below is the php settings in my web hosting plan (sessions enabled)!

so I am not sure where is the error in this. the output, it is not redirected to main.php and stays in login.php but when I try to login again it will go to main.php (2nd time only)! So, I am guessing it is saving the session variable but needs some sort of uodate or refresh!
Thanks,