X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fincludes%2Fplc_session.php;h=4c42375866779cec0052e4185c533c2cf9b3c462;hb=bbde0e199cce8cc4c17d301bd0141e4a759f4a64;hp=91fb24726e2d272abee242c52b902fc55410f490;hpb=d2ec087a2d0f476919f3413585efee6d21d68a7c;p=plewww.git diff --git a/planetlab/includes/plc_session.php b/planetlab/includes/plc_session.php index 91fb247..4c42375 100644 --- a/planetlab/includes/plc_session.php +++ b/planetlab/includes/plc_session.php @@ -23,6 +23,10 @@ require_once 'plc_config.php'; // Usually in /usr/share/plc_api/php require_once 'plc_api.php'; + +require_once 'plc_functions.php'; + + $cwd = getcwd(); chdir($_SERVER['DOCUMENT_ROOT']); $included = include_once('./includes/bootstrap.inc'); @@ -54,13 +58,14 @@ class PLCSession 'AuthString' => $pass)); // Authenticate user and get session key - $session = $api->GetSession(); + $seconds_to_expire = (24 * 60 * 60 * 14); + $session = $api->GetSession($seconds_to_expire); if (!$session) { - return NULL; + return NULL; } // Change GetSession() at some point to return expires as well - $expires = time() + (24 * 60 * 60); + $expires = time() + $seconds_to_expire; // Change to session authentication $api->auth = array('AuthMethod' => "session", 'session' => $session); @@ -155,4 +160,11 @@ if (!empty($_SESSION['plc'])) { // For convenience $api = $plc->api; +if ($api && $api->AuthCheck() != 1) { + $current_pagename = basename($_SERVER['PHP_SELF']); + if ($current_pagename != basename(l_logout())) { + plc_redirect(l_logout()); + } +} + ?>