<{import file="index/reg_header.html" title="找回密码"}>
<style type="text/css"> 
.main_bar{ padding:80px 0 150px 0; } 
.main{ width:380px; } 
/* 顶部 */
.bname{ width:380px; float:left; }
.bname span{ width:100%; text-align:center; font-size:26px; padding:0 0 20px 0; font-weight:bold; color:#333;  float:left; } 
</style> 
<div class="main_bar">
	<div class="main"> 
		<div class="bname"><span>重置密码</span></div>
		<form> 
			<div class="rbox">
				<div id="error_msg" style="display:none;"></div> 
				<div class="rbox_input">
					<span>手机号码</span>
					<input type="text" name="username" class="input1" placeholder="请输入手机号"/> 
				</div>
				<div class="rbox_input">
					<span>验证码</span>
					<input type="text" name="vcode" class="input2" size="10" maxlength="5"/> 
					<a href="javascript:;"><img id="vcode" src="index.php?m=ajax&a=vcode"/></a> 
				</div> 
				<div class="rbox_input">
					<span>短信校验码</span>
					<input type="text" name="sms_code" id="sms_code" class="input2" 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>
</div> 
<{include file="index/footer.html"}> 
<script type="text/javascript">
$(function(){
	$('form').submit(function(){
		username = $('input[name=username]').val();
		if(username == ''){	
			$("#error_msg").show().html('请输入手机号码');  return false;
		}
		if(!username.match(/^(?:13\d|15\d|18\d)\d{5}(\d{3}|\*{3})$/)){
		 	$("#error_msg").show().html('请输入正确的手机号码');  return false;
		}
		sms_code = $('input[name=sms_code]').val(); 
		if(sms_code == ''){ 
			$("#error_msg").show().html('短信验证码不能为空');  return false; 
		} 
		$.ajax({
			type:'POST',
			url:'member.php?m=index&a=forget_check',
			data:{username:username, sms_code:sms_code}, 
			success:function(result){
				var data = jQuery.parseJSON(result); 
				if(data.error == 0){
					location.href="member.php?m=index&a=forget_reset";
				}else{ 
					$.alert(data.msg);
					$(".submit_reg").attr("disabled",false);  
				}
			},
			error:function(){
				$.alert('系统繁忙');
			}
		});
		return false; 
	}); 
	// 获得验证码 
	$("#zphone").click(function(){
		var mobile = $('input[name=username]').val();  
		var vcode = $('input[name=vcode]').val(); 
		send_sms(mobile, vcode, '#zphone', '1');
	}); 
});


</script>
