-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreg.html
103 lines (103 loc) · 3.91 KB
/
reg.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>注册</title>
<link rel="icon" href="img/heart.png"/>
<link href="css/bootstrap.css" rel="stylesheet">
<style>
#reg h3{
cursor: pointer;
}
#reg h3 span{
display: inline-block;
background: #F73859;
width: 5px;
height: 5px;
border-radius: 5px;
}
</style>
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="col-xs-6 col-xs-offset-3" style="margin-top: 10%;margin-bottom: 10%;">
<form id="reg" class="form-horizontal">
<h3 class="form-group" style="margin-bottom: 20px" title="首页">HEART<span></span>
</h3>
<div class="form-group has-feedback">
<label class="sr-only" for="uname">用户名</label>
<input name='uname' id="uname" class="form-control" placeholder="请输入用户名" autocomplete="off"/>
<span class="help-block">用户名</span>
<span class="glyphicon form-control-feedback"></span>
</div>
<div class="form-group">
<label class="sr-only" for="upwd">密码</label>
<input type="password" name='upwd' id="upwd" class="form-control" placeholder="请输入密码" autocomplete="off" />
<span class="help-block">密码</span>
</div>
<div class="form-group">
<label class="sr-only" for="ucode">验证码</label>
<input name='vcode' id="ucode" class="form-control" placeholder="请输入验证码" autocomplete="off" style="display: inline-block;width:80%;vertical-align: middle;"/>
<img class="vcode" src="data/vcode.php">
<span class="help-block">验证码</span>
</div>
<div class="form-group">
<input id="btn-reg" type="button" class="form-control btn-primary" value="注册"/>
</div>
<a style="margin-left: -15px" href="index.html">已有账号,返回首页登录</a>
</form>
</div>
</div>
<script src="js/jquery-1.11.3.js"></script>
<script src="js/bootstrap.min.js"></script>
<!--<script src="js/index.js"></script>-->
<script>
$('#reg h3').click(function(){
location.href='index.html';
});
// 验证码
$('img.vcode').click(function(){
this.src='data/vcode.php?_='+Math.random();
});
//登录验证
$('#uname').blur(function(){
var data=$(this).val();
$.ajax({
type: 'get',
url: 'data/uname_confirm.php?uname='+data,
success: function (list) {
if (list.code === 1) {
$('#uname').next('span').html(list.msg);
$('#uname').next().next().removeClass('glyphicon-exclamation-sign').addClass('glyphicon-ok-sign').parent().removeClass('has-warning').addClass('has-success');
$('#btn-reg').click(function(){
var data = $('#reg').serialize();
$.ajax({
type: 'post',
url: 'data/user_reg.php',
data: data,
success: function (list) {
if (list.code === 1) {
$('#ucode').siblings('span').html(list.msg);
location.href = 'index.html';
}else if(list.code===-1){
$('#ucode').siblings('span').html(list.msg);
}
}
})
})
} else if(list.code===0){
$('#uname').next('span').html(list.msg);
$('#uname').next().next().removeClass('glyphicon-ok-sign').addClass('glyphicon-exclamation-sign').parent().removeClass('has-success').addClass('has-warning');
}
}
})
})
</script>
</body>
</html>