Jump to content

Problem with connection_status() and register_shutdown_function()


jeboy

Recommended Posts

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");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.