Is there a way to call a php script when the browser or window is closing, when someone hits the X.
I have a login, logout script
$sql2 = "UPDATE `users` SET `loggedin` = '1' WHERE `username` = '$username' AND `password` = '$password' LIMIT 1 ";
that changes an SQL variable to 1 or 0 letting me know if that person is logged on.
if that variable is 1 and someone else tries to login they wont be able to.
but my issue is if someone closes the window without logging out. The variable stays as 1, and therefore they can't log in.