Jump to content

online status and sessions


fxuser

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.