12345678910111213141516171819202122232425262728293031323334 |
- <?php
- /* Authors : Carlos C. Corrada-Bravo
- David J. Ortiz-Rivera
-
- Organization : Centro de Desarrollo y Consultoria Computacional
- Project : OPASO Material Registry
- File : header
- Description : Handle session expiry for OPASO */
-
- /* start user session */
- if(!isset($_SESSION)){
- session_start();
- }
-
- /* check for expired session */
- if(!isset($_SESSION["last_activity"]) or (time() - $_SESSION["last_activity"]) > 1800){
- session_unset();
- session_destroy();
- $_SESSION = array();
- header("Location: /?error=session_expired");
- die();
- }
-
- /* update last activity */
- else{
- $_SESSION["last_activity"] = time();
- }
-
- /* update session id, after 30 mins */
- if((time() - $_SESSION["created"]) > 1800){
- session_regenerate_id(true);
- $_SESSION["created"] = time();
- }
- ?>
|