Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is process to make custom session timeout in php ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 121
    Comment on it

    Hi Reader's,
    Welcome to FindNerd, today we are going to discuss What is process to make custom session timeout in php ? If you want to make the custom php session which will destroy automatic when page is not refreshing so long time.

    you can take reference of bellow example

    <?php
    //firstly start session
    session_start();
    //if you want set 20 mins in seconds
    $destroy = 1200; 
    
    // check to see if $_SESSION['timeout'] is set
    if(isset($_SESSION['timeout']) ) {
      $session_life = time() - $_SESSION['timeout'];
    
    //here check the session time which is set by you
    if($session_life > $destroy)
    { 
     session_destroy(); header("Location: logout.php"); 
    }
    }
    S_session['timeout']=time();
    ?>
    

 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: