-3

Please help me out to clear login session.

For example

  • If I am a user of a particular & I want to check my updates. So I used my user id & password to login to the particular page.
  • After checking my updates I logged out from the page. After logging out, I used back button in the browser to go back to previous session.
  • Automatically enters into my page without giving any login details. To prevent from entering into page without any login details the session should be cleared. So help me out to clear the session.
Nightfirecat
  • 10,836
  • 6
  • 32
  • 50
srinath516
  • 35
  • 1
  • 1
  • 8

3 Answers3

0

This is a client side problem. If you press back button in browser, the browser loads the previously stored cached page. Better way is, You should write a javascript function in login page which invokes logout.jsp whenever loaded first time or through back button.

Sridhar R
  • 19,414
  • 6
  • 36
  • 35
0

You need to set the cache control header on your pages to ensure they are not cached. Since Have a look at the following question which goes into detail about how to set the cache header correctly in different languages - How to control web page caching, across all browsers?

Community
  • 1
  • 1
juju
  • 439
  • 4
  • 16
0

To clear session in php, you can call a script logout.php containing the following :

<?php
session_start();
$_SESSION = array();
// PHPSESSID is default name, but you may have a custom.
setcookie("PHPSESSID", '', time() - 1, '/');
}

See a more complete example at

http://fr.php.net/session_destroy

Asenar
  • 5,861
  • 2
  • 31
  • 46