Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. ....
  2. $_SESSION['dgUserLoggedIn'] = true;
  3. $_SESSION['timeout'] = time();
  4. ....
  5.  
  6. function isLoginSessionExpired() {
  7. $login_session_duration = 10800;
  8. $current_time = time();
  9. if(isset($_SESSION['timeout']) and isset($_SESSION['dgUserLoggedIn'])){
  10. if(((time() - $_SESSION['timeout']) > $login_session_duration)){
  11. session_regenerate_id(true); // change session ID for the current session and invalidate old session ID
  12. $_SESSION['timeout'] = time(); // update creation time
  13. return true;
  14. }
  15. }
  16. return false;
  17. }
  18. if(isset($_SESSION["dgUserLoggedIn"])) {
  19. if(isLoginSessionExpired()) {
  20. header("Location: /core/logout.php");
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement