From cdf50f82de0d53a44e1273d5c1d52669ebe031d4 Mon Sep 17 00:00:00 2001 From: Jamie Pratt Date: Wed, 17 Feb 2010 14:25:35 +0000 Subject: [PATCH] MDL-21641 cookieless sessions - Need to try to set a cookie before falling back to cookieless mode. Moved test to see if cookies are working till after Moodle has attempted to set a cookie. If there is no cookie then we use session id in url. --- lib/setup.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index 30b78123b1c71..ec7dcd9dbe487 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -566,10 +566,7 @@ function addslashes_deep($value) { if (!empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie]) && $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] == "deleted") { unset($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie]); } - if (!empty($CFG->usesid) && empty($_COOKIE['MoodleSession'.$CFG->sessioncookie])) { - require_once("$CFG->dirroot/lib/cookieless.php"); - sid_start_ob(); - } + if (empty($nomoodlecookie)) { session_name('MoodleSession'.$CFG->sessioncookie); @@ -618,7 +615,10 @@ function addslashes_deep($value) { $FULLME = qualified_me(); $ME = strip_querystring($FULLME); } - + if (!empty($CFG->usesid) && empty($_COOKIE['MoodleSession'.$CFG->sessioncookie])) { + require_once("$CFG->dirroot/lib/cookieless.php"); + sid_start_ob(); + } /// In VERY rare cases old PHP server bugs (it has been found on PHP 4.1.2 running /// as a CGI under IIS on Windows) may require that you uncomment the following: // session_register("USER");