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

前端 未结 10 1227
轻奢々
轻奢々 2020-12-02 05:24

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 update

10条回答
  •  攒了一身酷
    2020-12-02 06:12

    It sounds like your "is the person online" comparison logic isn't taking into account the timezones. If you are dealing with timezones in this manner, I strongly recommend that you store all your times in GMT, and convert them to local time for your users right before you display them. This will make any comparison operations very simple.

    There's a nice SO thread about timezones here.

提交回复
热议问题