McAccount/View/register.php

151 lines
5.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html class="login-bg">
<head>
<title><?=$title?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
<!-- bootstrap -->
<link href="View/public/css/bootstrap/bootstrap.css" rel="stylesheet" />
<link href="View/public/css/bootstrap/bootstrap-responsive.css"
rel="stylesheet" />
<link href="View/public/css/bootstrap/bootstrap-overrides.css"
type="text/css" rel="stylesheet" />
<!-- global styles -->
<link rel="stylesheet" type="text/css" href="View/public/css/layout.css" />
<link rel="stylesheet" type="text/css"
href="View/public/css/elements.css" />
<link rel="stylesheet" type="text/css" href="View/public/css/icons.css" />
<!-- libraries -->
<link rel="stylesheet" type="text/css"
href="View/public/css/lib/font-awesome.css" />
<!-- this page specific styles -->
<link rel="stylesheet" href="View/public/css/compiled/signup.css"
type="text/css" media="screen" />
<!--[if lte IE 6]><script>alert('请升级浏览器 如:Chrome,Firefox!')</script><![endif]-->
<!--[if lte IE 7]><script>alert('请升级浏览器 如:Chrome,Firefox')</script><![endif]-->
<!--[if lte IE 8]><script>alert('请升级浏览器 如:Chrome,Firefox')</script><![endif]-->
<!--[if lte IE 9]><script>alert('请升级浏览器 如:Chrome,Firefox')</script><![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div class="header">
<a href="index.html"> <img src="View/public/img/logo.png" class="logo" />
</a>
</div>
<div class="row-fluid login-wrapper col-xs-12 col-md-12 col-lg-12">
<div class="box">
<div class="content-wrap">
<h6>注册中心</h6>
<input class="span12" type="text" placeholder="用户帐号" id="username" />
<input class="span12" type="password" placeholder="游戏密码"
id="password"> <input class="span12" type="text" placeholder="邮箱地址"
id="email" />
<div class="action">
<button type="button" id="register" class="btn btn-primary signup">注册属于你的Mc帐号</button>
</div>
</div>
</div>
<div class="span4 already">
<p>已经有了帐号?</p>
<a href="<?=Url('index','login')?>">点击这里登陆</a>
</div>
</div>
<!-- scripts -->
<script src="View/public/js/jquery-1.7.2.min.js"></script>
<script src="http://libs.useso.com/js/jquery/1.8.3/jquery.min.js"></script>
<!--
<script src="View/public/js/jquery-latest.js"></script>-->
<script src="View/public/js/bootstrap.min.js"></script>
<script src="View/public/js/theme.js"></script>
<script type="text/javascript">
$("#register").click(function(){
var Regex = /^(?:\w+\.?)*\w+@(?:\w+\.)*\w+$/;
var Regex1 = /^[a-zA-Z0-9_?]*$/;
var username = $("#username");
var pass = $("#password");
var email = $("#email");
if(username.val()==""){
alert("用户名不能为空!");
return false;
}
if(username.val().length < 3){
alert("帐号长度不得低于3位");
return;
}
if(username.val().length > 10){
alert("帐号长度不得超过10位");
return false;
}
if(pass.val()==""){
alert("密码不能为空!");
return false;
}
if(pass.val().length < 6){
alert("密码强度不能低于6位");
return false;
}
if(email.val()==""){
alert("邮箱不能为空!");
return false;
}
if(!Regex1.test(username.val())){
alert("帐号必须以小写字母+数字+下划线组成");
return;
}
if(!Regex.test(email.val())){
alert("邮箱格式不对");
$('#email').val("");
return false;
}
$.ajax({ url:"<?=Url('user_public','user_check')?>", type:"GET", data:{user:username.val()}, dataType:"json",
success:function(rdata){
alert("checkusersuccess");
switch(rdata.status){
case "success":
$.ajax({url:"<?=Url('user_public','mail_check')?>", type:"GET", data:{mail:email.val()}, dataType:"json",
success:function(s){
alert("checkmail");
switch(s.status){
case "success":
$.ajax({
type:"POST", data:{user:username.val(), mail:email.val(),pass:pass.val()}, dataType:"json", url:"<?=Url('user_public','register')?>",
success:function(C){
alert("reg");
switch(C.status){
case "success":
alert(C.info);
location.href = "<?=Url('index','index')?>";
break;
case "error":
alert(A.info);
break;
}
}
})
break;
case "error":
alert(s.info);
return false;
}
}
})
break;
case "error":
alert(rdata.info);
return false;
}
},
error:function(){
alert("checkusererror");
})
})
</script>
</body>
</html>