Is there a way I can piggy back sessions to know if the user is online?
I.e: use logs on, I set a $_SESSION variable, user times out- cookie Garbage collector updates the database to update their status as offline.
`EDIT:` I want a solution that does not involve times or dates. I want something to ride on sessions or something similar. Guessing if someone is online is not good enough for what I need. Tracking based upon "last_activity_time" or tracking based upon an expired session isn't going to really matter with regards to accurately telling you how many users are "online." The major difference is you can implement the first method in about 5 minutes. The latter method would require you to constantly be checking all sessions (for all users...ouch) and processing their values - yuck.
以上就是Whats the easiest way to determine if a user is online? (PHP/MYSQL)的详细内容，更多请关注web前端其它相关文章！