login.php-->



<?php
session_start();
if(isset($_SESSION['user']))
{
echo "a logged in user";
die("<script>window.location.href = 'page.php'</script>");

}
else
{
//authenticate
$_SESSION['user']="abc";
echo $_SESSION['user'];
}






?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<body>
<br>
authenticated & login done

<br>
<a href="page.php">page</a>

</body>
</head>
</html>


page.php-->

<?php
session_start();

if(isset($_SESSION['user']))
{
echo "a logged in user";

}
else
{
echo "no access";
exit();
}





?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<body>
<br>
<a href="logout.php">logout</a>

</body>
</head>
</html>


logout.php -->

<?php
session_start();
if(isset($_SESSION['user']))
{
unset($_SESSION['user']);
session_destroy();
}
else
{
echo "no access";
exit();
}




?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<body>
logout done.. press back to check working..

</body>
</head>
</html>



On localhost ... on logout... when i click back button of browser... it shows me "no access" message...
and works perfectly...
But on hosting server... it shows previous pages even i have logged out...
plz help