Hi!
I have had this problem with sessions for a while. I have tried to read as much as I have strength for but have not found a solution to the problem.
My security functionality is something like this:
The users can login to a secure section of the website. All those secure pages start with including a file looking like this:
<?
session_start();
if(!session_is_registered("yui")){
header("Location: loginpage.php");
exit;
}
?>
So far everything is working fine. A valid user get s to a menu and can click onwards to similar secure pages.
BUT, if the user goes "two clicks" away from the menu and presses the back-button once he ends upp at the login page!? How can this be! "One click" from the menu and pressing back he gets to the menu as he should, but two clicks away then everything is messed up!
The login page when the session variable is registered look like this:
...
else if(mysql_num_rows($result) == 1){
//Start session and register variables
session_start();
$yui = $row->identifier;
session_register("yui");
Header("Location: menu.php");
}
Cache issues, browser issues, coding errors etc...?!! Is it wrong to use an include file for the validation?