<?php
	session_start();
	require_once("Wx.Config.php");
	
	ini_set('session.gc_maxlifetime', 99999999); //设置时间 永不过期
	
	$strwxudid= trim($_SESSION["main_wx_userwxudid"]);
	
	$strDefUserNo='';
	$rset=$_REQUEST['rset'];
	$stext=$_REQUEST['stext'];
		
		
	//根据微信号获取工号
	if(strlen($strwxudid)>20)
	{
		require_once("db/db.php");	
		require_once("common/common.php");
		$sql=sprintf("SELECT Use_No FROM User_QuanXian WHERE wxudid='%s'",$strwxudid);
		$result = querySql($sql);
		
		if($row = fetch_array($result))
		{
			$strDefUserNo = $row['Use_No'];
		}
		freeResult($result);
		closeDb();
	}
	elseif($strwxudid=='**11223344556677**')
	{
		$strDefUserNo="";
	}
	else
	{	
		header('Location: https://ty112.com/weixin/wxydt/start1.php');
		exit;
	}
		
	if($rset=='11')
	{
		//注销系统
		//$_SESSION["main_wx_userwxudid"]='';		//当前微信号UDID
		$_SESSION["main_wx_userno"]='';			//当前登录的用户编号
		$_SESSION["main_wx_username"]='';		//当前登录的用户姓名
		$_SESSION["main_wx_userpswd"]='';		//当前登录的用户密码
		$_SESSION["main_wx_userlogined"]='';	//当前用户是否登录
		$_SESSION["main_wx_chainno"]='';		//当前用户是否登录
		$_SESSION["main_wx_chainname"]='';		//当前用户是否登录
		$_SESSION['main_wx_chaincount'] ="0";
	}
	else
	{
		//启动登陆判断页面
		if(strlen($strDefUserNo)>0)
		{
			header('Location: loginwxa.php?userno='.$strDefUserNo.'&pwd=[x*x*w*]');
			exit;
		}
	}
	
	header("Content-type: text/html; charset=gb2312"); 
	
	$strHotelName=trim(WxMainConfig::strHeadTextHotelName);
	$strHotelName=iconv('utf-8','gb2312',$strHotelName);
	if(strlen($strHotelName)<2)
	{
		$strHotelName='云点通登录';
	}
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="gb2312">	
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
	<meta name="apple-mobile-web-app-capable" content="1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=0">
	<meta name="apple-touch-fullscreen" content="1">

	<title>云点通</title>

	<link rel="stylesheet" href="ydth6/jsp4/jquery.mobile-1.4.3.min.css">
	<script src="ydth6/jsp4/jquery.js"></script>
	<script src="ydth6/jsp4/jquery.mobile-1.4.3.min.js"></script>
	<script src="ydth6/jsp4/jquery.placeholder.min.js"></script>

	<script language="JavaScript"> 
		//不允许进行后退
		javascript:window.history.forward(1); 
	</script>
	<script>
		//禁止页面上下滑动,整个页面都不能滑动了
		document.addEventListener('touchmove', function(e) {
			e.preventDefault();
		});
	</script>
</head>

<script>
		//隐藏维信右上角菜单
		function onBridgeReady(){
			WeixinJSBridge.call('hideOptionMenu');
		}

		if (typeof WeixinJSBridge == "undefined")
		{
			if( document.addEventListener )
			{
				document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
			}
			else if (document.attachEvent)
			{
				document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
				document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
			}
		}
		else
		{
			onBridgeReady();
		}
</script>

	<script>
		var strDefSoftWXID = "<?php echo $strwxudid;?>";
		
		$().ready(function()
		{
			var strDefSoftWXID1=localStorage["main_HIMSDefSoftWXID"];
			
			if (typeof (strDefSoftWXID1) == "undefined") 
			{
				strDefSoftWXID1="";
			}
						
			if(strDefSoftWXID.length<20)
			{
				strDefSoftWXID=strDefSoftWXID1;
			}
		
		});
	</script>
	
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">

<div data-role="page">
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="border-top-width:0px;border-bottom-width:0px;bkc">
        <table width="100%" height="50" border="0" cellpadding="0" cellspacing="0" >
		   	<tr bgcolor="#3595f5">
				<td height="50" width="45" align="center" valign="middle"></td>
				<td height="50" align="center" valign="middle">
					<span style="color:#fff;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:19px;text-shadow:none;"><?php echo $strHotelName;?></span>
				</td>
				<td height="50" width="45" align="center" valign="middle">
					<?php if($strwxudid=='**11223344556677**') {?>
					<div style="border-radius:8px;width:50px; height:26px; ">
						<img src="images\tabar_icon_5d.png" width="22" height="22" border="0" style="margin-top:2px;">
					</div>
					<?php } else {?>
					<div onClick="btmSetCustomID();" style="border-radius:8px;width:50px; height:26px; ">
						<img src="images\tabar_icon_5d.png" width="22" height="22" border="0" style="margin-top:2px;">
					</div>
					<?php } ?>
				</td>
		  	</tr>
			
			<tr bgcolor="#3595f5">
				<td colspan="3" height="20">
					<div style="background:#F9F9F9;width:100%;height:20px;padding-top:0px;margin-top:0px; border-radius: 18px 18px 0px 0px;">
						
					</div>
				</td>
		  	</tr>
		</table>
	</header>
				
	<div data-role="content">
		<div style="left:2%;width:98%;height:123px;border-radius:5px;border-top:1px solid #ddd;border-bottom:1px solid #ddd;border-left:1px solid #ddd;border-right:1px solid #ddd;">	
			<div style="width:100%;height:53px;border-radius:5px;padding-top:5px;padding-bottom:0px;">
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td height="60" width="50" align="center">
							<a class="ui-btn ui-icon-user ui-btn-icon-notext ui-corner-all" href="#"></a>			
						</td>
							
						<td height="60" align="right">
							<div style="float:left;width:100%;">
								<input type="text" name="userno" id="userno" value="<?php echo $strDefUserNo;?>" placeholder="请输入用户号" data-clear-btn="true"/>
							</div>			
						</td>
							
						<td height="60" width="15"></td>
					</tr>
				</table>    		
			</div>
			
			<div style="width:100%;height:55px;border-radius:5px;padding-top:0px;padding-bottom:0px;">
				<table width="100%" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td height="60" width="50" align="center">
								<a class="ui-btn ui-icon-lock ui-btn-icon-notext ui-corner-all" href="#"></a>			
						</td>
							
						<td height="60" align="right">
							<div style="float:left;width:100%;">
								<input id="pwd" name="pwd" value="" type="password" placeholder="请输入密码" autocomplete="off" data-clear-btn="true" />
							</div>			
						</td>
							
						<td height="60" width="15"></td>
					</tr>
				</table>    		
			</div>
			
		</div>
		
		<div style="width:100%;height:50px;padding-top:30px;">	
						<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td height="35" width="1%"></td>
								<td height="35" width="98%" align="center">
										
									<div onClick="bmtLoginSys();"  style="border:1px solid #B10010; border-radius:15px;width:98%; height:35px;">
										<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
											<tr><td width="100%" height="100%" align="center">
												<span style="color:#B10010 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;">登录系统</span>
											</td></tr>
										</table>
									</div>		
								</td>
								<td height="35" width="1%"></td>
							</tr>
						</table>
		</div>

		
		<?php
			if($stext!="")
			{
		?>
		<div align="center"><?php echo $stext;?></div>
		<?php
				$stext="";
			}
		?>
			
	</div>
	
	<script type="text/javascript">
		
		function bmtLoginSys()
		{	
			var struserno = $("#userno").val();
		 	var strpswd = $("#pwd").val();
			if(struserno=="")
			{	
				$("#userno").focus();
				return;
			}
			
			localStorage["main_HIMSDefSoftWXID"]=strDefSoftWXID;
			
		 	parent.window.location.href='loginwxa.php?userno=' + struserno + '&pwd=' + strpswd;
		}
		
		function btmSetCustomID()
		{	
			parent.window.location.href="https://ty112.com/weixin/wxydt/main.php?doSelGDSID=1&wxudid=<?php echo $strwxudid; ?>";
		}
		
	</script>
</div>

</body>

</html>
