Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ....
- $_SESSION['dgUserLoggedIn'] = true;
- $_SESSION['timeout'] = time();
- ....
- function isLoginSessionExpired() {
- $login_session_duration = 10800;
- $current_time = time();
- if(isset($_SESSION['timeout']) and isset($_SESSION['dgUserLoggedIn'])){
- if(((time() - $_SESSION['timeout']) > $login_session_duration)){
- session_regenerate_id(true); // change session ID for the current session and invalidate old session ID
- $_SESSION['timeout'] = time(); // update creation time
- return true;
- }
- }
- return false;
- }
- if(isset($_SESSION["dgUserLoggedIn"])) {
- if(isLoginSessionExpired()) {
- header("Location: /core/logout.php");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement