title: How can I execute PHP code on page close?
body: <p>I am trying to find a method to execute some PHP code once a user closes the page. In my application, once the user closes or navigates away from the page the server will state the user as 'Offline' in the database. This requires the code to know when the user has navigated away from the page. My application also has an endless load (i.e. it will sleep until the user closes the page).</p>