lJesterl Posted April 15, 2007 Share Posted April 15, 2007 Im using a simple login script with sessions. I didnt really want to use cookies so im just using sessions. When they log in it updates the users table and under there name it sets online to 1 like this. $query=mysql_query("UPDATE lobby_users SET online='1' WHERE username='$rec[username]'"); When they physically click logout i have it setting it to 0 and all works fine. Here is the problem I am having. When they dont log out and they simply close the browser I still leaves them as logged in. I was wondering if there was a way to set that back to 0 when they close the browser. I didnt want to use cookies because it would show them as always logged in. I want them to relogin in every time they visit the site. Any suggestions on getting that back to 0 when they close browser? Link to comment https://forums.phpfreaks.com/topic/47067-show-logged-in-users/ Share on other sites More sharing options...
PC Nerd Posted April 15, 2007 Share Posted April 15, 2007 um, well what i do is that i actually log every time they log in, and if they login without having logged out the last time, it simply sets their loggin length for last time as 5 minutes, their loss. then what i do, is also store every page request ( to log activity) and store the time of that. then when looking if a user is logged in ( or even to auto logout later with a cron) is to check if a user is logged in, then check if theyve requested a page in the laft 15 minuntes, if not, then log them out with a 5 minutes session length that should work. if your actually letting oterh members to see if a person is logged in like on this forum, then you simply include that code, however you dont do the auto logout . gdlk Link to comment https://forums.phpfreaks.com/topic/47067-show-logged-in-users/#findComment-229583 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.