User Status Updates

Help, please make user updates, that is, if he does not have any activity, it means to throw it out.


Answer 1, Authority 100%

In general, if you need to manipulate users – it is better to make your sessions in the database + this will solve the clustering problem.

In the conselli table there will be a last_action_time that you will update on each requester.

Well, “throw out” users will be:

"update session set state='closed' where last_action_time < ".(time() - 60*5);

Answer 2

Set the string ‘last_visit` in a table with users and record the last visit to it! Make a calculation for the desired time and delete inactive by making in the line ‘user_active’ value 0.