<{import file="index/reg_header.html" title="会员注册"}> 
<div class="main_bar" style="margin:50px 0;"> 
	<div class="main"> 
		<div class="reg_left">
<form action="#" method="post"> 
			<div class="reg_bname"><span>用户注册</span></div>
			<div class="reg_bcon">
				<div id="error_msg" style="display:none;"></div>
				<div class="rbox_input">
					<span>手机号码</span>
					<input type="text" name="username" class="input1" placeholder="手机不能为空" value=""/> 
				</div>
				<div class="rbox_input">
					<span>登录密码</span>
					<input type="password" name="password" class="input1" placeholder="密码位数不能低于6位" /> 
				</div>
				<div class="rbox_input">
					<span>确认密码</span>
					<input type="password" name="repasswd" class="input1" placeholder="需要与上一步的密码一致" /> 
				</div>
				<div class="rbox_input">
					<span>验证码</span>
					<input type="text" name="vcode" id="vcode" class="input2" size="10" maxlength="6"/> 
					<a href="javascript:;"><img id="vcode" src="index.php?m=ajax&a=vcode"/></a> 
				</div>
				<div class="rbox_input tbsms">
					<span>短信验证码</span>
					<input type="text" name="smscode" class="input2" id="smscode" placeholder="手机验证码" maxlength="6"/>
					<input id="zphone" type="button" value="获取手机验证码"> 
				</div>
				<div class="rbox_sub"><input type="submit" name="submit" class="submit_reg" value="注 册"/></div> 
				
			</div>
</form>
			<div class="reg_other">
				<a href="?a=login">已有账号，立即登陆</a> 
				<a href="?a=forget">忘记密码</a> 
			</div>
		</div>
		<div class="reg_right">
			<{uqcms m="api" v="conn" c="login_list"}> 
			<{if $conn}>
				<div class="sub_frm2">
					<h3>快捷方式登录</h3>
					<div class="sub_con2">
						<{foreach item=i from=$conn}> 
							<a href="member.php?a=connect&alias=<{$i.alias}>&state=<{math equation=rand(0,10000)}>" class="connect">
								<img src="<{$__PUBLIC__}>images/connect/32<{$i.alias}>.png">
								<span><{$i.name}></span>
							</a>
						<{/foreach}> 
					</div>
				</div>  
			<{/if}>
		</div>
		
	</div> 
</div>
<{include file="index/footer.html"}> 
<script type="text/javascript">
$(function(){ 
	$("form").submit(function(){ 
		var smscode = $('input[name=smscode]').val(); 
		if(smscode == ''){
			$("#error_msg").show().html('手机验证码不能为空'); return false;
		}
		var username = $('input[name=username]').val();
		if(username == ''){
			$("#error_msg").show().html('电话号码不能为空'); return false;
		}
		var password = $('input[name=password]').val(); 
		var repasswd = $('input[name=repasswd]').val(); 
		if(password == ''){ $.alert('密码不能为空');  return false;} 
		if(repasswd == ''){ $.alert('重复密码不能为空'); return false;}
		if(password != repasswd){ $.alert('两次密码输入不一致'); return false; }
		
		$.ajax({
			type:'POST',
			url:'member.php?a=do_register',
			data:{username:username, password:password, repasswd:repasswd, smscode:smscode}, 
			success:function(result){
				var data = jQuery.parseJSON(result); 
				if(data.error == '0'){
					window.location.href="member.php"; 
				}else{
					$("#error_msg").show().html(data.msg); 
					freshVcode();
					return false;
				}
			},
			error:function(){
				$.alert('系统繁忙');
			}
		}); 
		return false;
	});
	// 检测账号是否存在
	function checkMobileIsExist(){
		var mobile = jQuery("#username").val();
		var flag = true;
		jQuery.ajax({ 
			url:"?a=check_mobile&t="+(new Date()).getTime(),
			data:{mobile:mobile},
			dataType:"json",
			type:"GET",
			async:false,
			success:function(data) {
				var status = data.status;
				if(status == "0"){
					flag = false;
				}
			}
		});
		return flag;
	}
	// 获得验证码 
	$("#zphone").click(function(){
		var mobile = $('input[name=username]').val();  
		var vcode = $('input[name=vcode]').val(); 
		send_sms(mobile, vcode, '#zphone', '2');
	});  
}); 

</script>