jeboy Posted March 13, 2008 Share Posted March 13, 2008 Hi! I would like to ask if the following script I wrote is correct? It is placed at the top of the page. When a user logs in to the system, the username will insert to table logged_users (just for simplicity). What I'm trying to do is whenever a user get disconnected like for example he closes his browser, the script will automatically delete the user from the table logged_users. function clearLoggedUser() { if (connection_status() == 2) { $strSql = "DELETE FROM logged_users WHERE Username = '".$userName."'"; mysql_query($strSql); } } register_shutdown_function("clearLoggedUser"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.