From 4dfa092564de6bc659131f376922ea0888be5f87 Mon Sep 17 00:00:00 2001 From: skodak Date: Fri, 9 Sep 2005 15:14:48 +0000 Subject: [PATCH] new handling of session timeouts - part 1; merged from MOODLE_15_STABLE --- lib/setup.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index 364341c1e50..4106b9e9e38 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -308,12 +308,11 @@ $CFG->httpswwwroot = $CFG->wwwroot; if (! isset($_SESSION['SESSION'])) { $_SESSION['SESSION'] = new object; $_SESSION['SESSION']->session_test = random_string(10); - if (empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie])) { - setcookie('MoodleSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, '/'); - $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] = $_SESSION['SESSION']->session_test; - } else { - $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] = 'error!!'; + if (!empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie])) { + define('SESSION_HAS_TIMED_OUT', 'true'); } + setcookie('MoodleSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, '/'); + $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] = $_SESSION['SESSION']->session_test; } if (! isset($_SESSION['USER'])) { $_SESSION['USER'] = new object;