Jump to content


This topic is now archived and is closed to further replies.


User Online tracking

Recommended Posts

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

Share this post

Link to post
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.

Share this post

Link to post
Share on other sites


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.