<?
// logout.php - destroys session and returns to login form
// destroy all session variables
session_name();
session_start();
// Unset all of the session variables.
$_SESSION = array();
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}
session_name();
session_regenerate_id();
session_destroy();
// redirect browser back to login page
header("Location: index.php");
?>
imran shafiq wrote:
>
>
> Dear Experts
>
> I am using session_start( ) and check $_SESSION['UName']for my every
> php file to check user login and in my logout.php I define
> session_start( );
> session_destroy();
> and check $_SESSION['UName'] is empty?
> but when I call logout.php session not destroy and
> $_SESSION['UName']not empty.
> so, how to solve this problem?
> <|_|_| | Hafiz
> Imran Shafiq Khan
>
> [Non-text portions of this message have been removed]
>
>
[Non-text portions of this message have been removed]