fecaca56a326610b24626b163814a02c '.$_GET['userId'].' '.$_GET['sid'].' '; $sessionServer = "http://mzwa-123.6655.la:8090/services/SessionService"; if(defined('SSO_SESSION_SERVER')){ $sessionServer = SSO_SESSION_SERVER; } $securityServer = "http://mzwa-123.6655.la:8090/services/SecurityService"; if(defined('SSO_SECURITY_SERVER')){ $securityServer = SSO_SECURITY_SERVER; } $xmls = fetch($sessionServer, $param); if($xmls === false){ sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]); } $xml_values = ""; $parser = xml_parser_create('UTF-8'); xml_parse_into_struct($parser, trim($xmls), $xml_values); xml_parser_free($parser); foreach ($xml_values as $value){ if($value['tag'] == "RETURN"){ if($value['value'] == 'false'){ sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]); }elseif($value['value'] == 'true'){ $user = &sd_get_user($user_name); if (!empty($user) ) { $result = login_without_pwd_verify($user); $_SESSION["user"] = $user_name; if ($_SESSION["role"] == UserDao::$ROLE_CLOUD_USER) { if (I2System::isI2Cloud()){ sd_redirect("cloud/home.php"); }else{ sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]); } } else { sd_redirect("i2/home.php"); } } } break; } }}else{ sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]."?".$_SERVER["QUERY_STRING"]);}
回複內容:
fecaca56a326610b24626b163814a02c '.$_GET['userId'].' '.$_GET['sid'].' '; $sessionServer = "http://mzwa-123.6655.la:8090/services/SessionService"; if(defined('SSO_SESSION_SERVER')){ $sessionServer = SSO_SESSION_SERVER; } $securityServer = "http://mzwa-123.6655.la:8090/services/SecurityService"; if(defined('SSO_SECURITY_SERVER')){ $securityServer = SSO_SECURITY_SERVER; } $xmls = fetch($sessionServer, $param); if($xmls === false){ sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]); } $xml_values = ""; $parser = xml_parser_create('UTF-8'); xml_parse_into_struct($parser, trim($xmls), $xml_values); xml_parser_free($parser); foreach ($xml_values as $value){ if($value['tag'] == "RETURN"){ if($value['value'] == 'false'){ sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]); }elseif($value['value'] == 'true'){ $user = &sd_get_user($user_name); if (!empty($user) ) { $result = login_without_pwd_verify($user); $_SESSION["user"] = $user_name; if ($_SESSION["role"] == UserDao::$ROLE_CLOUD_USER) { if (I2System::isI2Cloud()){ sd_redirect("cloud/home.php"); }else{ sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]); } } else { sd_redirect("i2/home.php"); } } } break; } }}else{ sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]."?".$_SERVER["QUERY_STRING"]);}
整體流程上來講, 是從GET
請求中得到 userId
,
然後檢測這個userId
是否有值, 如果沒有值則跳回首頁.
如果有值, 則拼出來一個XML結構的東東(應該是調用 WebService
),
然後再根據是否有定義 SSO_SESSION_SERVER
決定使用預設的,還是定義好的 SessionService
地址.
然後發起請求,
如果請求失敗了, 則跳回首頁.
否則再根據請求的結果,決定跳到哪個頁面.
fecaca56a326610b24626b163814a02c '.$_GET['userId'].' '.$_GET['sid'].' '; //預設 sessionServer 的地址 $sessionServer = "http://mzwa-123.6655.la:8090/services/SessionService"; //如果有定義 SSO_SESSION_SERVER 的常量 if(defined('SSO_SESSION_SERVER')){//則更新 $sessionServer 的值為 SSO_SESSION_SERVER 的值 $sessionServer = SSO_SESSION_SERVER; } //這裡的代碼沒地方用, 所以就加註釋了 $securityServer = "http://mzwa-123.6655.la:8090/services/SecurityService"; if(defined('SSO_SECURITY_SERVER')){ $securityServer = SSO_SECURITY_SERVER; } //應該是發起一個HTTP請求 $xmls = fetch($sessionServer, $param); //如果請求失敗了 if($xmls === false){ //跳到某個頁面(應該是首頁什麼的) sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]); } $xml_values = ""; //解析請求回來的內容 $parser = xml_parser_create('UTF-8'); xml_parse_into_struct($parser, trim($xmls), $xml_values); xml_parser_free($parser); //遍曆得到的XML檔案 foreach ($xml_values as $value){ if($value['tag'] == "RETURN"){//如果資料中的 tag 等於 RETURN if($value['value'] == 'false'){//資料中的 value 為 false 時 sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]);//跳到某個頁面 }elseif($value['value'] == 'true'){//為 true 時 $user = &sd_get_user($user_name);//再調用某個方法(傳遞最上面得到的 userId 過去) if (!empty($user) ) {//如果 sd_get_user 的傳回值不是空的 $result = login_without_pwd_verify($user);//再調用某個方法, 傳遞 上面的傳回值過去 $_SESSION["user"] = $user_name; if ($_SESSION["role"] == UserDao::$ROLE_CLOUD_USER) {//再判斷 if (I2System::isI2Cloud()){//再判斷... sd_redirect("cloud/home.php");//條件成立時跳這裡 }else{ sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]);//不成立時跳這裡 } } else {//if不成立時跳這裡 sd_redirect("i2/home.php"); } } } break; } }}else{ //沒有 userId 時,跳這裡... sd_redirect($GLOBAL_SYSTEM[PRODUCT_TYPE]["index"]."?".$_SERVER["QUERY_STRING"]);}