-
Notifications
You must be signed in to change notification settings - Fork 0
/
sign-up.php
282 lines (245 loc) · 6.87 KB
/
sign-up.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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<?php
/* Borno CMS
* sign-up.php
* the page help user to sign up
*/
/*
*
* include the function.php
*
*/
include('functions.php');
/*
*
* if user already logged in than die()
*
*/
if(user_logged_in()){
borno_die('Ops! You have already an account! Why you want to another ?');
exit();
}
if(get_the_option("user_can_signup")!='true'){
borno_die("You can not register.");
exit();
}
/*
*
* if already created a account.[COOKIE]
*
*
*/
//user can creat account only one times on one browser . by cookie
if(isset($_COOKIE['accountcount']) and $_COOKIE['accountcount']==0){
$inTwoMonths = 60 * 60 * 24 * 60 + time();
setcookie('accountcount', 1, $inTwoMonths);
}
////////////////////////////////////////////////////////////////////
if(isset($_COOKIE['accountcount']) and $_COOKIE['accountcount']==1){
borno_die('You already created a account in this site. You can not create another account form this computer.');
}
//*sign up page
echo '<!DOCTYPE html>';
echo '<head>';
echo '<meta charset="UTF-8">';
echo '<link rel="stylesheet" href="';
echo get_the_option('site_address');
echo '/assets/bootstrap/bootstrap.css" />';
echo '<link rel="stylesheet" href="';
echo get_the_option('site_address');
echo '/assets/css/core.css" />';
echo '<title>Sign Up</title>';
/*
*
*
* if user can not sign up than die();
*
*
*/
if(get_the_option('user_can_signup')==false){
die('<div class="alert alert-warning container"><center>Creating new account is currently disable.</center></div>');
}
echo '<script src="';
echo get_the_option('site_address');
echo '/assets/javascript/jquery.js"></script>';
echo '<script src="';
echo get_the_option('site_address');
echo '/assets/javascript/bootstrap.min.js"></script>';
echo '<meta name="robots" content="noindex, nofollow" />';
echo '<title>Sign Up</title>';
echo '<body>';
if(isset($_GET['reg_success'])){
/*echo '<div class="form-signup">';
echo '<div class="alert alert-success">We sent a varification mail in your mail address. Please check it in your inbox and verify the account</div>';
echo '</div>';*/
if(isset($_SESSION['signupproblem'])){
echo $_SESSION['signupproblem'];
unset ($_SESSION['signupproblem']);
}
else
echo '<div class="form-signup">Access denied</div>';
{}
die();
}
//javascript custom
?>
<script type="text/javascript">
function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2)
{alert(alerttxt);return false;}
else {}
}
}
function validate_username(field,alerttxt)
{
with (field)
{
apos=value.length;
dotpos=value.lastIndexOf(" ");
if (apos<4||apos>12||dotpos>0)
{alert(alerttxt);return false;}
else {}
}
}
function validate_name(field,alerttxt)
{
with (field)
{
apos=value.length;
dotpos=value.lastIndexOf(" ");
if (apos<4||dotpos<1)
{alert(alerttxt);return false;}
else {}
}
}
function validate_pass(field,alerttxt)
{
with (field)
{
apos=value.length;
if (apos<8||dotpos>12)
{alert(alerttxt);return false;}
else {}
}
}
function validate_repass(field,alerttxt)
{
with (field)
{
apos=value.length;
if (apos<8||dotpos>12)
{alert(alerttxt);return false;}
else {}
}
}
////password match
function validate_a_pass(fld){
with(fld){
abc = value;
return abc;
}
}
function validate_b_pass(fld){
with(fld){
abc = value;
return abc;
}
}
//password match end
function validate_form(thisform)
{
with (thisform)
{
if (validate_email(email,"Not a valid e-mail address!")==false)
{email.focus();return false;}
if (validate_username(username,"Invalid Username || You must have to entry bigger than 4 letter and less than 12 letter || No space allowed")==false)
{username.focus();return false;}
if (validate_name(fullname,"Invalid Name || You Must entry Your Full Username")==false)
{fullname.focus();return false;}
if (validate_pass(password,"You must inset 8-12 letter password")==false)
{password.focus();return false;}
if (validate_a_pass(password)!=validate_b_pass(repassword))
{password.focus();alert('password not match');return false;}
if(document.getElementById("checkboxagree").checked==true){
//alert('true');
}else{alert('You must have to be ready to register');return false;}
}
}
function show_password(){
var password_fild=document.getElementById('password')
var repassword_fild=document.getElementById('repassword')
var submit_fild=document.getElementById('submitb')
if(document.getElementById('submitb').value!='convertpass'){
password_fild.type='text';
repassword_fild.type='text';
submit_fild.value='convertpass';
submit_fild.class='label label-warning';
submit_fild.innerHTML ='Hide Password';
}
else{
password_fild.type='password';
repassword_fild.type='password';
submit_fild.value='';
submit_fild.innerHTML ='Show Password';
}
}
</script>
<?php
// js custom end
//form
echo '<form method="POST" class="form-signup" action="progress.php?signup" onsubmit="return validate_form(this);">';
//progress
if(isset($_SESSION['signupproblem'])){
//echo and unset the message
echo $_SESSION['signupproblem'];
unset ($_SESSION['signupproblem']);
}
if(isset($_SESSION['signup_done'])){
//if the signup is done than get out
unset($_SESSION['signup_done']);
die();
}
//captcha
$string = '';
for ($i = 0; $i < 2; $i++) {
// this numbers refer to numbers of the ascii table (lower case)
$string .= chr(rand(97, 122));
}
//
$string = rand(10,99).$string;
$_SESSION['rand_code']= $string;
?>
<b><h4>Signup</h4></b> <hr>
<label for="fullname">Full Name</label>
<input id="fullname" type="text" class="span4" name="fullname" value="<?php if(isset($_GET['fullname'])){echo $_GET['fullname'];}?>"/>
<label for="username">Username</label>
<input id="username" type="text" class="span4" name="username" value="<?php if(isset($_GET['username'])){echo $_GET['username'];}?>"/>
<label for="email">Email</label>
<input id="email" type="text" class="span4" name="email" value="<?php if(isset($_GET['email'])){echo $_GET['email'];}?>"/>
<label for="password">Password <span class="label label-success" id="submitb" onclick="show_password()">Show Password</span>
</label>
<input type="hidden" id="changebottom" value=""/>
<input id="password" type="password" class="span4" name="password"/>
<label for="repassword">Retype Password</label>
<input id="repassword" type="password" class="span4" name="repassword"/>
<hr><b>Fill the captcha</b><br>
<label for="captchaform"><img src="<?php echo get_the_option('site_address'); ?>/include/function/captcha.php" class="img-polaroid" /></label>
<input id="captchaform" type="text" class="span4" name="captchaform"/>
<hr>
<label class="checkbox">
<input type="checkbox" id="checkboxagree" name="checkboxagree" >
<?php
if(!defined("condition_to_register")){
print("I am ready to sign up");
}else{
echo condition_to_register ;
}
?>
</label>
<input type="submit" class="btn btn-success float-right" name="signup" value="Submit" />
<br>
</form>