-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathregistration.php
More file actions
361 lines (340 loc) · 10 KB
/
Copy pathregistration.php
File metadata and controls
361 lines (340 loc) · 10 KB
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<?php
include_once("includes/db_connect.php");
session_start();
if(isset($_GET['city']))
{
//echo $_GET['city'];
$_SESSION['city']=$_GET['city'];
//echo $_SESSION['city'];
}
else if(isset($_SESSION['city']))
{
header("Location:registration.php?city=$_SESSION[city]");
unset($_SESSION['city']);
$_SESSION['city']=="";
//exit();
//echo "<script>window.location.href = 'women.php?city=$_SESSION[city]';</script>";
}
if(isset($_POST['sub']) && $_POST['sub']=="Create Account")
{
if(isset($_SESSION['uname']))
{
header('Location:card-types.php');
}
$name=mysql_real_escape_string(trim($_POST['cname']));
$remail=mysql_real_escape_string(trim($_POST['remail']));
$rmobile=mysql_real_escape_string(trim($_POST['rmobile']));
$gender=$_POST['gender'];
$city=mysql_real_escape_string(trim($_POST['rcity']));
$pass=md5(mysql_real_escape_string(trim($_POST['pass'])));
$terms=$_POST['cterms'];
//echo "$name<br/>$remail<br/>$gender<br/>$pass<br/>$terms";
if($name=="" || $remail=="" || $pass=="")
{
echo '<script> alert("Please Enter Valid Details")</script>';
header('Refresh:0.0005; url=registration.php');
}
$search_user=mysql_query("select * from users where email='{$remail}'");
$srows=mysql_num_rows($search_user);
$search_mobile=mysql_query("select * from users where mobile='{$rmobile}'");
$mrows=mysql_num_rows($search_mobile);
if($srows!=0 && $mrows!=0)
{
echo '<script> alert("Email Id and Mobile Number Already Registered With Us")</script>';
//header('Refresh:0.0005; url=registration.php');
echo '<script language="JavaScript"> window.location.href ="registration.php" </script>';
}
else if($srows!=0)
{
echo '<script> alert("Email Id Already Registered With Us")</script>';
//header('Refresh:0.0005; url=registration.php');
echo '<script language="JavaScript"> window.location.href ="registration.php" </script>';
}
else if($mrows!=0)
{
echo '<script> alert("Mobile Number Already Registered With Us")</script>';
//header('Refresh:0.0005; url=registration.php');
echo '<script language="JavaScript"> window.location.href ="registration.php" </script>';
}
else
{
$user_insert=mysql_query("insert into users (full_name, email, pass, gender, mobile, terms, city, rdate, apply_status) values ('$name', '$remail', '$pass', '$gender', '$rmobile', '$terms', '$city', curdate(), 'no')");
if($user_insert)
{
$id=mysql_insert_id();
/*if($id > '9999')
{
$cadd='000000';
}
elseif($id > '99999')
{
$cadd='00000';
}
else if($id > '999999')
{
$cadd='0000';
}
else
{
$cadd='0000000';
}*/
$userid="UID".$id;
$user_update=mysql_query("update users set userid='$userid' where sno='{$id}'");
if($user_update)
{
echo '<script> alert("Congrats You Almost Done. Please Login To Buy Discount Card")</script>';
header('Refresh:0.0005; url=registration.php');
}
}
}
}
if(isset($_POST['sub']) && $_POST['sub']=="Sign In")
{
if(isset($_SESSION['uname']))
{
header('Location:card-types.php');
}
$lmail=mysql_real_escape_string(trim($_POST['loginmail']));
$lpass=mysql_real_escape_string(md5(trim($_POST['loginpass'])));
if($lmail=="" || $lpass=="")
{
header('Location:index.php');
}
else
{
$check_user=mysql_query("select * from users where email='{$lmail}' and pass='{$lpass}'");
$crows=mysql_num_rows($check_user);
if($crows==1)
{
$data=mysql_fetch_array($check_user);
$_SESSION['uname']=$data[2];
header('Location:card-types.php');
}
else
{
echo '<script> alert("Invalid Login Details")</script>';
}
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Discounts Ka Mall - Registration</title>
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<!-- jQuery (necessary JavaScript plugins) -->
<script type='text/javascript' src="js/jquery-1.11.1.min.js"></script>
<!-- Custom Theme files -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<!-- Custom Theme files -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!--webfont-->
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<!-- start menu -->
<link href="css/megamenu.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/megamenu.js"></script>
<script>$(document).ready(function(){$(".megamenu").megamenu();});</script>
<script src="js/menu_jquery.js"></script>
<script type="text/javascript">
$(function(){
$("#city").change(function(){
window.location='http://www.discountkamall.com/registration.php?city=' + this.value
});
});
</script>
<script type="text/javascript">
function valid_details()
{
var con1=/^[a-zA-Z0-9\_\.]+\@[a-zA-Z\.]+\.([a-z]{2,4})$/;
var con2=/^[789]\d{9}$/;
if(document.getElementById('cname').value=="")
{
alert("Please Enter Your Name");
document.getElementById('cname').focus();
return false;
}
else if(document.getElementById('cname').value.length < 3)
{
alert("Please Enter Valid Name");
document.getElementById('cname').focus();
return false;
}
if(document.getElementById('remail').value=="")
{
alert("Please Enter Your Email Id");
document.getElementById('remail').focus();
return false;
}
else if(!document.getElementById('remail').value.match(con1))
{
alert("Please Enter Valid Email Id");
document.getElementById('remail').focus();
return false;
}
if(document.getElementById('rmobile').value=="")
{
alert("Please Enter Your Mobile Number");
document.getElementById('rmobile').focus();
return false;
}
else if(!document.getElementById('rmobile').value.match(con2))
{
alert("Please Enter Valid Mobile Number");
document.getElementById('rmobile').focus();
return false;
}
if(document.getElementById('rcity').value=="")
{
alert("Please Select Your City");
return false;
}
if(document.getElementById('pass').value=="")
{
alert("Please Enter Password");
document.getElementById('pass').focus();
return false;
}
else if(document.getElementById('pass').value.length < 6)
{
alert("Password should contain atleast 6 characters");
document.getElementById('pass').focus();
return false;
}
if(document.getElementById('rpass').value=="")
{
alert("Please Retype Password");
document.getElementById('rpass').focus();
return false;
}
if(document.getElementById('pass').value!=document.getElementById('rpass').value)
{
alert("Password and Retype Password Not Matching");
document.getElementById('rpass').focus();
return false;
}
if(document.getElementById('cterms').checked==false)
{
alert("Please Agree Terms of Service To Register");
return false;
}
}
</script>
<style>
.myselect{
padding:8px;
display:block;
width:100%;
outline:none;
font-weight:normal;
border: 1px solid rgb(231, 231, 231);
}
</style>
</head>
<body>
<!-- header_top -->
<?php include_once('header.php'); ?>
<!-- content -->
<div class="container">
<div class="main">
<!-- start registration -->
<div class="registration">
<div class="registration_left">
<h2>New user? <span> create an account </span></h2>
<!-- [if IE]
< link rel='stylesheet' type='text/css' href='ie.css'/>
[endif] -->
<!-- [if lt IE 7]>
< link rel='stylesheet' type='text/css' href='ie6.css'/>
<! [endif] -->
<div class="registration_form">
<!-- Form -->
<form id="" action="" method="post" onsubmit="return valid_details();">
<div>
<label>
<input placeholder="Your Name" type="text" name="cname" id="cname">
</label>
</div>
<div>
<label>
<input placeholder="Your Email Id" type="text" name="remail" id="remail">
</label>
</div>
<div>
<label>
<input placeholder="Your Mobile Number" type="text" name="rmobile" id="rmobile">
</label>
</div>
<div class="sky-form">
<div class="sky_form1">
<ul>
<li><label class="radio left"><input type="radio" name="gender" checked="checked" value="M"><i></i>Male</label></li>
<li><label class="radio"><input type="radio" name="gender" value="F"><i></i>Female</label></li>
<div class="clearfix"></div>
</ul>
</div>
</div>
<div>
<label>
<select class="myselect" name="rcity" id="rcity">
<option value=""> --- Select Your City --- </option>
<option value="1">Vijayawada</option>
<option value="2">Vizag</option>
<option value="3">Tirupathi</option>
</select>
</label>
</div>
<div>
<label>
<input placeholder="Password" type="password" name="pass" id="pass">
</label>
</div>
<div>
<label>
<input placeholder="Retype Password" type="password" name="rpass" id="rpass">
</label>
</div>
<div class="sky-form">
<label class="checkbox"><input type="checkbox" name="cterms" id="cterms" value="1" checked="checked"><i></i>i agree to discountkamall.com <a class="terms" href="terms.php"> terms of service</a> </label>
</div>
<div>
<input type="submit" id="register-submit" name="sub" value="Create Account">
</div>
</form>
<!-- /Form -->
</div>
</div>
<div class="registration_left">
<h2>Existing user? <span> Login Here </span></h2>
<div class="registration_form">
<!-- Form -->
<form id="registration_form" action="" method="post">
<div>
<label>
<input placeholder="Registered Email Id" type="email" name="loginmail" tabindex="3" pattern="[a-zA-Z0-9\_\.]+\@[a-zA-Z\.]+\.([a-z]{2,4})$" required>
</label>
</div>
<div>
<label>
<input placeholder="password" type="password" name="loginpass" tabindex="4" required>
</label>
</div>
<div>
<input type="submit" name="sub" value="Sign In" id="register-submit">
</div>
<div class="forget">
<a href="#">forgot your password</a>
</div>
</form>
<!-- /Form -->
</div>
</div>
<div class="clearfix"></div>
</div>
<!-- end registration -->
</div>
</div>
<!-- footer_top -->
<?php include_once('footer.php'); ?>
</body>
</html>