I have made a website wherein the user creates his account. If the user logsout he is directed to the home page. But the problem is if the user clicks on the back button then he is again directed to his account. The session again starts for the user which should not be the case. I ve used header caching at top of every page but still same problem continues.
What could be the possible solution.
<?php
header("Expires: Thu, 17 May 2001 10:17:17 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
session_start();
// Unset session data
//$_SESSION=array();
// or...
session_unset();
// Clear the session cookie
unset($_COOKIE[session_name()]);
// Destroy session data
session_destroy();
header("Location: ../login_system.php");
exit;
?>
This would be the code for logout and it is stored in a file called logout.php
Should i just redirect the user to this file when he clicks the logout link.