Ok, let's explain the situation more fully: Basically I have a session controlled login system for users to my site. If they manually log-out, close the browser or move away from the site the variables that are needed for them to view the 'members area' are unset, hence they are logged out. What I want to do is disable people logging into the same user account at the same time. Therefore when they log in I set a value in the database to say the user account is locked. If they manually log out then this value is again changed to unlock the account. However, if they close the browser or leave the site I can't figure out a way to change the value in the database to unlock the account. Any suggestions? > PHP is server-side, not client side. > That said, what you could do is simply make use of window.onunload or > window.onclose in javascript to bring up a second window/page.. > of course, anyone with half a brain and a popup-stopper won't get that > page :) > > --rylin > > > Jamie Saunders wrote: > >>Hi, >> >>I'm trying to figure out a way of detecting when a user closes the >>browser, or if they leave the site. If they do this I'd like to change >>a value in the database, i.e: >> >>if (browser is closed by user or they leave site) >>{ >> // run php code to update database >>} >> >>Any help much appreciated. >> >> -- Jamie Saunders Media Architect phpdev@mediacdcards.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php