title: Session Timeout in php not working fine, Like to know what is my mistake?
body: <p>I am using PHP to settle the session timeout...I found a few solutions so i picked the one i understand the most which was:</p>
  
  <pre><code>    $now = time(); // checking the time now when home page starts
  
      if($now &gt; $_SESSION['expire'])
      {
      session_destroy();
      echo "Your session has expire ! &lt;a href='login.php'&gt;Login Here&lt;/a&gt;";
      };
  </code></pre>
  
  <p>I also added this in my login processor page</p>
  
  <pre><code>$_SESSION['start'] = time(); // taking now logged in time
  $_SESSION['expire'] = $_SESSION['start'] + (30 * 60) ; // ending a session in 30 minutes from the starting time
  </code></pre>
  
  <p>from <a href="https://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes">How do I expire a PHP session after 30 minutes?</a></p>
  
  <p>The result was that the message <code>Your session has expire ! &lt;a href='login.php'&gt;Login Here&lt;/a&gt;</code> did appear but the page was still in the homepage instead of going back to the login page...I was wondering if by adding <code>header ('Location:login.php');</code> below the echo line will bring it back to the login page...</p>
  
  <p>How do i change the echo message to pop up message instead together with bring the page back to login.php?</p>
  
  <p>Thanks...I know there are answers online but I want to know where is my mistake so i can learn something here...Teaching and guidance is really appreciated </p>