title: Number of users logged in/out with session expire?
body: <p>I'm running a php login script on my server. Whenever a user logs in the username is stored in <code>$_SESSION['username']</code> and there exists a field in one of my DB tables called <code>nonline</code> used to store the number of users logged in.</p>
  
  <p>When a user logs in, the value of <code>nonline</code> increases by one. And whenever a user logs out it decreases by one. Pretty neat so far. :P</p>
  
  <p>The problem starts when, most of the users, like me, do not click logout, or visit the logout page as such. They log in, and just close their browser/tab when done. Doing so <em>doesn't</em> decrease the nonline value. So the value remains as such, even when the user is no more browsing my website.</p>
  
  <p>Is there any way I can determine the number of users actually looking at my website at any given time so that its value changes even when a user closes his browser instead of clicking logout? I'm not using cookies for login.</p>