-
Notifications
You must be signed in to change notification settings - Fork 0
/
index1.php
248 lines (219 loc) · 7.4 KB
/
index1.php
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<!DOCTYPE html>
<html>
<head>
<?php require("/public/php/require.php") ?>
<script type="text/javascript">
$(document).ready(function () {
$('#myModal').modal('toggle');
$('#login').click(clickLogin);
$('#register').click(clickRegister);
});
function clickLogin(){
}
var count = 5;
function clickRegister(){
$("input#user_email").blur(function(){
var user_email = $("input#user_email").val();
if (user_email == ""){ // 如果email为空,则输出提示
$("#user_email_error").text("对不起,Email不能为空!");
$("#user_email").focus(function(){
$("#user_email").text("");
});
count++;
}else{
count--;
}
check();
});
$("input#user_password").blur(function(){
var user_password = $("#user_password").val();
if (user_password == ""){ // 如果密码为空,则输出提示
$("#user_password_error").text("对不起,密码不能为空!");
$("input#user_password").focus(function(){
$("#user_password_error").text("");
});
count++;
}else{
count--;
}
check();
});
$("input#re_user_password").blur(function(){
var user_password = $("input#user_password").val(); //获取用户输入的密码
var re_user_password = $("input#re_user_password").val();
if (user_password != re_user_password){
$("#re_user_password_error").text("对不起,两次输入的密码不一致!");
$("input#re_user_password").focus(function(){
$("#re_user_password_error").text("");
});
count++;
}else{
count--;
}
check();
});
$("input#user_name").blur(function(){
var user_name = $("input#user_name").val();
if (user_name == ""){
$("#user_name_error").text("对不起,名字不能为空!");
$("input#user_name").focus(function(){
$("#user_name_error").text("");
});
count++;
}else{
count--;
}
check();
});
$("input#user_phone").blur(function(){
var user_phone = $("input#user_phone").val(); //获取用户输入的电话
if (user_phone == ""){ // 如果为空,则输出提示信息
$("#user_phone_error").text("对不起,电话不能为空!");
$("input#user_phone").focus(function(){
$("#user_phone_error").text("");
});
count++;
}else{
count--;
}
check();
});
function check(){
if (count == 0){
unlockSubmit();
}else{
lockSubmit();
}
}
function unlockSubmit(){
$("button#submit").attr("class", "btn btn-primary active");
}
function lockSubmit(){
$("button#submit").attr("class", "btn btn-primary disabled");
}
$("button#reset").click(function(){
$("input#reset").click();
count = 5;
lockSubmit();
});
}
/* function onMouseOver(){
var user_email = $("input#user_email").val();
var user_password = $("input#user_password").val();
var re_user_password = $("input#re_user_password").val();
var user_name = $("input#user_name").val();
var user_phone = $("input#user_phone").val();
if (user_password != re_user_password){ //比较密码,不正确就报错!
alert("对不起,两次输入的密码不一致!");
}
if (user_email=="" || user_name=="" || user_phone=="" || user_password=="" || re_user_password==""){
alert("表单未填写完整,请重试!");
}
}*/
$("button#submit").click(function(){
var user_email = $("input#user_email").val();
var user_password = $("input#user_password").val();
var re_user_password = $("input#re_user_password").val();
var user_name = $("input#user_name").val();
var user_phone = $("input#user_phone").val();
$.post(url,
{
user_email: user_email,
user_password: user_password,
user_repassword: user_repassword,
user_name: user_name,
user_phone: user_phone
},
function(data, status){
alert("Data: "+data + "\n" + "Status: "+status);
}
);
});
</script>
</head>
<body>
<!-- Modal -->
<div class="modal fade bg-info" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog bg-info">
<div class="modal-content">
<div class="modal-header bg-info">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<ul class="nav nav-tabs bg-info">
<li role="presentation" class="active"><a class="btn btn-info" id="login" href="#tab_login" data-toggle="tab">登录</a></li>
<li id="register" role="presentation"><a class="btn btn-info" href="#tab_register" data-toggle="tab">注册</a></li>
</ul>
</div>
<div class="modal-body bg-info">
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="tab_login">
<form class="form-group" action="http://thinktank.awa.vc/index.php/Home/User/userlogin" method="post">
<div class="form-group">
<label for="email">Email:</label>
<input type="input" class="form-control" id="email" name="user_email">
</div>
<div class="form-group">
<label for="password">密 码:</label>
<input type="password" class="form-control" id="password" name="user_password">
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="remember" name="remember">记住密码
</label>
</div>
<button type="submit" class="btn btn-primary">登 录</button>
</form>
</div>
<div role="tabpanel" class="tab-pane" id="tab_register">
<form class="form-group">
<div class="form-group">
<span class="text-danger"> *</span>
<label for="user_email">Email:</label>
<span id="user_email_error" class="text-warning"></span>
<input type="input" class="form-control" id="user_email" name="user_email">
</div>
<div class="form-group">
<span class="text-danger"> *</span>
<label for="user_password">密 码:</label>
<span id="user_password_error" class="text-warning"></span>
<input type="password" class="form-control" id="user_password" name="user_password">
</div>
<div class="form-group">
<span class="text-danger"> *</span>
<label for="re_user_password">再次输入密码:</label>
<span id="re_user_password_error" class="text-warning"></span>
<input type="password" class="form-control" id="re_user_password" name="repassword">
</div>
<div class="form-group">
<span class="text-danger"> *</span>
<label for="user_name">用户名</label>
<span id="user_name_error" class="text-warning"></span>
<input type="input" class="form-control" id="user_name" name="user_name">
</div>
<div class="form-group">
<span class="text-danger"> *</span>
<label for="user_phone">手机号</label>
<span id="user_phone_error" class="text-warning"></span>
<input type="input" class="form-control" id="user_phone" name="user_phone">
</div>
<div class="row">
<div class="col-sm-3 col-sm-offset-2">
<button id="submit" class="btn btn-primary disabled">确认注册</button>
</div>
<div class="col-sm-3 col-sm-offset-2">
<button id="reset" class="hidden">重新填写</button>
<button type="reset" id="reset" class="btn btn-primary">重新填写</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!--<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">先不登录</button>
<button type="button" class="btn btn-primary">登录</button>
</div>-->
</div>
</body>
</html>