System in idle mode

thread: 2 messages  |  last: about 7 years ago  |  started: monday, september 26, 2011, 3:24 pm pdt


#1  |  sumitkumarg (india) Bahamas
Monday, September 26, 2011, 3:24 PM PDT

Hi All,

I need any control which can give me the system Idle value. I need to build the functionality related with Session time out once any user is offline in the site.

Please suggest any idea.

Thanking you in advance.

#2  |  Mike Ho (San Diego, CA) United States of America Qcodo Administrator
Monday, September 26, 2011, 9:12 PM PDT

There's no such thing as a “system idle” value that I know of... but in terms of trying to figure out whether or not a user is “logged in”, you can simulate this by creating and keeping up-to-date a “date_last_activity” type of time stamp in the user table for the currently logged in user.

And you can basically make an assumption that the user is “no longer on your site” if date_last_activity becomes older than a certain amount of time (e.g. 5 min, 10 min, etc.)

Date Last Activity should be updated on every page / ajax hit, so that you always have the most up to date information about the user in the table.

You can optionally even add a Polling Interval to update it while the user is still on the page -- this would allow you to lower the “timeout” value to something even lower (e.g. 30 seconds or 1 min).



Copyright © 2005 - 2019, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.