philstockham
Technical User
i have added login authentication and sessions to the admin section of my site. However, this is my first experience of sessions. It seems that when i close the browser and then reopen it the pages that should be protected by the code shown below do not take me to the login screen. is there a way to get session to end when someone leaves the site?? Also is there a better way to implement login authentication with sessions than i am currently doing??
<?
session_start();
echo $_SESSION['user'];
if($_SESSION['auth'])//true or false value of 1 or 0
{
echo " logged in!";
}
else
{
header("Location:login.html");
die();
}
?>
<?
session_start();
echo $_SESSION['user'];
if($_SESSION['auth'])//true or false value of 1 or 0
{
echo " logged in!";
}
else
{
header("Location:login.html");
die();
}
?>