title: How to make online/offline
body: <p>I have a login system.
  With my login session stores and cookies (if you "remember me") and then you login. When you're inside the login system at home.php (you can only enter if session/cookie is registered), i want the status field in "user" table, to update to online and offline when you sign out. </p>
  
  <p>I know how to do this, to update the status when you login and log out, but here's the thing: How do i do when the user leaves the site without logging out (pressing on the actual log out button) ? I mean if the status is set to Online and you leave the page, it will remain Online you may understand..logic.. so what do i do at this situation? I don't want to have a little ugly popup that log you off when you leave the page, that's so old school and bad.</p>
  
  <p>Or maybe when the session runs out then you set the status to offline? but again, how should i do that?</p>
  
  <p>Ideas and examples on solution for this would be good.</p>
  
  <p>Sites like e.g facebook, in the Chat you change status to Idle if you leave the pages, and somehow if you leave the page and there goes some time you are offline... How, I don't know.</p>