-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
330 lines (286 loc) · 12.8 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
<?php
include("dbconnect.php");
$rdate = date("d-m-Y");
extract($_REQUEST);
$msg = "";
$success = "";
if (isset($btn)) {
// Use prepared statements to prevent SQL injection
$q1 = mysqli_prepare($connect, "SELECT * FROM rs_rider WHERE email=? AND uname=?");
mysqli_stmt_bind_param($q1, "ss", $email, $uname);
mysqli_stmt_execute($q1);
mysqli_stmt_store_result($q1);
$n1 = mysqli_stmt_num_rows($q1);
mysqli_stmt_close($q1);
if ($n1 == 0) {
$mq = mysqli_query($connect, "SELECT MAX(id) FROM rs_rider");
$mr = mysqli_fetch_array($mq);
$id = $mr['MAX(id)'] + 1;
$ins = mysqli_prepare($connect, "INSERT INTO rs_rider(id, name, gender, mobile, email, city, uname, pass, create_date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
mysqli_stmt_bind_param($ins, "issssssss", $id, $name, $gender, $mobile, $email, $city, $uname, $pass, $rdate);
mysqli_stmt_execute($ins);
mysqli_stmt_close($ins);
if ($ins) {
$success = "Registered Successfully";
header("Location: login_user.php");
exit();
} else {
$msg = "Error: " . mysqli_error($connect);
}
} else {
$msg = "Already Exist!";
}
}
?>
<html>
<head>
<meta charset="utf-8">
<title>Ride-Sharing</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="Free HTML Templates" name="keywords">
<meta content="Free HTML Templates" name="description">
<link href="static/img/favicon.ico" rel="icon">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Rubik&display=swap" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet">
<link href="static/lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet">
<link href="static/lib/tempusdominus/css/tempusdominus-bootstrap-4.min.css" rel="stylesheet" />
<link href="static/css/bootstrap.min.css" rel="stylesheet">
<link href="static/css/style.css" rel="stylesheet">
<script language="javascript">
function validate() {
var name = document.form1.name.value.trim();
var gender = document.form1.gender.value;
var mobile = document.form1.mobile.value.trim();
var email = document.form1.email.value.trim();
var city = document.form1.city.value.trim();
var uname = document.form1.uname.value.trim();
var pass = document.form1.pass.value.trim();
var cpass = document.form1.cpass.value.trim();
if (name === "") {
alert("Enter the Name");
document.form1.name.focus();
return false;
}
if (gender === "") {
alert("Select the Gender");
document.form1.gender.focus();
return false;
}
if (mobile === "") {
alert("Enter the Mobile No.");
document.form1.mobile.focus();
return false;
}
if (isNaN(mobile)) {
alert("Invalid Mobile No.");
document.form1.mobile.select();
return false;
}
if (mobile.length !== 10) {
alert("Mobile No. must be 10 digits!");
document.form1.mobile.select();
return false;
}
if (email === "") {
alert("Enter the Email");
document.form1.email.focus();
return false;
}
var emailRegex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (!emailRegex.test(email)) {
alert("Invalid E-mail!");
document.form1.email.select();
return false;
}
if (city === "") {
alert("Enter Your City");
document.form1.city.focus();
return false;
}
if (uname === "") {
alert("Enter the Username");
document.form1.uname.focus();
return false;
}
if (pass === "") {
alert("Enter the Password");
document.form1.pass.focus();
return false;
}
if (cpass === "") {
alert("Enter the Confirm Password");
document.form1.cpass.focus();
return false;
}
if (pass !== cpass) {
alert("Password does not match!");
document.form1.cpass.select();
return false;
}
return true;
}
</script>
</head>
<body>
<div class="container-fluid bg-dark py-3 px-lg-5 d-none d-lg-block">
<div class="row">
<div class="col-md-6 text-center text-lg-left mb-2 mb-lg-0">
<div class="d-inline-flex align-items-center">
<a class="text-body pr-3" href=""><i class="fa fa-phone-alt mr-2"></i>+012 345 6789</a>
<span class="text-body">|</span>
<a class="text-body px-3" href=""><i class="fa fa-envelope mr-2"></i>travel@info.com</a>
</div>
</div>
<div class="col-md-6 text-center text-lg-right">
<div class="d-inline-flex align-items-center">
<a class="text-body px-3" href="">
<i class="fab fa-facebook-f"></i>
</a>
<a class="text-body px-3" href="">
<i class="fab fa-twitter"></i>
</a>
<a class="text-body px-3" href="">
<i class="fab fa-linkedin-in"></i>
</a>
<a class="text-body px-3" href="">
<i class="fab fa-instagram"></i>
</a>
<a class="text-body pl-3" href="">
<i class="fab fa-youtube"></i>
</a>
</div>
</div>
</div>
</div>
<div class="container-fluid position-relative nav-bar p-0">
<div class="position-relative px-lg-5" style="z-index: 9;">
<nav class="navbar navbar-expand-lg bg-secondary navbar-dark py-3 py-lg-0 pl-3 pl-lg-5">
<a href="" class="navbar-brand">
<h1 class="text-uppercase text-primary mb-1">Ride-Sharing</h1>
</a>
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-between px-3" id="navbarCollapse">
<div class="navbar-nav ml-auto py-0">
<a href="index.php" class="nav-item nav-link active">Home</a>
<a href="login_user.php" class="nav-item nav-link">User</a>
<a href="login.php" class="nav-item nav-link">Driver</a>
<a href="login_admin.php" class="nav-item nav-link">Admin</a>
</div>
</div>
</nav>
</div>
</div>
<div class="container-fluid page-header">
<h1 class="display-3 text-uppercase text-white mb-3">Ride-Sharing</h1>
<div class="d-inline-flex text-white">
<h6 class="text-uppercase m-0"><a class="text-white" href="index.php">Home</a></h6>
<h6 class="text-body m-0 px-3"></h6>
<h6 class="text-uppercase text-body m-0"></h6>
</div>
</div>
<!-- Page Header Start -->
<!-- Contact Start -->
<div class="container-fluid py-5">
<div class="container pt-5 pb-3">
<h1 class="display-4 text-uppercase text-center mb-5">Rider Registration</h1>
<div class="row">
<div class="col-lg-7 mb-2">
<div class="contact-form bg-light mb-4" style="padding: 30px;">
<?php
if (!empty($success)) {
echo "<span style='color:#009900'>$success</span>";
}
if (!empty($msg)) {
echo "<span style='color:red'>$msg</span>";
}
?>
<form name="form1" method="post" onsubmit="return validate();">
<div class="row">
<div class="col-6 form-group">
<label>Name</label>
<input type="text" name="name" class="form-control p-4" placeholder="">
</div>
<div class="col-6 form-group">
<label>Gender</label>
<select name="gender" class="form-control p-4">
<option value="">-Gender-</option>
<option>Male</option>
<option>Female</option>
</select>
</div>
</div>
<div class="row">
<div class="col-6 form-group">
<label>Mobile No.</label>
<input type="text" name="mobile" class="form-control p-4">
</div>
<div class="col-6 form-group">
<label>Email</label>
<input type="text" name="email" class="form-control p-4" placeholder="">
</div>
</div>
<div class="row">
<div class="col-6 form-group">
<label>City</label>
<input type="text" name="city" class="form-control p-4" placeholder="">
</div>
<div class="col-6 form-group">
<label>Username</label>
<input type="text" name="uname" class="form-control p-4" placeholder="">
</div>
</div>
<div class="row">
<div class="col-6 form-group">
<label>Password</label>
<input type="password" name="pass" class="form-control p-4" placeholder="">
</div>
<div class="col-6 form-group">
<label>Confirm Password</label>
<input type="password" name="cpass" class="form-control p-4" placeholder="">
</div>
</div>
<div class="form-group">
<button class="btn btn-primary py-3 px-5" type="submit" name="btn">Register</button>
</div>
</form>
</div>
</div>
<div class="col-lg-5 mb-2">
<div class="bg-secondary d-flex flex-column justify-content-center px-5 mb-4" style="height: 435px;">
<div class="d-flex mb-3">
<i class="fa fa-2x fa-map-marker-alt text-primary flex-shrink-0 mr-3"></i>
<div class="mt-n1">
<h5 class="text-light">Ride Sharing</h5>
<p>sharing of rides in a motor vehicle</p>
</div>
</div>
<div class="d-flex mb-3">
<i class="fa fa-2x fa-map-marker-alt text-primary flex-shrink-0 mr-3"></i>
<div class="mt-n1">
<h5 class="text-light">Ride Sharing</h5>
<p>share vehicle like a bike / car / van</p>
</div>
</div>
<div class="d-flex mb-3">
<i class="fa fa-2x fa-envelope-open text-primary flex-shrink-0 mr-3"></i>
<div class="mt-n1">
<h5 class="text-light">Ride Sharing</h5>
<p>connect drivers with passengers.</p>
</div>
</div>
<div class="d-flex">
<i class="fa fa-2x fa-envelope-open text-primary flex-shrink-0 mr-3"></i>
<div class="mt-n1">
<h5 class="text-light">Ride Sharing</h5>
<p class="m-0">holdover from the term, sharing economy.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include("footer.php");?>