cordoprod Posted May 15, 2008 Share Posted May 15, 2008 Hello. I develope a community system, and on the top of the page it says X users online. I store the online users in a DB where the cols are nick and time. But, if the users just close the browser the users are still in the DB as online, is it possible to do something with that? I use sessions, btw.. Link to comment https://forums.phpfreaks.com/topic/105765-solved-logout-problems/ Share on other sites More sharing options...
DarkWater Posted May 15, 2008 Share Posted May 15, 2008 Save a column named like, "last_activity" and update it on every page, then on the Online list, check for everyone with activity in the last 5 minutes. Link to comment https://forums.phpfreaks.com/topic/105765-solved-logout-problems/#findComment-541941 Share on other sites More sharing options...
cordoprod Posted May 15, 2008 Author Share Posted May 15, 2008 But then they will automatically be logged out after 5 min inactivity? If there is no other options, i'll use that, but if there are please let me know.. Link to comment https://forums.phpfreaks.com/topic/105765-solved-logout-problems/#findComment-541943 Share on other sites More sharing options...
DarkWater Posted May 15, 2008 Share Posted May 15, 2008 No, they'll just be displayed as logged out on the Online list, but they'll still have the session cookie... Link to comment https://forums.phpfreaks.com/topic/105765-solved-logout-problems/#findComment-541944 Share on other sites More sharing options...
runnerjp Posted May 15, 2008 Share Posted May 15, 2008 Put an INTEGER UNSIGNED column in the table and every time a user loads a page from your site... set the column to the current UNIX timestamp from the time() function. If you want to consider people who have been logged out for 10 minutes as offline, you could $result = $db -> query('SELECT * FROM mytable WHERE last_hit > ' . (time() - 600)); to see who's still "signed in" for instance. Link to comment https://forums.phpfreaks.com/topic/105765-solved-logout-problems/#findComment-541947 Share on other sites More sharing options...
cordoprod Posted May 15, 2008 Author Share Posted May 15, 2008 Thanks Link to comment https://forums.phpfreaks.com/topic/105765-solved-logout-problems/#findComment-541949 Share on other sites More sharing options...
runnerjp Posted May 15, 2008 Share Posted May 15, 2008 wahoo lol this is probs 1 of few things i ave learnt with php lol feels good to give back Link to comment https://forums.phpfreaks.com/topic/105765-solved-logout-problems/#findComment-541951 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.