After session destroy, how to restrict 'Back' buttons

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
senthil
Forum Newbie
Posts: 12
Joined: Wed Jan 15, 2003 6:42 pm

After session destroy, how to restrict 'Back' buttons

Post by senthil »

Hi,

I implemented login/logout area using sessions. Its working fine. When the user logs out, I destroy the session. So, if he clicks on any link, it will ask him to login again. But I'm still able to browse through the site using back and forward button in the browser. Can anyone tell me how to avoid this?

Thanks
Senthil
evilcoder
Forum Contributor
Posts: 345
Joined: Tue Dec 17, 2002 5:37 am
Location: Sydney, Australia

Post by evilcoder »

in your logout.php page:

<?php

session_destroy();

echo "<meta http-equiv =\"Refresh\" content = \"0; URL=index.php\">";

?>

That way, they don't stay on the logout page, and the session is completely destroyed.
Post Reply