I have done a logout page for logout from a member section and provides a link to logout from member section.Wheneve r i clicked on logout link it redirected to index.php of member section......BU T when i am tring to go back threw back button of Browser....it send me last visted pages(means sessons not expire properly). How can i solve it... ....PLEASE HELP A GIVE ME A CORRECT SOLUTION.THE SCRIPT IS GIVEN BELOW
Code:
<?php //initialize the session if (!isset($_SESSION)) { session_start(); }
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .= "&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")) {
// to fully log out a visitor we need to clear the session variables
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);
$logoutGoTo = "index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
} ?>
Comment