+ 2
How to check how many users online on the website with php?
I want to check how many users online on the site but i faced a proplem: I used session so if someone closed the browser without logging out it will still appearing as online user!
1 Réponse
+ 3
A commonly used pattern is to keep track of the last activity of each session, by updating a session variable on each request.
This way you could determine the rime of the last activity, and based on some threshold that you define yourself, you could classify a user inactive, if they haven't done any activity since eg. 30 minutes.
https://www.ma-no.org/en/programming/php/how-to-implement-a-php-session-timeout-on-your-own