PHP session time not working
<p>I keep getting timed out between page requests. Sometimes it seems to work, others it doesn't. Can't seem to see a pattern or reason. I'm using the following code at the top of each page and setting <code>$_SESSION['start']</code> when I validate and log a user in. </p>

<pre><code>&lt;?php 
session_start();
$inactive = 86400;
if(isset($_SESSION['start']) ) {
$session_life = time() - $_SESSION['start'];
if($session_life &gt; $inactive){
    header("Location: login/logged_out.php");
}
}
$_SESSION['start'] = time();

$isLoggedIn = isset($_SESSION['first_name']) &amp;&amp; isset($_SESSION['username']);

$_SESSION['url'] = $_SERVER['REQUEST_URI'];
?&gt;
</code></pre>

<p>What am I doing wrong and how can I keep users logged in? Do I have to set a cookie? Or is it that the default session expiry time in PHPINI file is lower than the one I set and therefore timing me out. Any Idea how I can override this and keep users logged in for the time that I specify. This is beginning to drive me a little crazy. </p>

<p>I've seen also that using <code>ini_set("session.cookie_lifetime","86400");</code> might work?</p>

<p>Any help would be very welcome.</p>
