PHP Logout code, Kill the session or empty the session value

During the user logout time we must destroy the session, for stop any invalid user access:


sample code:

<?php
header("location:login.php");
session_start();
unset($_SESSION['admin']);
session_unset();    
session_destroy(); 
$_SESSION['admin']="out";
?> 

0 comments: