-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform_registration.php
203 lines (177 loc) · 7.31 KB
/
form_registration.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
<?php session_start(); ?>
<?php require_once('header.php') ?>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
function checknickname()
{
var name=document.getElementById( "nickname" ).value;
if(name)
{
$.ajax({
type: 'post',
url: 'registration_checkdata.php',
data: {
nickname:name,
},
success: function (response) {
$( '#nickname_status' ).html(response);
if(response=="OK")
{
return true;
}
else
{
return false;
}
}
});
}
else
{
$( '#nickname_status' ).html("");
return false;
}
}
function checkemail()
{
var usr_email=document.getElementById( "email" ).value;
if(usr_email)
{
$.ajax({
type: 'post',
url: 'registration_checkdata.php',
data: {
email:usr_email,
},
success: function (response) {
$( '#email_status' ).html(response);
if(response=="OK")
{
return true;
}
else
{
return false;
}
}
});
}
else
{
$( '#email_status' ).html("");
return false;
}
}
function checkall()
{
var namehtml=document.getElementById("nickname_status").innerHTML;
var emailhtml=document.getElementById("email_status").innerHTML;
if((namehtml && emailhtml)=="OK")
{
return true;
}
else
{
return false;
}
}
</script>
<body>
<div class="brand">Best Friend Ever</div>
<div class="address-bar">Everything about dogs</div>
<?php include 'navigation.php' ?>
<div class="container">
<div class="row">
<div class="box">
<div class="col-lg-12">
<hr>
<h2 class="intro-text text-center">Registration
<strong>form</strong>
</h2>
<hr>
<p class="text-center">All the fields below are required.
<br>After registration you can log in and start writing articles and comments.<br>
Also you will be able to read comments of other users.</p>
<hr>
<h1> </h1>
<!--for testing purpose only -->
<!-- <div class="bs-callout bs-callout-warning hidden">-->
<!-- <h4>This form seems to be invalid!</h4>-->
<!-- </div>-->
<!---->
<!-- <div class="bs-callout bs-callout-info hidden">-->
<!-- <h4>Yay! Everything seems to be ok.</h4>-->
<!-- </div>-->
<form id="registration" role="form" action="addUser.php" data-parsley-validate="" method="post" onkeyup="return checkall();">
<div class="row">
<!-- Full Name -->
<div class="form-group col-lg-4">
<label for="username">Full Name *</label>
<input type="text" name="username" id="username" class="form-control" data-parsley-pattern="/^[a-zA-Z .'-]+$/i" required="">
</div>
<p><br><small>Your full name will not be shared.</small></p>
<div class="clearfix"></div>
<!-- Nickname -->
<div class="form-group col-lg-4">
<label for="nickname">Nickname *</label>
<input type="text" name="nickname" id="nickname" class="form-control"
data-parsley-pattern="/^[a-zA-Z0-9.'-]+$/i" required="" onkeyup="checknickname();">
<span id="nickname_status"></span>
</div>
<p><br><small>How do you prefer being called? This name will be posted under your articles and comments.</small></p>
<div class="clearfix"></div>
<!-- Email -->
<div class="form-group col-lg-4">
<label for="email">Email *</label>
<input type="email" name="email" id="email" class="form-control" data-parsley-type="email"
required="" onkeyup="checkemail();">
<span id="email_status"></span>
</div>
<p><br><small>Your email address will be used as your login.</small></p>
<div class="clearfix"></div>
<!-- Password -->
<div class="form-group col-lg-4">
<label for="pwd">Your password *</label>
<input type="password" name="password" id="pwd" class="form-control" required=""
data-parsley-trigger="keyup" data-parsley-minlength="8" data-parsley-maxlength="12"
data-parsley-minlength-message="Enter at least 8 characters"
data-parsley-validation-threshold="1">
</div>
<p><br><small>8-12 symbols long, letters and numbers only.</small></p>
<div class="clearfix"></div>
<!-- Password confirmation-->
<div class="form-group col-lg-4">
<label for="pwd_match">Please confirm your password *</label>
<input type="password" name="password_match" id="pwd_match" class="form-control" required=""
data-parsley-trigger="keyup" data-parsley-minlength="8" data-parsley-maxlength="12"
data-parsley-minlength-message="Enter at least 8 characters"
data-parsley-validation-threshold="1" data-parsley-equalto="#pwd">
</div>
<div class="form-group col-lg-12">
<!-- <input type="hidden" name="addUsr" value="user">-->
<input type="submit" class="btn btn-primary" value="Submit">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- /.container -->
<?php include 'footer.html' ?>
<?php include 'Scripts.html' ?>
<!-- form validation scripts -->
<script type="text/javascript">
$(function () {
$('#registration').parsley().on('field:validated', function() {
var ok = $('.parsley-error').length === 0;
$('.bs-callout-info').toggleClass('hidden', !ok);
$('.bs-callout-warning').toggleClass('hidden', ok);
})
.on('form:submit', function() {
return true;
});
});
</script>
</body>
</html>