<?php include mymps_tpl('inc_header');?>
<link rel="Stylesheet" type="text/css" href="template/css/dialog.css" />
<link rel="stylesheet" type="text/css" href="template/css/my.css" />
<script src="/template/default/js/jquery.min.js" type="text/javascript"></script>
<script language="javascript" src="template/javascript.js"></script>
<script language="javascript">
var XMLHttpReq;  
function createXMLHttpRequest() {  
    try {  
        XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");//IE高版本创建XMLHTTP  
    }  
    catch(E) {  
        try {  
            XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");//IE低版本创建XMLHTTP  
        }  
        catch(E) {  
            XMLHttpReq = new XMLHttpRequest();//兼容非IE浏览器，直接创建XMLHTTP对象  
        }  
    }  
  
}  
function sendAjaxRequest(url) {  
    createXMLHttpRequest();                                //创建XMLHttpRequest对象  
    XMLHttpReq.open("post", url, true);  
    XMLHttpReq.onreadystatechange = processResponse; //指定响应函数  
    XMLHttpReq.send(null);  
}  
	
//回调函数  
function processResponse() {  
    if (XMLHttpReq.readyState == 4) {  
        if (XMLHttpReq.status == 200) {  
            var text = XMLHttpReq.responseText; 
            if(text.indexOf("success") > 0 )
            {
            	document.getElementById("btn_send_msg").value = "短信已发送";
                document.getElementById("btn_send_msg").disabled = true;
                document.getElementById("btn_send_msg").style.color="#C0C0C0";
            }
            else if(text.indexOf("error ") > 0 )
            {
            	alert("短信发送失败，请重试！");
            }
            else if(text.indexOf("boundbyyourself") > 0 )
            {
            	alert("您已绑定此手机号，无需重复操作！");
            }
            else if(text.indexOf("alreadysendmaxmsgcount") > 0 )
            {
            	alert("24小时之内最多发送5条短信，请稍后重试！");
            }
			 
            else if(text.indexOf("cannotbindagaininoneday_") > 0 )
            {
            	alert("您已于"+text.substr(29)+"完成手机绑定，24小时之内只能进行一次手机绑定操作！");
            }
			else if(text.indexOf("notlocal_") > 0 )
            {
            	alert("仅限枣庄归属地手机号码注册");
            }
            else
            {
            	alert("该手机号已被其他用户("+text.trim()+")绑定，请修改手机号码后重试！");
            }
        }  
    }  
} 




function send_msg()
{ 	
	var phone = document.getElementById('phone').value;
	var re;
    re= /^1[3-8][0-9]{9}$/;
    if(!re.test(phone))
	{
    	alert('请填写正确的手机号码。');return;
	}else{
    	sendAjaxRequest("sendmsg.php?phone="+phone+"&userid=<?php echo $s_uid ?>");	
    }
}

function changetext()
{
	document.getElementById("btn_send_msg").value = "发送短信验证码";
	document.getElementById("btn_send_msg").disabled = false;
	document.getElementById("btn_send_msg").style.color="#12459c";
}
</script>
</head>
<body class="<?php echo $mymps_global['cfg_tpl_dir']; ?>">
<div class="container">

<?php include mymps_tpl('inc_head');?>

    <div id="main" class="main section-setting">
        <div class="clearfix main-inner">
            <div class="content">
                <div class="clearfix content-inner">
					<div id="msg_success"></div>
					<div id="msg_error"></div>
					<div id="msg_alert"></div>

	<!-- 手机绑定 begin -->
	
                    <div class="content-main">
                        <div class="content-main-inner">
                             <div class="pwrap setting-password">
                                <div class="phead"><div class="phead-inner"><div class="phead-inner">
                                    <h3 class="ptitle"><span>手机绑定</span></h3>
                                    <BR>
                                </div></div></div>
                               
                                <div class="pbody">


									
                                    <form action="?m=bind" method="post" id="bindform">
                                    	<input name="act" type="hidden" value="bind" />
                                    	
                                    <div class="formgroup">
                                    	<?php if($check_tel){ ?>
										
										
										
                                         <div class="formrow">
                                            <h3 class="label"><label>已绑定手机</label></h3>
                                            <div class="form-enter">
                                                <div style="font-weight:bold; margin-top:3px"><?php echo $check_tel; ?></div>
                                            </div>
											 <span class="minbtn-wrap"><span class="btn">
                                            	<input class="button" type="button" value="解除绑定" onClick="javascript: if(confirm('确定解除该手机绑定吗？')) document.forms['bindform'].submit(); " />
                                            	<input name="remove" type="hidden" value="1" />
                                            </span></span>
											<div class="form-note">您可以使用该手机号码直接登录本账号</div>
                                        </div>
										
										
										
										<div class="formcaption-note">
                                       <div class="alertmsg">24小时内仅可解绑更换一次手机号码，请谨慎操作。</div>                                    </div>
                                        
                                        <?php } else { ?>
										
										<div class="formcaption-note">
                                       <div class="alertmsg">您当前未绑定手机号码，暂不可发布信息，为了操作方便和账户安全请绑定手机号码。</div>                                    </div>
                                        
                                        <div class="formrow">
										
										 <h3 class="label"><label>手机号</label></h3>

                                            <div class="form-enter">

                                                <input name="tel" id="phone" type="text" value="" class="text" size="11" onChange="changetext();">

                                            </div>
											
                                           
                                           
                                        </div>
										
										<div class="formrow">

                                            <h3 class="label"><label>验证码:</label></h3>

                                            <div class="form-enter">

                                               <input name="code" type="text" value="" class="text" size="6" style="width:5em">
											  <span class="btn">
		                                            		<input class="button" id="btn_send_msg" name="password_submit" type="button" value="发送短信验证码" onClick="send_msg();"/>
		                                            	</span>

                                            </div>

                                        </div>
										
										<div class="formrow formrow-action">
                                            <span class="minbtn-wrap"><span class="btn"><input type="submit" value="确认绑定手机" class="button" name="password_submit" /></span></span>
                                        </div>
                                        
                                        
                                        <?php } ?>
                                        
                                    </div>
                                    </form>
                            
                                </div>
                                <div class="pfoot"><p><b>-</b></p></div>
                            </div>
                        </div>
                    </div>
	<!-- 手机绑定 end -->
	<!-- QQ绑定 begin -->                
                    <div class="content-main">
                        <div class="content-main-inner">
                             <div class="pwrap setting-password">
                                <div class="phead">
                                	<div class="phead-inner">
                                		<div class="phead-inner">
                                    		<h3 class="ptitle">
                                    			<span>QQ绑定</span>
                                    		</h3>
                                    		<BR>
                                		</div>
                                	</div>
                                </div>
                               
                                <div class="pbody">

                                    <div class="formgroup">
                                    	<div class="formrow">
                                    	
                                    		<span style="float:left;margin-right:30px;">
								            	<img src="../include/qqlogin/qq_logo.jpg">
								            </span>
								               
                                    	<?php if($check_qq){ ?>
                                        
								               <span style="float:left;margin-right:200px;">
								                  <div class="bind_okcon">
								                  	<h3>
								                  		<b>您已经成功绑定</b><br>
							                  			<form action="?m=bind" method="post" id="qqform">
                                    						<input name="act" type="hidden" value="qq" />
                                    						<input name="remove" type="hidden" value="1" />
								                  			<input type="button" value="解绑" class="button"  onclick="javascript: if(confirm('确定解除QQ绑定吗？')) submit(); " >
								                  		</form>
								                  	</h3>
								                  </div>
								               </span>
								               <span style="float:left;margin-right:30px;">
								                <div >
								                     <img style="float:left;margin-right:5px;" src="../images/person1.gif">
								                     <div style="float:left;">
								                     	<b>账户授权：</b>
								                     	<p>账户关系绑定<br>
										               	可使用QQ账号直接登录<?=$mymps_global['SiteName']?><br>
										               	</p>
								                     </div>
								                  </div>
								               </span> 
                                        
                                        <?php } else { ?>
                                        
								               <span style="float:left;margin-right:200px;">
								              	<p>
								              		<font style="font-size:18px;color:gray;"><b>未绑定</b></font><br>
								              		账户关系绑定<br>
								               		可使用QQ账号直接登录<?=$mymps_global['SiteName']?><br>
								               	</p>
								               </span>
								               <span class="btn">
								                  <input type="button" value="立即绑定" class="button" onClick="toQzoneLogin();">
								               </span> 
                                        
		<script type="text/javascript">
            var childWindow;
            function toQzoneLogin()
            {
                childWindow = window.open("../include/qqlogin/qq_login.php","TencentLogin","width=450,height=320,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
            } 
            
        </script>
                                        
                                        <?php } ?>
                                        
                                        </div>
                                        
                                    </div>
                            
                                </div>
                                <div class="pfoot"><p><b>-</b></p></div>
                            </div>
                        </div>
                    </div>
    <!-- QQ绑定 end -->
	<!-- 微信绑定 begin -->                
                    <div class="content-main">
                        <div class="content-main-inner">
                             <div class="pwrap setting-password">
                                <div class="phead">
                                	<div class="phead-inner">
                                		<div class="phead-inner">
                                    		<h3 class="ptitle">
                                    			<span>微信绑定</span>
                                    		</h3>
                                    		<BR>
                                		</div>
                                	</div>
                                </div>
                               
                                <div class="pbody">

                                    <div class="formgroup">
                                    	<div class="formrow">
                                    	
                                    		<span style="float:left;margin-right:30px;">
								            	<img src="../include/wxlogin/wx_logo.png">
								            </span>
								               
                                    	<?php if($check_wx || $check_wx_u){ ?>
                                        
								               <span style="float:left;margin-right:200px;">
								                  <div class="bind_okcon">
								                  	<h3>
								                  		<b>您已经成功绑定</b><br>
								                  		<form action="?m=bind" method="post" id="wxform">
                                    						<input name="act" type="hidden" value="wx" />
                                    						<input name="remove" type="hidden" value="1" />
								                  			<input type="button" value="解绑" class="button"  onclick="javascript: if(confirm('确定解除微信账号绑定吗？')) submit(); " >
								                  		</form>
								                  	</h3>
								                  </div>
								               </span>
								               <span style="float:left;margin-right:30px;">
								                <div >
								                     <img style="float:left;margin-right:5px;" src="../images/person1.gif">
								                     <div style="float:left;">
								                     	<b>账户授权：</b>
								                     	<p>账户关系绑定<br>
										               	可使用微信账号直接登录<?=$tfyun_global['SiteName']?><br>
										               	</p>
								                     </div>
								                  </div>
								               </span> 
                                        
                                        <?php } else { ?>
                                        
								               <span style="float:left;margin-right:200px;">
								              	<p>
								              		<font style="font-size:18px;color:gray;"><b>未绑定</b></font><br>
								              		账户关系绑定<br>
								               		可使用微信账号直接登录<?=$tfyun_global['SiteName']?><br>
								               	</p>
								               </span>
								               <span class="btn">
								                  <input onClick="toWeixinLogin();" type="button" value="立即绑定" class="button">
								               </span> 
                                        
		<script type="text/javascript">
            var childWindow;
            function toWeixinLogin()
            {
                childWindow = window.open("../include/wxlogin/bind_wx_login.php","TencentLogin","width=450,height=520,menubar=0,scrollbars=1, resizable=1,status=1,titlebar=0,toolbar=0,location=1");
            } 
            
        </script>
                                        		
                                        <?php } ?>
                                        
                                        </div>
                                        
                                    </div>
                            
                                </div>
                                <div class="pfoot"><p><b>-</b></p></div>
                            </div>
                        </div>
                    </div>
    <!-- 微信绑定 end -->
                    

                    
                </div>
            </div>
            <?php include mymps_tpl('inc_sidebar');?>
        </div>
    </div>
<?php include mymps_tpl('inc_foot');?>
</div>

</body>
</html>