From 006453678b61a4184f2c45d9a04d4ff5db70d732 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Fri, 22 Oct 2010 06:09:51 +0000 Subject: [PATCH] Fixed Trac#300: each iTop instance now uses its own name for the cookie storing the session ID. Therefore several instances can coexist independently on the same server. SVN:trunk[913] --- application/loginwebpage.class.inc.php | 1 + core/config.class.inc.php | 8 ++++++++ pages/logoff.php | 1 + setup/index.php | 3 +++ 4 files changed, 13 insertions(+) diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php index dc414a4e2..f150009ca 100644 --- a/application/loginwebpage.class.inc.php +++ b/application/loginwebpage.class.inc.php @@ -339,6 +339,7 @@ EOF static function DoLogin($bMustBeAdmin = false, $bIsAllowedToPortalUsers = false) { $operation = utils::ReadParam('loginop', ''); + session_name(utils::GetConfig()->Get('session_name')); session_start(); if ($operation == 'logoff') diff --git a/core/config.class.inc.php b/core/config.class.inc.php index b684d57fc..05b0e2e02 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -110,6 +110,14 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ), + 'session_name' => array( + 'type' => 'string', + 'description' => 'The name of the cookie used to store the PHP session id', + 'default' => 'iTop', + 'value' => '', + 'source_of_value' => '', + 'show_in_conf_sample' => true, + ), ); public function IsProperty($sPropCode) diff --git a/pages/logoff.php b/pages/logoff.php index 0ceef4da6..303e64f80 100644 --- a/pages/logoff.php +++ b/pages/logoff.php @@ -24,6 +24,7 @@ $currentOrganization = utils::ReadParam('org_id', ''); $operation = utils::ReadParam('operation', ''); require_once('../application/loginwebpage.class.inc.php'); +session_name(utils::GetConfig()->Get('session_name')); session_start(); LoginWebPage::ResetSession(); $oPage = new LoginWebPage(); diff --git a/setup/index.php b/setup/index.php index 6e42d3d69..cc89a2b24 100644 --- a/setup/index.php +++ b/setup/index.php @@ -1058,6 +1058,9 @@ function SetupFinished(SetupWebPage $oP, $aParamValues, $iCurrentStep, Config $o $sAuthPwd = $aParamValues['auth_pwd']; try { + $sSessionName = sprintf('iTop-%x', rand()); + $oConfig->Set('session_name', $sSessionName); + session_name($sSessionName); session_start(); // Write the final configuration file