how to destroy session automatically after defined time?

Discussion in 'PHP' started by aleale, Dec 15, 2011.

  1. #1
    As my title said the question, i want to destroy my session after a particular time if user is being ideal..
    currently i am using this code to define my session:

    
    session_start();
    // Check, if username session is NOT set then this page will jump to login page
    if (!isset($_SESSION['myusername'])) {
    header('Location: admin.php');
    }
    
    Code (markup):

     
    aleale, Dec 15, 2011 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330