Whats the easiest way to determine if a user is online? (PHP/MYSQL)

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前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏