fxuser Posted March 20, 2011 Share Posted March 20, 2011 So i have a online status available and when the user logs in i insert a new row in a table so the user is online and when the user logs out i delete it so the users goes offline.. but when the user leaves the computer and has the website open he will get logged out after some time of inactivity and the row saying that the user is online will remain there and wont be deleted.. how can i remove the row by the time the session is removed due to inactivity? I dont have any code done till now because im still trying to find out how to do it.. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/231193-online-status-and-sessions/ Share on other sites More sharing options...
fxuser Posted March 20, 2011 Author Share Posted March 20, 2011 bump , anyone who can help? Quote Link to comment https://forums.phpfreaks.com/topic/231193-online-status-and-sessions/#findComment-1190092 Share on other sites More sharing options...
timr Posted March 21, 2011 Share Posted March 21, 2011 The first thing that comes to mind is to put a timestamp in the row, and evaluate the timestamp on the login page or a header/include file. This way if a user "times out" or just closes the window without logging out, the next person who logs in will execute a script to check the users table for out dated timestamps. If the timestamp is older than x amount of time, then delete the row or mark it offline. Hope this helps. Quote Link to comment https://forums.phpfreaks.com/topic/231193-online-status-and-sessions/#findComment-1190102 Share on other sites More sharing options...
fxuser Posted March 21, 2011 Author Share Posted March 21, 2011 something like , include a file which will refresh the timestamp while he will be visiting pages in the website so we will get the users last time visit of the website. So when a user goes to the x users profile we will compare the timestamp of x's with the guest or the user i have and delete the online status row if the x's users timestamp is < than mine? thanks. Quote Link to comment https://forums.phpfreaks.com/topic/231193-online-status-and-sessions/#findComment-1190189 Share on other sites More sharing options...
fxuser Posted March 21, 2011 Author Share Posted March 21, 2011 solved. Quote Link to comment https://forums.phpfreaks.com/topic/231193-online-status-and-sessions/#findComment-1190328 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.