In one of my project I found a serious bug with session. In IE and Firefox It works fine but in Opera and Safari ... it doesn't working. I will give the testing code which I wrote
Page 1 ( index.php )
session_start(); $_SESSION['uname']="I_am_Rajeesh"; header('Location: two.php');
Page 2 (two.php )
$nowGmDate = gmdate('r'); header("Last-Modified: ".$nowGmDate); // Right now header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Pragma: no-cache"); header("Cache-Control: no-cache"); session_start(); echo $_SESSION['uname']; echo "<br/><a href='three.php'>CLICK</a>";
Page 3 ( three.php )
session_start(); unset($_SESSION['uname']); echo "No Session";
Now it will register a session value in index.php and redirect to two.php. In that page we can see the session value. When we click it goes to three.php and in that page session will destroy.
When we press "Back" button in Browser ( IE and Firefox ) page two.php will come and that will not display session value ( it was deleted already )
But in Safari and Opera when we click "Back Button" then page two.php will come again and it will show the session value ( even if we deleted already ) .
Please help me how to avoid this issue
Thanks in advance