<?
include_once("inc/auth.inc.php");
include_once("inc/utility_all.php");
include_once("inc/utility_org.php");
include_once("inc/editor.php");
include_once("inc/utility_file.php");
$HTML_PAGE_TITLE = _("绑定统计云账号");
include_once("inc/header.inc.php");
$user_id=$_SESSION["LOGIN_USER_ID"];
$query="select * from user where user_id='$user_id' limit 1";
$curosr=exequery(TD::conn(),$query);
while($row=mysql_fetch_array($curosr)){
$tongjiyun=$row["tongjiyun"];
}
if($tongjiyun==""){
header("Location:tongjibangding.php");
exit;
}
$zhanghao=$tongjiyun;
$zhanghaob=base64_encode($zhanghao);
echo $zhanghaob."<br>";
echo base64_encode($zhanghaob)."<br>";
$u111="http://6.16.237.40:8090/cwbase/WebFramework/loginSsoOA.aspx?token=".$zhanghaob;
echo $u111."<br>";
$url2="http://10.78.1.236:8090/cwbase/WebFramework/loginSsoOA.aspx?token=".$zhanghaob;//10.78.1.236
echo $url2."<br>";
//$fh= file_get_contents("http://6.16.237.40:8090/cwbase/WebFramework/loginSsoOA.aspx?token=".$zhanghaob);
//echo $fh;
echo "<hr>";
//$fh1= file_get_contents("http://6.16.237.34:99/general/kuaijiedenglu/tongjiyun.php?token=WTJWemFHaz0=");
//echo $fh1;
echo "<hr>";
$re=curlPost($url2,$data='');
echo $re;
$url3="http://6.16.237.40:8090".$re;
header("Location:".$url3);
function curlPost($url,$data=array())
{
//echo "aaaa";
$ch = curl_init();
$params[CURLOPT_URL] = $url; //请求url地址
$params[CURLOPT_HEADER] = FALSE; //是否返回响应头信息
$params[CURLOPT_SSL_VERIFYPEER] = false;
$params[CURLOPT_SSL_VERIFYHOST] = false;
$params[CURLOPT_RETURNTRANSFER] = true; //是否将结果返回
$params[CURLOPT_POST] = true;
$params[CURLOPT_POSTFIELDS] = $data;
curl_setopt_array($ch, $params); //传入curl参数
$content = curl_exec($ch); //执行
curl_close($ch); //关闭连接
// echo $content."4444";
return $content;
}
exit;
$youxiang=$_REQUEST["youxiang"];
echo $youxiang;
$url1 = "http://mail.chinabdh.com/services/TurboWebService/exe";
//$data = json_encode(array("webservice_password"=>"bdh666", "beanid"=>"web.ssologin","json_params"=>array("username"=>"wutianzhuo","domain"=>"chinabdh.com")));
//echo $data."<br>";
$post_data1=array();
$post_data1["webservice_password"]="bdh666";
$post_data1["beanid"]="web.ssologin";
$post_data1["json_params"]='{"username":"'.$youxiang.'","domain":"chinabdh.com"}';
$o1 = "";
foreach ( $post_data1 as $k => $v )
{
$o1.= "$k=" . urlencode( $v ). "&" ;
}
$post_data1 = substr($o1,0,-1);
$res1 =request_post($url1, $post_data1);
print_r($res1);
// $re1=json_decode($res1,true);
// echo $res1->data;;
$mode1 = "/<ns:return>(.*)<\/ns:return>/is";
preg_match_all($mode1,$res1,$matches1);//正则获取json
echo "<hr>";
//print_r($matches1);
$re1=$matches1[0][0];
echo "<hr>";
echo $re1;
$re0=str_replace("<ns:return>","",$re1);
$re3=str_replace("</ns:return>","",$re0);
$re2=json_decode($re3);
echo "<hr>";
print_r($re2);
$sessionid=$re2->data->sessionid;
$urla="http://mail.chinabdh.com/sso_access?sessionid=".$sessionid."&hideheader=0&hidemainmenu=0&moduleid=mail.list.inbox";
header("Location:".$urla);
//http://mail.chinabdh.com/sso_access?sessionid= twa1_1604068729480287&hideheader=0&hidemainmenu=0&moduleid=mail.list.inbox
?>
<?
function request_post($url = '', $param = '') {
if (empty($url) || empty($param)) {
return false;
}
$postUrl = $url;
$curlPost = $param;
$ch = curl_init();//初始化curl
curl_setopt($ch, CURLOPT_URL,$postUrl);//抓取指定网页
curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
$data = curl_exec($ch);//运行curl
curl_close($ch);
return $data;
}
function object_array($array){
if(is_object($array)){
$array = (array)$array;
}
if(is_array($array)){
foreach($array as $key=>$value){
$array[$key] = object_array($value);
}
}
return $array;
}
function xmlToArray($xml){
if (file_exists($xml)) {
libxml_disable_entity_loader(false);
$xml_string = simplexml_load_file($xml,'SimpleXMLElement', LIBXML_NOCDATA);
}else{
libxml_disable_entity_loader(true);
$xml_string = simplexml_load_string($xml,'SimpleXMLElement', LIBXML_NOCDATA);
}
$result = json_decode(json_encode($xml_string),true);
return $result;
}
?>