- New way to handle sessions compatible with multiple environments

SVN:trunk[1710]
This commit is contained in:
Denis Flaven
2011-12-08 15:37:48 +00:00
parent bb3d08b8a3
commit 8231420c44
2 changed files with 13 additions and 11 deletions

View File

@@ -191,15 +191,10 @@ EOF
$sPreviousLoginMode = '';
}
// Unset all of the session variables.
$_SESSION = array();
unset($_SESSION['auth_user']);
unset($_SESSION['login_mode']);
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()]))
{
setcookie(session_name(), '', time()-3600, '/');
}
// Finally, destroy the session.
session_destroy();
}
static function SecureConnectionRequired()
@@ -458,8 +453,6 @@ EOF
{
$sMessage = ''; // In case we need to return a message to the calling web page
$operation = utils::ReadParam('loginop', '');
session_name(MetaModel::GetConfig()->Get('session_name'));
session_start();
if ($operation == 'logoff')
{

View File

@@ -25,7 +25,16 @@
require_once(APPROOT.'/core/cmdbobject.class.inc.php');
require_once(APPROOT.'/application/utils.inc.php');
MetaModel::Startup(ITOP_CONFIG_FILE);
session_name('itop-'.md5(APPROOT));
session_start();
if (isset($_SESSION['itop_env']))
{
$sConfigFile = $_SESSION['itop_env'];
}
else
{
$sConfigFile = ITOP_CONFIG_FILE;
}
MetaModel::Startup($sConfigFile);
?>