Avatar of Wicked-Websites
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Run Log Off html page when user closes the browser?


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 yes...how 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) {

Open in new window


Avatar of undefined
Last Comment

8/22/2022 - Mon