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
    • 126
    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

    1. <?php
    2. //firstly start session
    3. session_start();
    4. //if you want set 20 mins in seconds
    5. $destroy = 1200;
    6.  
    7. // check to see if $_SESSION['timeout'] is set
    8. if(isset($_SESSION['timeout']) ) {
    9. $session_life = time() - $_SESSION['timeout'];
    10.  
    11. //here check the session time which is set by you
    12. if($session_life > $destroy)
    13. {
    14. session_destroy(); header("Location: logout.php");
    15. }
    16. }
    17. S_session['timeout']=time();
    18. ?>

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: