Jump to content

User Online tracking


ttommy

Recommended Posts

Hi,
I'm constructing a member system. I want to know if is there any way to track the user. In case the user login to the system, I can know if he/she connected. Once he/she log out or turn the browser off, the system can inform me. I tried to create a the login field in the database. This solves the login logout thing, and work quite ok. But not many users obey the flow (i.e. logout before turn off the browser). Therefore, many users just turn off his/her browser. With this I cannot track if they are really online.
Is there any better way to track the user?
Thnks for ur help
Tommy
Link to comment
Share on other sites

The only way I know of is to timestamp the session. When the user logs in, add a timestamp to the user's record in your table. 5 minutes later, update the timestamp if the session ID is the same. Run a cron job to log any users off with session ID's that are more than 5 minutes old.

If you close the browser or leave without logging out, that session ID will be reset in 5 minutes.
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.