I want to destroy all the session values.I have logout button in all pages.I want to call this logout.php in two ways. 1.while clicked logout button in page. 2. set time for refresh a page after 10 minutes.
In header of my html I have the meta tag to refresh and call logout.php page.
<META HTTP-EQUIV="refresh" CONTENT="600;URL=logout.php?timeout">
logout.php
<?php
session_start();
// remove all session variables
session_unset();
$_SESSION = array();
// destroy the session
session_destroy();
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.location.href='login.php';
</SCRIPT>");
?>
My problem is session is not destroyed but redirect to login.php.I have a code to redirect to home page if no session value in caught in the page.If I login it redirect to dashboard page.
For testing I copy dashboard link and paste it.Instead redirect to login page It shows dashboard page.