Reputation: 11
session_start();
ob_start();
unset($_SESSION);
session_destroy();
header("Location:login.php");
Even after logout from home page session didn't destroy inner pages redirection is working after logout. please help me
Upvotes: 0
Views: 553
Reputation: 1
You should use session_unset
instead of unset($_SESSION):
<?php
session_start();
session_unset();
session_destory();
header("Location:login.php");
?>
Upvotes: 0
Reputation: 4164
Make sure to only do a session_destroy right after you do session_start. Do not unset the whole variable, this also disables the registration of session variables.
session_start();
..
session_destroy();
header("Location: login.php");
Upvotes: 1