troubleshooting Question

Run Log Off html page when user closes the browser?

Avatar of Wicked-Websites
Wicked-WebsitesFlag for United Kingdom of Great Britain and Northern Ireland asked on
5 Comments1 Solution715 ViewsLast Modified:

I have a website, with login / logout working, there is a list of logged on users.

basically when they log on using php online is set to yes in a database, and when they log off online is set to no... however if they shut the browser without logging off correctly then online stays as can I get a script that sets online as off when they click X

I've tried the code attached, however that doesnt work and i dont know enough about cron jobs etc to know if that would work

<body onUnload='spawn("../admin/scripts/logout.php")'>
<script language="Javascript">
function spawn(page) {,"","left=5,top=5,height=300,width=150,status=no,toolbar=no,menubar=no,scrollbars=no");

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros