-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
602 lines (541 loc) · 28.2 KB
/
index.php
File metadata and controls
602 lines (541 loc) · 28.2 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
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
<!-- Author @Sujith D
email :- sujithsuji1098@gmail.com
-->
<?php
session_start();
function register()
{
include('connection.php');
$email_address = mysqli_real_escape_string($conn, $_POST['email_address']);
$password = mysqli_real_escape_string($conn, $_POST['password']);
$repeat_password = mysqli_real_escape_string($conn, $_POST['repeat_password']);
if ($password == $repeat_password) {
if (preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $email_address)) {
$sql = mysqli_query($conn, "INSERT INTO `users` (`email_address`,`password`) VALUES('$email_address','$password')");
if (!$sql) {
echo "Error while registering..!!!";
} else {
//successfully registered
echo '<script type="text/javascript">';
echo 'setTimeout(function () { sweetAlert("Success"," You have successfully registred","success");';
echo '}, 500);</script>';
}
} else {
//invalid email address
echo '<script type="text/javascript">';
echo 'setTimeout(function () { sweetAlert("Oops...","Email Address ' . $email_address . ' is already exists!","error");';
echo '}, 500);</script>';
}
} else {
//password missmatch error
echo '<script type="text/javascript">';
echo 'setTimeout(function () { sweetAlert("Oops...","The two passwords does not match!","error");';
echo '}, 500);</script>';
}
}
function login()
{
include('connection.php');
$email_address = mysqli_real_escape_string($conn, $_POST['email_address']);
$password = mysqli_real_escape_string($conn, $_POST['password']);
$sql = mysqli_query($conn, "SELECT * FROM users WHERE email_address = '$email_address' AND password = '$password' ");
$row = mysqli_fetch_array($sql);
if($row['email_address'] == 'manager@foodfun.com' && $row['password'] == 'manager'){
header('location:managerPage.php');
}
if($row['email_address'] == 'cook@foodfun.com' && $row['password'] == 'cook'){
header('location:cookPage.php');
}
if ($row['email_address'] == $email_address && $row['password'] == $password) {
$_SESSION['email_address'] = $email_address;
} else {
echo '<script type="text/javascript">';
echo 'setTimeout(function () { sweetAlert("<b>Oops...","Wrong username or Password!...</b>","error");';
echo '}, 500);</script>';
}
}
if (isset($_POST['register'])) {
register();
}
if (isset($_POST['login'])) {
login();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required Meta Tags -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- Page Title -->
<title>Foodfun</title>
<!-- Favicon -->
<link rel="shortcut icon" href="assets/images/logo/favicon.png" type="image/x-icon">
<!-- CSS Files -->
<link rel="stylesheet" href="assets/css/animate-3.7.0.css">
<link rel="stylesheet" href="assets/css/bootstrap-4.1.3.min.css">
<link rel="stylesheet" href="assets/css/owl-carousel.min.css">
<link rel="stylesheet" href="assets/css/style.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css">
<!-- Material Design Bootstrap -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.7.3/css/mdb.min.css" rel="stylesheet">
<!-- sweetalert css cdn -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@7.28.11/dist/sweetalert2.min.css">
</head>
<body>
<!--Modal: Login / Register Form-->
<div class="modal fade" id="modalLRForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog cascading-modal" role="document">
<!--Content-->
<div class="modal-content">
<!--Modal cascading tabs-->
<div class="modal-c-tabs">
<!-- Nav tabs -->
<ul class="nav nav-tabs md-tabs tabs-2 light-blue darken-3" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#panel7" role="tab"><i class="fas fa-user mr-1"></i>
Login</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#panel8" role="tab"><i class="fas fa-user-plus mr-1"></i>
Register</a>
</li>
</ul>
<!-- Tab panels -->
<div class="tab-content">
<!--Panel 7-->
<div class="tab-pane fade in show active" id="panel7" role="tabpanel">
<!--Body-->
<form action="index.php" method="post">
<div class="modal-body mb-1">
<div class="md-form form-sm mb-5">
<i class="fas fa-envelope prefix"></i>
<input type="email" id="modalLRInput10" class="form-control form-control-sm validate" name="email_address">
<label data-error="wrong" data-success="right" for="modalLRInput10">Your email</label>
</div>
<div class="md-form form-sm mb-4">
<i class="fas fa-lock prefix"></i>
<input type="password" id="modalLRInput11" class="form-control form-control-sm validate" name="password">
<label data-error="wrong" data-success="right" for="modalLRInput11">Your password</label>
</div>
<div class="text-center mt-2">
<button class="btn btn-warning" type="submit" name="login">Log in <i class="fas fa-sign-in ml-1"></i></button>
</div>
</div>
</form>
</div>
<!--/.Panel 7-->
<!--Panel 8-->
<div class="tab-pane fade" id="panel8" role="tabpanel">
<!--Body-->
<form action="index.php" method="post">
<div class="modal-body">
<div class="md-form form-sm mb-5">
<i class="fas fa-envelope prefix"></i>
<input type="email" id="modalLRInput12" class="form-control form-control-sm validate" name="email_address">
<label data-error="wrong" data-success="right" for="modalLRInput12">Your email</label>
</div>
<div class="md-form form-sm mb-5">
<i class="fas fa-lock prefix"></i>
<input type="password" id="modalLRInput13" class="form-control form-control-sm validate" name="password">
<label data-error="wrong" data-success="right" for="modalLRInput13">Your password</label>
</div>
<div class="md-form form-sm mb-4">
<i class="fas fa-lock prefix"></i>
<input type="password" id="modalLRInput14" class="form-control form-control-sm validate" name="repeat_password">
<label data-error="wrong" data-success="right" for="modalLRInput14">Repeat password</label>
</div>
<div class="text-center form-sm mt-2">
<button class="btn btn-warning" type="submit" name="register">Sign up <i class="fas fa-sign-in ml-1"></i></button>
</div>
</div>
</div>
</form>
<!--/.Panel 8-->
</div>
</div>
</div>
<!--/.Content-->
</div>
</div>
<!--Modal: Login / Register Form-->
<!-- Preloader Starts -->
<div class="preloader">
<div class="spinner"></div>
</div>
<!-- Preloader End -->
<!-- Header Area Starts -->
<header class="header-area">
<div class="container">
<div class="row">
<div class="col-lg-2">
<div class="logo-area">
<a href="index.html"><img src="assets/images/logo/logo.png" alt="logo"></a>
</div>
</div>
<div class="col-lg-10">
<div class="custom-navbar">
<span></span>
<span></span>
<span></span>
</div>
<div class="main-menu">
<ul>
<li class="active"><a href="index.html">home</a></li>
<li><a href="#about">about</a></li>
<li><a href="#contact">contact</a></li>
<?php if (!isset($_SESSION['email_address'])) {
echo '<li><a href="" data-target="#modalLRForm" data-toggle="modal">login/register</a></li>';
} else {
$string = $_SESSION['email_address'];
$str_arr = preg_split ("/\@/", $string);
echo'
<li class="dropdown">
<button class="btn btn-warning dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">'.$str_arr[0].'</button>
<div class="dropdown-menu dropdown-primary">
<a class="dropdown-item" href="order.php">order food</a>
<a class="dropdown-item" href="logout.php">logout</a>
</div>
</li>';
}
?>
</ul>
</div>
</div>
</div>
</div>
</header>
<!-- Header Area End -->
<!-- Banner Area Starts -->
<section class="banner-area text-center">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h6>the most interesting food in the world</h6>
<h1>Discover the <span class="prime-color">flavors</span><br>
<span class="style-change">of <span class="prime-color">food</span>fun</span></h1>
</div>
</div>
</div>
</section>
<!-- Banner Area End -->
<!-- Welcome Area Starts -->
<section class="welcome-area section-padding2">
<div class="container-fluid">
<div class="row">
<div class="col-md-6 align-self-center">
<div class="welcome-img">
<img src="assets/images/welcome-bg.png" class="img-fluid" alt="">
</div>
</div>
<div class="col-md-6 align-self-center">
<div class="welcome-text mt-5 mt-md-0">
<h3><span class="style-change">welcome</span> <br>to food fun</h3>
<p class="pt-3">"I try to greet my friends with a drink in my hand, a warm smile on my face,and greate music in the background,because that's what gets a dinner party off to a fun start." <b><i class='far fa-laugh' style="font-size:24px;"></i> <i class='far fa-laugh' style="font-size:24px;"></i></b></p>
</div>
</div>
</div>
</div>
</section>
<!-- Welcome Area End -->
<!-- Food Area starts -->
<section class="food-area section-padding">
<div class="container">
<div class="row">
<div class="col-md-5">
<div class="section-top">
<h3><span class="style-change">we serve</span> <br>delicious food</h3>
<p class="pt-3">"A greate many things can be solved with kindness,even more with laughter,but there are some thing just require cake." <b><i class='far fa-smile-wink' style="font-size:24px;"></i></b></p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 col-sm-6">
<div class="single-food">
<div class="food-img">
<img src="assets/images/food1.jpg" class="img-fluid" alt="">
</div>
<div class="food-content">
<div class="d-flex justify-content-between">
<h5>Mexican Eggrolls</h5>
<span class="style-change"></span>
</div>
<p class="pt-3">Face together given moveth divided form Of Seasons that fruitful.</p>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="single-food mt-5 mt-sm-0">
<div class="food-img">
<img src="assets/images/food2.jpg" class="img-fluid" alt="">
</div>
<div class="food-content">
<div class="d-flex justify-content-between">
<h5>chicken burger</h5>
<span class="style-change"></span>
</div>
<p class="pt-3">Face together given moveth divided form Of Seasons that fruitful.</p>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="single-food mt-5 mt-md-0">
<div class="food-img">
<img src="assets/images/food3.jpg" class="img-fluid" alt="">
</div>
<div class="food-content">
<div class="d-flex justify-content-between">
<h5>topu lasange</h5>
<span class="style-change"></span>
</div>
<p class="pt-3">Face together given moveth divided form Of Seasons that fruitful.</p>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="single-food mt-5">
<div class="food-img">
<img src="assets/images/food4.jpg" class="img-fluid" alt="">
</div>
<div class="food-content">
<div class="d-flex justify-content-between">
<h5>pepper potatoas</h5>
<span class="style-change"></span>
</div>
<p class="pt-3">Face together given moveth divided form Of Seasons that fruitful.</p>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="single-food mt-5">
<div class="food-img">
<img src="assets/images/food5.jpg" class="img-fluid" alt="">
</div>
<div class="food-content">
<div class="d-flex justify-content-between">
<h5>bean salad</h5>
<span class="style-change"></span>
</div>
<p class="pt-3">Face together given moveth divided form Of Seasons that fruitful.</p>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="single-food mt-5">
<div class="food-img">
<img src="assets/images/food6.jpg" class="img-fluid" alt="">
</div>
<div class="food-content">
<div class="d-flex justify-content-between">
<h5>beatball hoagie</h5>
<span class="style-change"></span>
</div>
<p class="pt-3">Face together given moveth divided form Of Seasons that fruitful.</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Food Area End -->
<!-- Reservation Area Starts -->
<div class="reservation-area section-padding text-center">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Natural ingredients and testy food</h2>
<h4 class="mt-4">some trendy and popular courses offerd</h4>
</div>
</div>
</div>
</div>
<!-- Reservation Area End -->
<!-- Deshes Area Starts -->
<div class="deshes-area section-padding">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="section-top2 text-center">
<h3>Our <span>special</span> deshes</h3>
<p><i>Beast kind form divide night above let moveth bearing darkness.</i></p>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-5 col-md-6 align-self-center">
<h1>01.</h1>
<div class="deshes-text">
<h3><span>Garlic</span><br> green beans</h3>
<p class="pt-3">Be. Seed saying our signs beginning face give spirit own beast darkness morning moveth green multiply she'd kind saying one shall, two which darkness have day image god their night. his subdue so you rule can.</p>
<span class="style-change"></span>
</div>
</div>
<div class="col-lg-5 offset-lg-2 col-md-6 align-self-center mt-4 mt-md-0">
<img src="assets/images/deshes1.png" alt="" class="img-fluid">
</div>
</div>
<div class="row mt-5">
<div class="col-lg-5 col-md-6 align-self-center order-2 order-md-1 mt-4 mt-md-0">
<img src="assets/images/deshes2.png" alt="" class="img-fluid">
</div>
<div class="col-lg-5 offset-lg-2 col-md-6 align-self-center order-1 order-md-2">
<h1>02.</h1>
<div class="deshes-text">
<h3><span>Lemon</span><br> rosemary chicken</h3>
<p class="pt-3">Be. Seed saying our signs beginning face give spirit own beast darkness morning moveth green multiply she'd kind saying one shall, two which darkness have day image god their night. his subdue so you rule can.</p>
<span class="style-change"></span>
</div>
</div>
</div>
</div>
</div>
<!-- Deshes Area End -->
<!-- Testimonial Area Starts -->
<section class="testimonial-area section-padding4" id="about">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="section-top2 text-center">
<h3>Our <span>team</span></h3>
<p><i>Beast kind form divide night above let moveth bearing darkness.</i></p>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="testimonial-slider owl-carousel">
<div class="single-slide d-sm-flex">
<div class="customer-img mr-4 mb-4 mb-sm-0">
<img src="assets/images/customer1.png" alt="">
</div>
<div class="customer-text">
<h5>adame nesane</h5>
<span><i>Chief Customer</i></span>
<p class="pt-3">You're had. Subdue grass Meat us winged years you'll doesn't. fruit two also won one yielding creepeth third give may never lie alternet food.</p>
</div>
</div>
<div class="single-slide d-sm-flex">
<div class="customer-img mr-4 mb-4 mb-sm-0">
<img src="assets/images/customer2.png" alt="">
</div>
<div class="customer-text">
<h5>adam nahan</h5>
<span><i>Chief Customer</i></span>
<p class="pt-3">You're had. Subdue grass Meat us winged years you'll doesn't. fruit two also won one yielding creepeth third give may never lie alternet food.</p>
</div>
</div>
<div class="single-slide d-sm-flex">
<div class="customer-img mr-4 mb-4 mb-sm-0">
<img src="assets/images/customer1.png" alt="">
</div>
<div class="customer-text">
<h5>adame nesane</h5>
<span><i>Chief Customer</i></span>
<p class="pt-3">You're had. Subdue grass Meat us winged years you'll doesn't. fruit two also won one yielding creepeth third give may never lie alternet food.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Testimonial Area End -->
<!-- Footer Area Starts -->
<footer class="footer-area" id="contact">
<div class="footer-widget section-padding">
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="single-widget single-widget1">
<a href="index.html"><img src="assets/images/logo/logo2.png" alt=""></a>
<p class="mt-3"> Food fun is a great place for everyone to have a great meal very easily.It provides a very quick delivery service and amazing bunch of dishes at cheap prices.Enjoy your meals at your own place of comfort!!</p>
</div>
</div>
<div class="col-md-4">
<div class="single-widget single-widget2 my-5 my-md-0">
<h5 class="mb-4">contact us</h5>
<div class="d-flex">
<div class="into-icon">
<i class="fa fa-map-marker"></i>
</div>
<div class="info-text">
<p>xyz road 2nd cross,xyz-575007</p>
</div>
</div>
<div class="d-flex">
<div class="into-icon">
<i class="fa fa-phone"></i>
</div>
<div class="info-text">
<p>(+91) 9876543210</p>
</div>
</div>
<div class="d-flex">
<div class="into-icon">
<i class="fa fa-envelope"></i>
</div>
<div class="info-text">
<p>foodfun@gmail.com</p>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="single-widget single-widget3">
<h5 class="mb-4">opening hours</h5>
<p>Monday ...................... Closed</p>
<p>Tue-Fri .............. 10 am - 12 pm</p>
<p>Sat-Sun ............... 8 am - 11 pm</p>
<p>Holidays ............. 10 am - 12 pm</p>
</div>
</div>
</div>
</div>
</div>
<div class="footer-copyright">
<div class="container">
<div class="row">
<div class="col-lg-7 col-md-6">
<span>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright ©<script>
document.write(new Date().getFullYear());
</script> All rights reserved | Made with <i class="fa fa-heart-o" aria-hidden="true"></i> by <a href="#" target="_blank">foodfun</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. --></span>
</div>
<div class="col-lg-5 col-md-6">
<div class="social-icons">
<ul>
<li class="no-margin">Follow Us</li>
<li><a href="#"><i class="fa fa-facebook"></i></a></li>
<li><a href="#"><i class="fa fa-twitter"></i></a></li>
<li><a href="#"><i class="fa fa-google-plus"></i></a></li>
<li><a href="#"><i class="fa fa-pinterest"></i></a></li>
<li><a href="#"><i class="fa fa-instagram"></i></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</footer>
<!-- Footer Area End -->
<!-- JQuery -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.4/umd/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.7.3/js/mdb.min.js"></script>
<!-- sweetalert js cdn -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sweetalert2@7.28.11/dist/sweetalert2.min.js"></script>
<script src="assets/js/vendor/wow.min.js"></script>
<script src="assets/js/vendor/owl-carousel.min.js"></script>
<script src="assets/js/vendor/jquery.datetimepicker.full.min.js"></script>
<script src="assets/js/vendor/jquery.nice-select.min. js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>