git://git.onelab.eu
/
plewww.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a 14 day default session time rather than 24 hours.
[plewww.git]
/
planetlab
/
includes
/
plc_session.php
diff --git
a/planetlab/includes/plc_session.php
b/planetlab/includes/plc_session.php
index
91fb247
..
4c42375
100644
(file)
--- 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';
// 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');
$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
'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) {
if (!$session) {
- return NULL;
+
return NULL;
}
// Change GetSession() at some point to return expires as well
}
// 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);
// Change to session authentication
$api->auth = array('AuthMethod' => "session", 'session' => $session);
@@
-155,4
+160,11
@@
if (!empty($_SESSION['plc'])) {
// For convenience
$api = $plc->api;
// 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());
+ }
+}
+
?>
?>