-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
152 lines (132 loc) · 5.07 KB
/
index.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
<?php
require_once "lib/config.php";
$logged_in =0;
if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] == true){
$logged_in =1;
// if (isset($_SESSION["type"]))echo $_SESSION['type'];
// die();
}
// die($logged_in);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Food Shala</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<style>
/* Remove the navbar's default rounded borders and increase the bottom margin */
.navbar {
margin-bottom: 50px;
border-radius: 0;
}
/* Remove the jumbotron's default bottom margin */
.jumbotron {
margin-bottom: 0;
}
/* Add a gray background color and some padding to the footer */
footer {
background-color: #f2f2f2;
padding: 25px;
}
</style>
</head>
<body>
<?php
require_once "lib/navbar.php";
?>
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="jumbotron">
<div class="container text-center">
<h2>Popular Veg Foods</h2>
</div>
</div>
</br>
<?php
if (isset($_SESSION["type"])&& $_SESSION["type"]=='rest') {
$sql = "SELECT * FROM menu WHERE res_id = :res_id AND `type`='veg'";
if($stmt = $pdo->prepare($sql)){
$stmt->bindParam(":res_id", $_SESSION['id'], PDO::PARAM_INT);
}
}else{
$sql = "SELECT * FROM menu where `type`='veg'";
$stmt = $pdo->prepare($sql);
}
if($stmt->execute()){
$result = $stmt->fetchAll();
foreach ($result as $row) {
?>
<div class="col-sm-4">
<div class="panel panel-primary">
<a href="view_menu?id=<?php echo $row['id']; ?>">
<div class="panel-heading"><?php echo $row['name'];?></div>
<div class="panel-body"><img src="<?php echo $row['image'];?>" class="img-responsive" style="height: 280px;
width: 100%;"
alt="Image">
</div>
<div class="panel-footer">Rs. <?php echo $row['price'];?>/-</div>
</a>
</div>
</div>
<?php
}
}
?>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="jumbotron">
<div class="container text-center">
<h2>Popular Non-Veg Foods</h2>
</div>
</div>
</br>
<?php
if (isset($_SESSION["type"])&& $_SESSION["type"]=='rest') {
$sql = "SELECT * FROM menu WHERE res_id = :res_id AND `type`='nonveg'";
if($stmt = $pdo->prepare($sql)){
$stmt->bindParam(":res_id", $_SESSION['id'], PDO::PARAM_INT);
}
}else{
$sql = "SELECT * FROM menu WHERE `type`='nonveg'";
$stmt = $pdo->prepare($sql);
}
if($stmt->execute()){
$result = $stmt->fetchAll();
foreach ($result as $row) {
?>
<div class="col-sm-4">
<div class="panel panel-primary">
<a href="view_menu?id=<?php echo $row['id']; ?>">
<div class="panel-heading"><?php echo $row['name'];?></div>
<div class="panel-body"><img src="<?php echo $row['image'];?>" class="img-responsive" style="height: 280px;
width: 100%;"
alt="Image">
</div>
<div class="panel-footer">Rs. <?php echo $row['price'];?>/-</div>
</a>
</div>
</div>
<?php
}
}
?>
</div>
</div>
</div><br>
<br><br>
<footer class="container-fluid text-center">
<p>Food Shala</p>
<!-- <form class="form-inline">Get deals: -->
<!-- <input type="email" class="form-control" size="50" placeholder="Email Address"> -->
<!-- <button type="button" class="btn btn-danger">Sign Up</button> -->
<!-- </form> -->
</footer>
</body>
</html>