Thanks for any help I recieve
Timer??
Moderator: General Moderators
Timer??
Hi I am working on a chat application and am a bit stuck...In the database I have a field status which is set 1 for online and 0 for offline (PHP/MySQL)(at time of logging in/out), this shows the users status on a webpage. What I need is to know if there is a way I can set a timer so that if the user has been inactive for X amount of time, the database is auto updated and user is offline (1 set to 0).
Thanks for any help I recieve
Thanks for any help I recieve
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Timer??
Perhaps instead of 0|1 for your status, you should save the timestamp of the last user update. Then you could just check the time of the last update.
Otherwise you would need to do a timer in the client, or have a cron run on the server that cleared the status flags (you would still need a time though)
Otherwise you would need to do a timer in the client, or have a cron run on the server that cleared the status flags (you would still need a time though)
(#10850)