title: PHP Online/Offline Script
body: <p>I'm trying to code a script where a person logs in, and his last login time stamp is updated to the table. If he has logged in for more than 1 hour, immediately log him out even if he was interacting. I wonder how would I do that? I am using time() function to store the login time like this:</p>
  
  <pre><code>$lastlogin = time();
  </code></pre>
  
  <p>This has been marked duplicate: <a href="https://stackoverflow.com/questions/20516969/automatic-logout-after-15-minutes-of-inactive-in-php">Automatic Logout after 15 minutes of inactive in php</a></p>
  
  <p>But no, this is different. I want that to happen automatically without the user having to refresh the page. The answer on that question will only execute if the user interacts to the site, but I want the user to get logged out even if the user is away and not interacting.</p>