From fe18e430f704cf84120a7708fac7d5a294d7a806 Mon Sep 17 00:00:00 2001 From: patrickslee Date: Wed, 7 Sep 2005 04:22:03 +0000 Subject: [PATCH] Finally the *correct* fix for the looping problem. Thanks to Penny --- lib/moodlelib.php | 5 +---- lib/setup.php | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index f59db5802ac..9ca725c7b1b 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -6291,7 +6291,7 @@ function remove_dir($dir, $content_only=false) { } function report_session_error() { - global $CFG, $FULLME, $SESSOIN; + global $CFG, $FULLME; if (empty($CFG->lang)) { $CFG->lang = "en"; } @@ -6305,9 +6305,6 @@ function report_session_error() { } else { set_config('session_error_counter', 1); } - unset($_SESSION['USER']); - unset($GLOBALS['USER']); - unset($SESSION->session_test); redirect($FULLME, get_string('sessionerroruser', 'error'), 2); } diff --git a/lib/setup.php b/lib/setup.php index 44144b302f5..aaa5ea60fa5 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -307,6 +307,11 @@ $CFG->httpswwwroot = $CFG->wwwroot; } else { $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] = 'error!!'; } + } else { + if (empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie])) { + 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;