title: PHP getting active sessions
body: <p>I am trying to echo each active session that has been active in the past 15 minutes, I check using the following code to log their last seen time.</p>
  
  <pre><code>$_SESSION['last_seen'] = date("Y-m-d H:i:s");
  </code></pre>
  
  <p>But I receive these errors when doing the below code, which the code above this text.</p>
  
  <blockquote>
    <p>Notice: Undefined index: last_seen in
    C:\xampp\htdocs\hk\templates\default\index.php on line 249 Warning:
    Illegal string offset 'last_seen' in
    C:\xampp\htdocs\hk\templates\default\index.php on line 249</p>
  </blockquote>
  
  <pre><code>&lt;?php
  foreach($_SESSION as $s){
      if ($s['last_seen'] &gt;= date("Y-m-d H:i:s", strtotime("-900 seconds")))
      {
          echo $s['username'];
      }
  }
  ?&gt;
  </code></pre>