Click here to Skip to main content
15,885,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all

i'm having some troubles with my login/logout management.

the problem is, when user clicks back button and gets back to the login page, the session va username still holds the value .

what i need, is to completly understand how can i unset the session var in all the occasions user leaves the page he signed in for??

plesae some guidness, all the php session tutorials sent to me here, are not that helpfull.

moses
Posted
Comments
Steve Echols 17-May-12 0:07am    
I think this is more of a problem with how browsers cache the pages, vs. session. When the user hits back in the browser, it just loads the page from the cache, without refreshing it.

There's are potentially multiple solutions, from using javascript to handle body onload and calling a web service to see if session is still active, or telling the browser to not cache the page.

1 solution

Hi,

Use some code like
PHP
<?php if(!isset($_SESSION['live'])){
header("location:fail.php");
}


it will help you

Thanks

Anand
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900