title: Sessions and LDAP
body: <p>I have a webpage. The authentication to the webpage is handled by a ldap server I have set up. Now I wan`t to implement sessions, so that when a user is inactive for a period of time (in the case below, 10 seconds), the session will end and the user will unbind from the ldap server. I found this excerpt of code:</p>
  
  <pre><code>&lt;?php
      session_cache_expire(20);
  
      session_start(); 
      $inactive = 10;
      if(isset($_SESSION['start'])) {
          $session_life = time() - $_SESSION['start'];
          if($session_life &gt; $inactive){
              header("Location: endSession.php"); 
  
          }
      }
      $_SESSION['start'] = time();
  ?&gt;
  </code></pre>
  
  <p>It is not working. If I refresh the page it redirects me to my 'endSession.php' page, even if I`m active.</p>