Page 1 of 1

to add session expiry time

Posted: Tue Mar 09, 2010 5:11 am
by rrn
when ever a user login, his information(name,password..etc) will be stored in sessions and also stored in users table.
the table has following fields
1.userid 2.password

i would like to add session expiry time
what i want to do is if a user login and does not do any thing for next 15 minutes i want to redirect the user to login page.

how i can do this.any of your help will be appreciated

thanks..

Re: to add session expiry time

Posted: Tue Mar 09, 2010 5:41 am
by rrn

Code: Select all

$inactive = 600;
if(isset($_SESSION['<strong class="highlight">timeout</strong>']) ) 
{
 
                $session_life = time() - $_SESSION['start'];
 
                if($session_life > $inactive)
 
        { session_destroy(); header("Location: loginpage.php"); }
 
}
 
$_SESSION['<strong class="highlight">timeout</strong>'] = time();
will this code work????

Re: to add session expiry time

Posted: Thu Mar 11, 2010 1:17 am
by rrn
somebody pls give me a solution........... :crazy:
any help will be appreciated..