Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to expire a PHP session after 30 minutes?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 271
    Comment on it

    Setting the session creation time (or an expiry time) when it is registered, and then checking that on each page load could handle that.

    Example:

    $_SESSION['example'] = array('foo' => 'bar', 'registered' => time());
    
    if ((time() - $_SESSION['example']['registered']) > (60 * 30)) {
        unset($_SESSION['example']);
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: