shadiadiph Posted March 2, 2009 Share Posted March 2, 2009 on my site the user can login and the session is registered on the checkuser page and diverts to the index page. code in checkuser session_register("username"); session_register("password"); $updatesql ="update tblclientdetails set dtlogged = now() where username='$username'"; $DB_site->query($updatesql); header("location:index.php"); index.php if(!session_is_registered("username")){ header("location:login.php"); } problem I have is if the user just goes from the index page to say yahoo.com and then back to the index page they are still logged in the session is still active it is only not active if they open a new browser window and try or click logout. How do I make it so when they navifgate away from my site the session gets destroyed?? Quote Link to comment https://forums.phpfreaks.com/topic/147508-session_destroy-help/ Share on other sites More sharing options...
RussellReal Posted March 2, 2009 Share Posted March 2, 2009 make the session expire after like 30 minutes Quote Link to comment https://forums.phpfreaks.com/topic/147508-session_destroy-help/#findComment-774334 Share on other sites More sharing options...
shadiadiph Posted March 2, 2009 Author Share Posted March 2, 2009 mm sorry just started learning about sessions how do i do that Quote Link to comment https://forums.phpfreaks.com/topic/147508-session_destroy-help/#findComment-774351 Share on other sites More sharing options...
xerodefect Posted March 2, 2009 Share Posted March 2, 2009 mm sorry just started learning about sessions how do i do that Try this http://us2.php.net/manual/en/function.session-cache-expire.php Quote Link to comment https://forums.phpfreaks.com/topic/147508-session_destroy-help/#findComment-774360 Share on other sites More sharing options...
shadiadiph Posted March 2, 2009 Author Share Posted March 2, 2009 just testing it now Quote Link to comment https://forums.phpfreaks.com/topic/147508-session_destroy-help/#findComment-774366 Share on other sites More sharing options...
shadiadiph Posted March 2, 2009 Author Share Posted March 2, 2009 mm doesn't work set it to 2 minutes went back to the page and i was still logged in. Quote Link to comment https://forums.phpfreaks.com/topic/147508-session_destroy-help/#findComment-774377 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.