-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
409 lines (362 loc) · 10.9 KB
/
register.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
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
<?php session_start();
include('indexDB.php');
$username = $name = $surname = $email = $password = $cpassword = $phone = "";
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$usernameErr = $nameErr = $surnameErr = $emailErr = $passwordErr = $cpasswordErr = $phoneErr = "";
$b=true;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["username"])) {
$usernameErr = "*Username is required";
$b=false;
} else {
$username = test_input($_POST["username"]);
if (!preg_match("/^[a-zA-Z0-9]*$/",$username) || $username=='') {
$usernameErr = "*Only letters and numbers allowed";
$b=false;
}
}
if (empty($_POST["name"])) {
$nameErr = "*Name is required";
$b=false;
} else {
$name = test_input($_POST["name"]);
if (!preg_match("/^[a-zA-Z]*$/",$name) || $name=='') {
$nameErr = "*Only letters allowed ";
$b=false;
}
}
if (empty($_POST["surname"])) {
$surnameErr = "*Surname is required";
$b=false;
} else {
$surname = test_input($_POST["surname"]);
if (!preg_match("/^[a-zA-Z]*$/",$surname) || $surname=='') {
$surnameErr = "*Only letters allowed ";
$b=false;
}
}
if (empty($_POST["email"])) {
$emailErr = "*Email is required";
$b=false;
} else {
$email = test_input($_POST["email"]);
if (!preg_match("/^[a-zA-Z0-9\.]*@[a-z\.]{1,}[a-z]*$/",$email) || $email=='') {
$emailErr = "*Enter a Valid Email";
$b=false;
}
}
if (empty($_POST["password"])) {
$passwordErr = "*Password is required";
$b=false;
} else {
$password = test_input($_POST["password"]);
if (!preg_match("/^[a-zA-Z0-9]{10,}$/",$password) || $password=='') {
$passwordErr = "*Enter minimum 10 characters ";
$b=false;
}
}
if (empty($_POST["confirm"])) {
$cpasswordErr = "*Confirmation of Password is required";
$b=false;
} else {
$cpassword = test_input($_POST["confirm"]);
$password= test_input($_POST["password"]);
if (strcmp($password,$cpassword)!=0) {
$cpasswordErr = "*Password does not match ";
$b=false;
}
}
if (empty($_POST["phone"])) {
$phoneErr = "*Contact Number is required";
$b=false;
} else {
$phone = test_input($_POST["phone"]);
if(!preg_match("/^[0-9]{10,10}$/",$phone) || $phone==''){
$phoneErr = "*Enter A Valid Contact Number";
$b=false;
}
}
}
if($b==true && isset($_POST['submit']))
{
$sql = "insert into login(username,password,name,surname,email,phone) values('$username','$password','$name','$surname','$email',$phone)";
$res=$conn->query($sql);
$sql1="select uid from login where username='$username'";
$result=$conn->query($sql1);
$row= mysqli_fetch_array($result,MYSQLI_ASSOC);
$_SESSION['username']=$username;
$_SESSION['type']='normal';
$_SESSION['id']=$row['uid'];
header('Location: normalHomeSale.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>HOUSING-CO</title>
<meta charset="UTF-8">
<meta name="description" content="HOUSING-CO">
<meta name="keywords" content="LERAMIZ, unica, creative, html">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Favicon -->
<link href="img/favicon.ico" rel="shortcut icon"/>
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
<!-- Stylesheets -->
<link rel="stylesheet" href="css/bootstrap.min.css"/>
<link rel="stylesheet" href="css/font-awesome.min.css"/>
<link rel="stylesheet" href="css/animate.css"/>
<link rel="stylesheet" href="css/owl.carousel.css"/>
<link rel="stylesheet" href="css/style.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="Styles.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Page Preloder -->
<!-- Header section -->
<header class="header-section">
<div class="header-top">
<div class="container">
<div class="row">
<div class="col-lg-6 text-lg-right header-top-right">
<div class="top-social">
<a href="https://www.facebook.com/"><i class="fa fa-facebook"></i></a>
<a href="https://www.twitter.com/"><i class="fa fa-twitter"></i></a>
<a href="https://www.instagram.com/"><i class="fa fa-instagram"></i></a>
<a href="https://www.pinterest.com/"><i class="fa fa-pinterest"></i></a>
<a href="https://www.linkedin.com/"><i class="fa fa-linkedin"></i></a>
</div>
</div>
<div class="user-panel">
<a href="register.php"><i class="fa fa-user-circle-o"></i> Register(Normal User)</a>
<a href="reg_builder.php"><i class="fa fa-user-circle-o"></i> Register(Builder)</a>
<a href="loginuser.php"><i class="fa fa-sign-in"></i>Login</a>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-12">
<div class="site-navbar">
<a href="index.html" class="site-logo"><img src="img/logo1.png" alt=""></a>
<div class="nav-switch">
<i class="fa fa-bars"></i>
</div>
<ul class="main-menu">
<li><a href="index.html">HOME</a></li>
<li><a href="about.html">ABOUT US</a></li>
<li><a href="contact.html">CONTACT US</a></li>
</ul>
</div>
</div>
</div>
</div>
</header>
<!-- Header section end -->
<style type="text/css">
body{
background-repeat:no-repeat;
background-image:url("img/service-bg.jpg");
background-size:cover;
background-attachment:fixed;
color:white;
}
input[type=text],input[type=date],input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
background-color: #e0e0d1;
color:black;
}
input[type=submit], input[type=reset] {
background-color: #e0e0d1;
border: none;
color: black;
padding: 16px 32px;
text-decoration: none;
margin: 4px 2px;
cursor: pointer;
font-weight:bold;
}
input[type=radio] {
height: 15px;
width: 15px;
}
select {
background-color: #e0e0d1;
border: none;
color: black;
padding: 16px 32px;
text-decoration: none;
margin: 4px 2px;
cursor: pointer;
font-weight:bold;
}
textarea {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
background-color:#e0e0d1;
color:black;
}
table{
background-color:black;
border-collapse: collapse;
border: 2px solid navy;
}
form{
opacity:0.7;
}
td{
font-weight:bold;
}
span
{
color:red;
}
</style>
</head>
<br><br><br><br><br><br><br><br><br><br><br>
<form id="form" method="post" action="register.php" >
<table cellpadding="7" width="50%" border="0" align="center"cellspacing="2" color="white">
<!-- I want another button here, center to the tile-->
<tr>
<td colspan=2>
<center><img src="img/logo1.png"></img></center>
</td>
</tr>
<tr>
<td colspan=2>
<center><font size=5><b>REGISTER</b></font></center>
</td>
</tr>
<tr>
<td><b>NAME:</b></td>
<td><input type="text" name="name" size="30">
<span class="error"><?php echo $nameErr; ?></span>
<br><br>
</td>
</tr>
<tr>
<td><b>SURNAME:</b></td>
<td><input type="text" name="surname" size="30">
<span class="error"><?php echo $surnameErr; ?></span>
<br><br>
</td>
</tr>
<tr>
<td><b>USERNAME:</b></td>
<td><input type="text" name="username" size="30">
<span class="error"><?php echo $usernameErr; ?></span>
<br><br>
</td>
</tr>
<tr>
<td>EMAIL ID:</td>
<td><input type="text" name="email" size="30">
<span class="error"><?php echo $emailErr; ?></span>
<br><br>
</td>
</tr>
<tr>
<td>PHONE NO:</td>
<td><input type="text" name="phone" size="30">
<span class="error"><?php echo $phoneErr; ?></span>
<br><br>
</td>
</tr>
<tr>
<td><b>PASSWORD:</b></td>
<td><input type="password" name="password" size="30">
<span class="error"><?php echo $passwordErr; ?></span>
<br><br>
</td>
</tr>
<tr>
<td><b> CONFIRM PASSWORD:</b></td>
<td><input type="password" name="confirm" size="30">
<span class="error"><?php echo $cpasswordErr; ?></span>
<br><br>
</td>
</tr>
<tr>
<td><input type="reset" value="Reset"></td>
<td><input type="submit" value="Register" name="submit">
<div style = "font-size:20px; color:#cc0000; margin-top:10px"></div>
</td>
</tr>
</table>
<br><br><br><br><br><br><br><br><br><br>
</form>
<footer class="footer-section set-bg" data-setbg="img/footer-bg.jpg">
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-6 footer-widget">
<img src="img/logo1.png" alt="">
<p>We provide you with the best services which is best for your family and which suits your pocket.</p>
<div class="social">
<a href="https://www.facebook.com/"><i class="fa fa-facebook"></i></a>
<a href="https://www.twitter.com/"><i class="fa fa-twitter"></i></a>
<a href="https://www.instagram.com/"><i class="fa fa-instagram"></i></a>
<a href="https://www.pinterest.com/"><i class="fa fa-pinterest"></i></a>
</div>
</div>
<div class="col-lg-3 col-md-6 footer-widget">
<div class="contact-widget">
<h5 class="fw-title">CONTACT US</h5>
<p><i class="fa fa-map-marker"></i>You can contact us here...... </p>
<p><i class="fa fa-phone"></i>Number</p>
<p><i class="fa fa-envelope"></i>[email protected]</p>
<p><i class="fa fa-clock-o"></i>Mon - Sat, 08 AM - 06 PM</p>
</div>
</div>
<div class="col-lg-3 col-md-6 footer-widget">
<div class="double-menu-widget">
<h5 class="fw-title">POPULAR PLACES</h5>
<ul>
<li><a href="">Mumbai</a></li>
<li><a href="">Delhi</a></li>
<li><a href="">Chennai</a></li>
<li><a href="">Kolkata</a></li>
<li><a href="">Banglore</a></li>
</ul>
<ul>
<li><a href="">Chandigarh</a></li>
<li><a href="">Pune</a></li>
<li><a href="">Jaipur</a></li>
<li><a href="">Kochi</a></li>
<li><a href="">Ooty</a></li>
</ul>
</div>
</div>
<div class="col-lg-3 col-md-6 footer-widget">
<div class="newslatter-widget">
<h5 class="fw-title">NEWSLETTER</h5>
<p>Subscribe your email to get the latest news and new offer also discount</p>
<form class="footer-newslatter-form">
<input type="text" placeholder="Email address">
<button><i class="fa fa-send"></i></button>
</form>
</div>
</div>
</div>
</div>
</footer>
</body>
</html>