Consider two situations:
(1) The user closes the browser or is redirected to other web pages
Explanation: null.php is used to set the user status to offline
(2) The user no longer browses this website for a long time
Idea: Create a table active_stat with attributes including userid, lasttime, and nowtime. Every time the user opens this website, change lasttime to the current time now(), change nowtime to the current time every 1 minute, and determine whether nowtime-lasttime is greater than 20 minutes. If it is greater, modify the user status to offline