Explorar el Código

- New way to handle sessions compatible with multiple environments

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1710 a333f486-631f-4898-b8df-5754b55c2be0
dflaven hace 13 años
padre
commit
db2209624a
Se han modificado 2 ficheros con 13 adiciones y 11 borrados
  1. 2 9
      application/loginwebpage.class.inc.php
  2. 11 2
      application/startup.inc.php

+ 2 - 9
application/loginwebpage.class.inc.php

@@ -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')
 		{

+ 11 - 2
application/startup.inc.php

@@ -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);
 
 ?>