forked from izana92/InstaFood-Ordering-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration.php
312 lines (266 loc) · 14.1 KB
/
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
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
<!DOCTYPE html>
<html lang="en">
<?php
session_start(); //temp session
error_reporting(0); // hide undefine index
include("connection/connect.php"); // connection
if(isset($_POST['submit'] )) //if submit btn is pressed
{
if(empty($_POST['firstname']) || //fetching and find if its empty
empty($_POST['lastname'])||
empty($_POST['email']) ||
empty($_POST['phone'])||
empty($_POST['password'])||
empty($_POST['cpassword']) ||
empty($_POST['cpassword']))
{
$message = "All fields must be Required!";
}
else
{
//cheching username & email if already present
$check_username= mysqli_query($db, "SELECT username FROM users where username = '".$_POST['username']."' ");
$check_email = mysqli_query($db, "SELECT email FROM users where email = '".$_POST['email']."' ");
if($_POST['password'] != $_POST['cpassword']){ //matching passwords
$message = "Password not match";
}
elseif(strlen($_POST['password']) < 6) //cal password length
{
$message = "Password Must be >=6";
}
elseif(strlen($_POST['phone']) < 10) //cal phone length
{
$message = "invalid phone number!";
}
elseif (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) // Validate email address
{
$message = "Invalid email address please type a valid email!";
}
elseif(mysqli_num_rows($check_username) > 0) //check username
{
$message = 'username Already exists!';
}
elseif(mysqli_num_rows($check_email) > 0) //check email
{
$message = 'Email Already exists!';
}
else{
//inserting values into db
$mql = "INSERT INTO users(username,f_name,l_name,email,phone,password,address) VALUES('".$_POST['username']."','".$_POST['firstname']."','".$_POST['lastname']."','".$_POST['email']."','".$_POST['phone']."','".md5($_POST['password'])."','".$_POST['address']."')";
mysqli_query($db, $mql);
$success = "Account Created successfully! <p>You will be redirected in <span id='counter'>5</span> second(s).</p>
<script type='text/javascript'>
function countdown() {
var i = document.getElementById('counter');
if (parseInt(i.innerHTML)<=0) {
location.href = 'login.php';
}
i.innerHTML = parseInt(i.innerHTML)-1;
}
setInterval(function(){ countdown(); },1000);
</script>'";
header("refresh:5;url=login.php"); // redirected once inserted success
}
}
}
?>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="assets/img/web-icon.png">
<title>Registration | InstaFood</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/animsition.min.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="css/styles.css" rel="stylesheet">
</head>
<body class="reg-wrapper">
<!--header starts-->
<header id="header" class="header-scroll top-header headrom">
<!-- .navbar -->
<nav class="navbar navbar-dark">
<div class="container">
<button class="navbar-toggler hidden-lg-up" type="button" data-toggle="collapse" data-target="#mainNavbarCollapse">☰</button>
<a class="navbar-brand" href="index.php"> <img class="img-rounded" src="assets/img/header-logo.png" alt=""> </a>
<div class="collapse navbar-toggleable-md float-lg-right" id="mainNavbarCollapse">
<ul class="nav navbar-nav">
<li class="nav-item"> <a class="nav-link active" href="index.php">Home <span class="sr-only">(current)</span></a> </li>
<li class="nav-item"> <a class="nav-link active" href="Stores.php">Stores<span class="sr-only"></span></a> </li>
<?php
if(empty($_SESSION["user_id"]))
{
echo '<li class="nav-item"><a href="login.php" class="nav-link active">Log In</a> </li>
<li class="nav-item"><a href="registration.php" class="nav-link active">Sign Up</a> </li>';
}
else
{
echo '<li class="nav-item"><a href="your_orders.php" class="nav-link active">My Orders</a> </li>';
echo '<li class="nav-item"><a href="logout.php" class="nav-link active">Log Out</a> </li>';
}
?>
</ul>
</div>
</div>
</nav>
<!-- /.navbar -->
</header>
<div class="page-wrapper">
<div class="breadcrumb">
<div class="container">
<ul>
<li><a href="#" class="active">
<span style="color:red;"><?php echo $message; ?></span>
<span style="color:green;">
<?php echo $success; ?>
</span>
</a></li>
</ul>
</div>
</div><br><br><br>
<section class="contact-page inner-page">
<div class="container">
<div class="row">
<!-- REGISTER -->
<div class="col-md-8">
<div class="widget">
<div class="widget-body">
<form action="" method="post">
<div class="row">
<div class="form-group col-sm-12">
<label for="exampleInputEmail1">Username</label>
<input class="form-control" type="text" name="username" id="example-text-input" placeholder="Username">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputEmail1">First Name</label>
<input class="form-control" type="text" name="firstname" id="example-text-input" placeholder="First Name">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputEmail1">Last Name</label>
<input class="form-control" type="text" name="lastname" id="example-text-input-2" placeholder="Last Name">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputEmail1">Email Address</label>
<input type="text" class="form-control" name="email" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputEmail1">Phone Number</label>
<input class="form-control" type="text" name="phone" id="example-tel-input-3" placeholder="Phone">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" name="password" id="exampleInputPassword1" placeholder="Password">
</div>
<div class="form-group col-sm-6">
<label for="exampleInputPassword1">Repeat Password</label>
<input type="password" class="form-control" name="cpassword" id="exampleInputPassword2" placeholder="Password">
</div>
<div class="form-group col-sm-12">
<label for="exampleTextarea">Delivery Address</label>
<textarea class="form-control" id="exampleTextarea" name="address" rows="3"></textarea>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<p> <input type="submit" value="Register" name="submit" class="btn theme-btn"> </p>
</div>
</div>
</form>
</div>
<!-- end: Widget -->
</div>
<!-- /REGISTER -->
</div>
<!-- WHY? -->
<div class="col-md-4">
<h4>Register Now</h4>
<p>Become an InstaFoodie today. Get exclusive vouchers, discounts, promos, and other perks for being an InstaFoodie!</p>
<hr>
<p></p>
<div class="panel">
<div class="panel-heading">
<h4 class="panel-title"><a data-parent="#accordion" data-toggle="collapse" class="panel-toggle collapsed" href="#faq1" aria-expanded="false"><i class="ti-info-alt" aria-hidden="true"></i>What is InstaFood?</a></h4>
</div>
<div class="panel-collapse collapse" id="faq1" aria-expanded="false" role="article" style="height: 0px;">
<div class="panel-body">
InstaFood is one of the leading local food delivery marketplace. Users can conveniently order their favorite meals online and discover food around their local area.
<br><br>
In December 2022, InstagramFood launched in the Philippines with over 10+ partners.
<br><br>
InstaFood is a team of problem solvers, designers, thinkers, and tinkers working around the clock to make it the most powerful online food delivery tool on the market today. You should be able to order food easily, quickly, and definitely with a smile on your face!
</div>
</div>
</div>
<!-- end:panel -->
<div class="panel">
<div class="panel-heading">
<h4 class="panel-title"><a data-parent="#accordion" data-toggle="collapse" class="panel-toggle" href="#faq2" aria-expanded="true"><i class="ti-info-alt" aria-hidden="true"></i>How long is the validity of my account?</a></h4>
</div>
<div class="panel-collapse collapse" id="faq2" aria-expanded="true" role="article">
<div class="panel-body">
A membership of the InstaFoodies is for a lifetime, which means that you don't have to create a new account yearly just to be a member of the InstaFoodies community.
<br><br>
What are you waiting for? Join the Instafoodie community today and start enjoying the perks!
</div>
</div>
</div>
<!-- end:Panel -->
<h4 class="m-t-20">Contact Customer Support</h4>
<p> Do you need assistance? Have questions or concerns? <br><br>Contact us quickly and easily by clicking the button below. </p>
<p> <a href="#contact" class="btn theme-btn m-t-15">Contact Us</a> </p>
</div>
<!-- /WHY? -->
</div>
</div>
</section>
<!-- start: FOOTER --><br><br><br><br>
<footer class="footer-distributed">
<div class="footer-left">
<div class="logo-image">
<img src="assets/img/banner-footer.png">
</div><br>
<p class="footer-links">
<a href="index.php">Home</a>
·
<a href="stores.php">View Stores</a>
·
<a href="login.php">Log In</a>
·
<a href="registration.php">Sign Up</a>
</p>
<p class="footer-company-name">InstaFood © 2023</p>
<div class="footer-icons">
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-instagram"></i></a>
<a href="#"><i class="fa fa-telegram"></i></a>
</div>
</div>
<div class="footer-right">
<p>Contact Us</p>
<form id="myForm" action="assets/back-end/connect-footer.php" method="post">
<input type="text" name="email" placeholder="Email" id="contact">
<textarea name="message" placeholder="Message"></textarea>
<button onclick="myFunction()">Send</button>
</form>
</div>
</footer>
<!-- end:Footer -->
</div>
<!-- end:page wrapper -->
<!-- Bootstrap core JavaScript
================================================== -->
<script src="js/jquery.min.js"></script>
<script src="js/tether.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/animsition.min.js"></script>
<script src="js/bootstrap-slider.min.js"></script>
<script src="js/jquery.isotope.min.js"></script>
<script src="js/headroom.js"></script>
<script src="js/foodpicky.min.js"></script>
</body>
</html>