1
0
mirror of https://e.coding.net/circlecloud/McAccount.git synced 2024-11-17 00:58:57 +00:00
McAccount/View/register.php

148 lines
5.3 KiB
PHP
Raw Normal View History

2015-10-13 06:26:47 +00:00
<!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="<?=Url('index','index')?>"> <img src="View/public/img/logo.png" class="logo" />
2015-10-13 06:26:47 +00:00
</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 RegexEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)*\w+$/;
var RegexUserName = /^[a-zA-Z0-9_?]*$/;
2015-10-13 06:26:47 +00:00
var username = $("#username");
var pass = $("#password");
var email = $("#email");
if(username.val()==""){
alert("用户名不能为空!");
2015-10-13 06:26:47 +00:00
return false;
}
if(username.val().length < 3){
alert("帐号长度不得低于3位!");
2015-10-13 06:26:47 +00:00
return;
}
if(username.val().length > 10){
alert("帐号长度不得超过10位!");
2015-10-13 06:26:47 +00:00
return false;
}
if(pass.val()==""){
alert("密码不能为空!");
2015-10-13 06:26:47 +00:00
return false;
}
if(pass.val().length < 6){
alert("密码强度不能低于6位!");
2015-10-13 06:26:47 +00:00
return false;
}
if(email.val()==""){
alert("邮箱不能为空!");
2015-10-13 06:26:47 +00:00
return false;
}
if(!RegexUserName.test(username.val())){
alert("帐号必须以小写字母+数字+下划线组成!");
2015-10-13 06:26:47 +00:00
return;
}
if(!RegexEmail.test(email.val())){
alert("邮箱格式不正确!");
2015-10-13 06:26:47 +00:00
$('#email').val("");
return false;
}
2015-10-13 07:05:23 +00:00
$.ajax({ url:"<?=Url('user_public','user_check')?>", type:"GET", data:{user:username.val()}, dataType:"json",
success:function(rdata){
switch(rdata.status){
case "success":
$.ajax({url:"<?=Url('user_public','mail_check')?>", type:"GET", data:{mail:email.val()}, dataType:"json",
success:function(s){
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){
switch(C.status){
case "success":
alert(C.info);
location.href = "<?=Url('index','login')?>";
2015-10-13 07:05:23 +00:00
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("注册失败 请检查网络是否通畅!");
}})
})
2015-10-13 06:26:47 +00:00
</script>
</body>
</html>