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

前端 未结 10 1241
轻奢々
轻奢々 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:14

    Store the time-zone in the table, and use it in a calculation to find that users local time in comparison to the local time of the user viewing the page.

    Edit:

    Better yet, store all times as the server time, and base all calculations relative only to the server time.

提交回复
热议问题