Fix a problem with the multi-domain login and make it easier to understand.

This commit is contained in:
Mark Crane
2013-02-13 06:51:09 +00:00
parent 83d388b822
commit 5bceea8ebf

View File

@@ -46,33 +46,38 @@ session_start();
//get the domain name //get the domain name
if (count($_SESSION["domains"]) > 1) { if (count($_SESSION["domains"]) > 1) {
$username_array = explode("@", check_str($_REQUEST["username"])); //get the domain from the url
if (count($username_array) > 1) { $domain_name = $_SERVER["http_host"];
$domain_name = $username_array[count($username_array) -1]; //get the domain name from the username
$_REQUEST["username"] = substr(check_str($_REQUEST["username"]), 0, -(strlen($domain_name)+1)); $username_array = explode("@", check_str($_REQUEST["username"]));
} if (count($username_array) > 1) {
if (strlen(check_str($_REQUEST["domain_name"])) > 0) { $domain_name = $username_array[count($username_array) -1];
$domain_name = check_str($_REQUEST["domain_name"]); $_REQUEST["username"] = substr(check_str($_REQUEST["username"]), 0, -(strlen($domain_name)+1));
} }
if (count($username_array) > 1 || strlen(check_str($_REQUEST["domain_name"])) > 0) { //get the domain name from the http value
foreach ($_SESSION['domains'] as &$row) { if (strlen(check_str($_REQUEST["domain_name"])) > 0) {
if ($row['domain_name'] == $domain_name) { $domain_name = check_str($_REQUEST["domain_name"]);
//set the domain session variables }
$domain_uuid = $row["domain_uuid"]; //set the domain information
$_SESSION["domain_uuid"] = $row["domain_uuid"]; if (strlen($domain_name) > 0) {
$_SESSION['domains'][$row['domain_uuid']]['domain_uuid'] = $row['domain_uuid']; foreach ($_SESSION['domains'] as &$row) {
$_SESSION['domains'][$row['domain_uuid']]['domain_name'] = $domain_name; if ($row['domain_name'] == $domain_name) {
$_SESSION["domain_name"] = $domain_name; //set the domain session variables
$domain_uuid = $row["domain_uuid"];
$_SESSION["domain_uuid"] = $row["domain_uuid"];
$_SESSION['domains'][$row['domain_uuid']]['domain_uuid'] = $row['domain_uuid'];
$_SESSION['domains'][$row['domain_uuid']]['domain_name'] = $domain_name;
$_SESSION["domain_name"] = $domain_name;
//set the setting arrays //set the setting arrays
//domains set() //domains set()
require "includes/classes/domains.php"; require "includes/classes/domains.php";
$domain = new domains(); $domain = new domains();
$domain->db = $db; $domain->db = $db;
$domain->set(); $domain->set();
}
} }
} }
}
} }
//get the username //get the username