Skip to main content

session expire

12th October, 2022

Updated: 12th October, 2022

    function check_session() {
        session_start();
        #set timeout period in seconds
        $inactive = 5400;
        #check to see if $_SESSION['timeout'] is set
        if (isset($_SESSION['timeout'])) {
            $session_life = time() - $_SESSION['timeout'];
            if ($session_life > $inactive) {
                session_destroy();
                header('Location: '.WWW_PATH.'public/login.php');
                exit;
            }
        }
        $_SESSION['timeout'] = time();
    }

    1a4213bf-cc60-4615-af72-ba3ced4d5b01

    Created on: 12th October, 2022

    Last updated: 12th October, 2022

    Tagged With: