hey guys m tryin to make a log out page in my website but when the user clicks on the logout page the history does not get deleted. this means the user can still go back to the previous page.
Please help

anuj yaar,
if u use

if(!$_SESSION['username'])
    header('location to ur login page');

at the starting of the page.it will solve ur problem

one question r using cookies ?

As told by others,

Use Session variables at the begining of each page to allow access .
If logout is needed, Destroy sessions and redirect to the login page.
Hope this solves the problem.

agree with kavitha

use this to destroy the session

session_destroy();

this to reset the cookie
if its cookie just set to its name

setcookie('nameofcookie');

This is the coding that I have used in my logout page....

<?
$past = time() - 100; 
//this makes the time in the past to destroy the cookie 
setcookie(ID_my_site, gone, $past); 
setcookie(Key_my_site, gone, $past); 
header("Location: main_login.php"); 
?>

what happens if you just use

setcookie(ID_my_site);
setcookie(Key_my_site_);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.