<?php
	session_start();
	require_once("../Wx.Config.php");	//只加载一次
	header("Content-type:text/html;charset=gb2312");
	//判断是否登录系统		
	if($_SESSION["main_viplogined"]!="1" |$_SESSION["main_vipno"]=="")
	{
		//没有登录开始启动登录
		header('location:login.php?stext=');
		exit;
	}
	
	//得到类别和会员号
	$modifytype=$_REQUEST['selid'];
	if($modifytype==1)
	{
		$modifytitle="修改手机号";
		$strtitle1="原手机：";
		$strtitle2="新手机：";
		$strtitle3="新手机";
		$strtitle4=$_SESSION["main_viptelno"];
	}
	elseif($modifytype==2)
	{
		$modifytitle="修改邮箱";
		$strtitle1="原邮箱：";
		$strtitle2="新邮箱：";
		$strtitle3="新邮箱";
		$strtitle4=$_SESSION["main_vipemail"];
	}
	elseif($modifytype==3)
	{
		$modifytitle="修改密码";
		$strtitle1="原密码：";
		$strtitle2="新密码：";
		$strtitle3="新密码";
		$strtitle4="******";
	}
	elseif($modifytype==4)
	{
		$modifytitle="绑定微信号";
		$strtitle1="原密码：";
		$strtitle2="新密码：";
		$strtitle3="新密码";
		$strtitle4="******";
	}
	else
	{
		$modifytitle="修改信息";
		$strtitle1="原信息：";
		$strtitle2="新信息：";
		$strtitle3="新信息";
		$strtitle4="";
	}
?>
<!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="css/mycss.css"> 
	<script src="jsp4/jquery.js"></script>
	
	<!--<link rel="stylesheet" href="jsp5/jquery.mobile-1.4.5.min.css">-->
	<!--<script src="jsp4/jquery.mobile-1.4.3.min.js"></script>-->
	<script src="jsp5/jquery.mobile-1.4.5.min.js"></script>
	<link rel="stylesheet" href="jsp5/jquery.mobile-1.4.5.min.css">
	
	<script language="JavaScript"> 
		//不允许进行后退
		javascript:window.history.forward(0); 
	</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>


<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<!--第一个页面的内容实现---------------------------->
<section data-role="page" id="mdipage1">
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="border-top-width:0px;border-bottom-width:0px;">
        <table width="100%" height="45" border="0" cellpadding="0" cellspacing="0" bgcolor="<?php echo WxMainConfig::colHeadBkColorBook;?>">
		   	<tr>
				<td height="45" width="30" align="center"></td>
				<td height="45" align="center" valign="middle">
	                <span id="MsgTxt" style="color:<?php echo WxMainConfig::colHeadTextColorBook;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:19px;text-shadow:none;"><?php echo $modifytitle; ?></span>
               	</td>
				<td height="45" width="30" valign="middle"></td>
		  	</tr>
		</table>
	</header>
	
	<article data-role="none">
					
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
			<tr>
				<td height="8" width="15"></td>
				<td height="8" align="left"></td>
				<td height="8" width="15"></td>
			</tr>
		<?php if($modifytype<3)
			{
		?>
			<tr>
				<td height="30" width="15"></td>
				<td height="30" align="left"><span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;"><?php echo $strtitle1;?>&nbsp;<?php echo $strtitle4; ?></span></td>
				<td height="30" width="15"></td>
			</tr>
			
			<tr>
				<td height="5" width="15"></td>
				<td height="5" align="left"></td>
				<td height="5" width="15"></td>
			</tr>
			
			<tr>
				<td height="1" width="15"></td>
				<td height="1" align="left" bgcolor="#F2E2E2"></td>
				<td height="1" width="15"></td>
			</tr>
			
			<tr>
				<td height="5" width="15"></td>
				<td height="5" align="left"></td>
				<td height="5" width="15"></td>
			</tr>
		<?php }  
		
			if($modifytype<>4) {
		?>
			<tr>
				<td height="30" width="15"></td>
				<td height="30" align="left">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="60"><span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;"><?php echo $strtitle2;?></span></td>
							<td>
								<div style="float:left;width:100%;">
									<?php if($modifytype==3){ ?>
										<input id="mytext" name="mytext" value="" type="password" placeholder='请输入<?php echo $strtitle3;?>' autocomplete="off" data-clear-btn="true" data-mini="true" />
									<?php } else { ?>
										<input id="mytext" name="mytext" value="" type="text" placeholder='请输入<?php echo $strtitle3;?>' autocomplete="off" data-clear-btn="true" data-mini="true" />
									<?php } ?>
								</div>	
							</td>
						</tr>
					</table>
				</td>
				<td height="30" width="15"></td>
			</tr>
			
			<tr>
				<td height="5" width="15"></td>
				<td height="5" align="left"></td>
				<td height="5" width="15"></td>
			</tr>
			
			<tr>
				<td height="1" width="15"></td>
				<td height="1" align="left" bgcolor="#F2E2E2"></td>
				<td height="1" width="15"></td>
			</tr>
			<?php } ?>
			
			<tr>
				<td height="10" width="15"></td>
				<td height="10" align="left"></td>
				<td height="10" width="15"></td>
			</tr>
			
			<tr>
				<td height="8" width="15"></td>
				<td height="8" align="center">
					<div style="left:2%;width:96%;height:50;padding-top:6px;">
						<?php if($modifytype==4) { ?>
							<a class="ui-btn ui-corner-all" href="#" style="color:#A6A600;" data-transition="slide" id="modifypost">绑定微信号</a>
						<?php } else { ?>
							<a class="ui-btn ui-corner-all" href="#" style="color:#A6A600;" data-transition="slide" id="modifypost">提交修改</a>
						<?php } ?>
					</div>
				</td>
				<td height="8" width="15"></td>
			</tr>

			<?php if($modifytype==4) { ?>
				<tr>
					<td height="10" width="15"></td>
					<td height="10" align="left"></td>
					<td height="10" width="15"></td>
				</tr>
				<tr>
					<td height="8" width="15"></td>
					<td height="8" align="center">
						<div style="left:2%;width:96%;height:50;padding-top:6px;">
							<a class="ui-btn ui-corner-all" href="login.php" style="color:#A6A600;" data-transition="slide" id="modifyclear">注销会员登录</a>
						</div>
					</td>
					<td height="8" width="15"></td>
				</tr>
			<?php } ?>
			
			
			<tr>
				<td height="8" width="15"></td>
				<td height="8" align="center">
					<div style="left:2%;width:96%;height:50;padding-top:6px;">	
						<a class="ui-btn ui-corner-all" href="vipmain.php" style="color:#999933;" target="_blank" data-role="button">返回</a>
					</div>
				</td>
				<td height="8" width="15"></td>
			</tr>
		
			
			<tr>
				<td height="6" width="15"></td>
				<td height="6" align="left"></td>
				<td height="6" width="15"></td>
			</tr>
		</table>
		
		<!--<form style="display:none;" id="form">									-->
		<!--	<table width="320" border="0" cellpadding="0" cellspacing="0">		-->
		<!--		<tr>															-->
		<!--			<td width="100" height="30" bgcolor="#E7E7E7"></td>			-->
		<!--		</tr>															-->
		<!--	</table>															-->
		<!--</form>																	-->
		
		<script type="text/javascript">
						
		 	$("#modifypost").click(
				function()
		 		{
					var modifytype=<?php echo $modifytype;?>;
					var strtemp = $("#mytext").val();
					var intNextFlag=0;
					
					if(modifytype=="1")
					{	//修改手机号
						if(strtemp.length<11)
						{	
							intNextFlag=1;
							alert("手机号码输入不正确！");
						}
					}
					else if(modifytype=="2")
					{
						var patrn=/^(\w)+([-+.]\w+)*@\w+([-.]\w+)*\..\w+([-.]\w+)*$/; 
						if (!patrn.exec(strtemp))
						{    //不符合
							intNextFlag=1;
							alert("您输入的邮箱地址不正确！");
						}
					}
					//else if(modifytype=="3")
					//{
						//if(strtemp.length<6)
						//{
						//	intNextFlag=1;
						//	alert("您输入的密码过于简单，密码为6个以上的字符或数字！");
						//}
					//}
					
					if(intNextFlag==0)
					{
						if(modifytype==4){
							strtemp="";
							//绑定微信号
							window.location.href="vipsave.php?selid=" + modifytype + "&temp=" + strtemp;
						}
						else {
							//开始提交修改
							window.location.href="vipsave.php?selid=" + modifytype + "&temp=" + strtemp;
						}
					}
								
					/*
					$.layer({
							fadeIn: 600, 
							border: [2, 0.5, '#000'],
							closeBtn: false,
							type: 1,
							shade: [0.5, '#000'],
							shadeClose: true,
							title: false,
							//area: ['400px', '200px'],
							page: {dom : '#form'} 
						});
					$("#form").css("display","block");
					*/
		 		}
			);
		</script>
		
		<script>
		//禁止页面上下滑动,整个页面都不能滑动了
		document.addEventListener('touchmove', function(e) {
			e.preventDefault();
		});
</script>
	</article>
</section>

</body>
	
</html>