-
Notifications
You must be signed in to change notification settings - Fork 15
/
menu.php
307 lines (271 loc) · 13.7 KB
/
menu.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
<?php
session_start();
require_once "includes/connection.php";
// Fetch the admin data
$adminQuery = "SELECT `id`, `email`, `name`, `password`, `resettoken`, `resettokenexpire`, `enable_menu_page` FROM `admin` WHERE 1";
$adminResult = mysqli_query($conn, $adminQuery);
if ($adminResult) {
$adminData = mysqli_fetch_assoc($adminResult);
// Check if the enable_table_booking is 1
if ($adminData['enable_menu_page'] == 1) {
// Continue loading the page
} else {
// The table booking is disabled, show an alert and prevent further content rendering
echo "<script>
alert('Menu page and ordering food is unavailable now, Try later [disabled by admin]');
window.location.href = 'services.php'; // Redirect to your desired page
</script>";
exit; // Ensure that the script stops execution after redirecting
}
} else {
// Handle the error
echo "Error: " . mysqli_error($conn);
exit; // Ensure that the script stops execution in case of an error
}
?>
<link rel="stylesheet" href="./assets/css/menu.css">
<?php require "includes/header.php"; ?>
<center>
<!--Buttons for navigation to sections within the page-->
<a class="nbutton nbutton1" href="#vegan-section">Vegan</a>
<a class="nbutton nbutton3" href="#non-veg-section">Non-Veg</a>
<a class="nbutton nbutton4" href="#local-taste-section">Local Taste</a>
<a class="nbutton nbutton2" href="#sea-foods-section">Sea Food</a>
<a class="nbutton nbutton5" href="#chinese-section">Chinese</a>
</center>
<div class="veg vegan-section" id="vegan-section"><br>
<center>
<h3>VEGETARIAN</h3>
</center>
<div class="wrap">
<?php
// Base directory where images are stored
$imageDirectory = 'assets/images/menu/veg/';
// Fetching veg menu items with image filenames
$vegMenuItemQuery = "SELECT `id`, `name`, `description`, `price`, `quantity`, `available`, `image_path` FROM `menu_items` WHERE `category` = 'veg'";
$vegMenuItemResult = mysqli_query($conn, $vegMenuItemQuery);
if ($vegMenuItemResult && mysqli_num_rows($vegMenuItemResult) > 0) {
while ($row = mysqli_fetch_assoc($vegMenuItemResult)) {
// Constructing full image path
$imagePath = $imageDirectory . $row['image_path'];
// Output menu item details along with dynamically constructed image path
echo '<div class="box">';
echo '<div class="box-top">';
echo '<img class="box-image" src="' . $imagePath . '" alt="' . $row['name'] . '">';
echo '<div class="title-flex">';
echo '<h3 class="box-title">' . $row['name'] . '</h3>';
echo '<p class="user-follow-info">' . $row['price'] . ' ₹</p>';
echo '</div>';
echo '<p class="description">' . $row['description'] . '</p>';
echo '</div>';
echo '<form action="manage_cart.php" method="POST">';
if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) {
if ($row['available'] == 1 && $row['quantity'] > 0) {
echo '<button type="submit" name="Add_To_Cart" class="button">Buy</button>';
} else {
echo '<button type="button" class="button" disabled>Not Available</button>';
}
} else {
echo '<a href="new-login.php" class="button">Login to Add to Cart</a>';
}
echo '<input type="hidden" name="Item_name" value="' . $row['name'] . '">';
echo '<input type="hidden" name="price" value="' . $row['price'] . '" >';
echo '</form>';
echo '</div>';
}
} else {
echo '<p>No vegetarian items available.</p>';
}
?>
</div>
</div>
<br>
<div class="non-veg non-veg-section" id="non-veg-section"><br>
<center>
<h3>NON-VEG</h3>
</center>
<div class="wrap">
<?php
// Base directory where images are stored
$imageDirectory = 'assets/images/menu/non-veg/';
// Fetching veg menu items with image filenames
$vegMenuItemQuery = "SELECT `id`, `name`, `description`, `price`, `quantity`, `available`, `image_path` FROM `menu_items` WHERE `category` = 'Non-Veg'";
$vegMenuItemResult = mysqli_query($conn, $vegMenuItemQuery);
if ($vegMenuItemResult && mysqli_num_rows($vegMenuItemResult) > 0) {
while ($row = mysqli_fetch_assoc($vegMenuItemResult)) {
// Constructing full image path
$imagePath = $imageDirectory . $row['image_path'];
// Output menu item details along with dynamically constructed image path
echo '<div class="box">';
echo '<div class="box-top">';
echo '<img class="box-image" src="' . $imagePath . '" alt="' . $row['name'] . '">';
echo '<div class="title-flex">';
echo '<h3 class="box-title">' . $row['name'] . '</h3>';
echo '<p class="user-follow-info">' . $row['price'] . ' ₹</p>';
echo '</div>';
echo '<p class="description">' . $row['description'] . '</p>';
echo '</div>';
echo '<form action="manage_cart.php" method="POST">';
if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) {
if ($row['available'] == 1 && $row['quantity'] > 0) {
echo '<button type="submit" name="Add_To_Cart" class="button">Buy</button>';
} else {
echo '<button type="button" class="button" disabled>Not Available</button>';
}
} else {
echo '<a href="new-login.php" class="button">Login to Add to Cart</a>';
}
echo '<input type="hidden" name="Item_name" value="' . $row['name'] . '">';
echo '<input type="hidden" name="price" value="' . $row['price'] . '" >';
echo '</form>';
echo '</div>';
}
} else {
echo '<p>No vegetarian items available.</p>';
}
?>
</div>
</div>
<br>
<div class="local-taste local-taste-section" id="local-taste-section"><br>
<center>
<h3>LOCAL TASTE</h3>
</center>
<div class="wrap">
<?php
// Base directory where images are stored
$imageDirectory = 'assets/images/menu/local/';
// Fetching veg menu items with image filenames
$vegMenuItemQuery = "SELECT `id`, `name`, `description`, `price`, `quantity`, `available`, `image_path` FROM `menu_items` WHERE `category` = 'Local Taste'";
$vegMenuItemResult = mysqli_query($conn, $vegMenuItemQuery);
if ($vegMenuItemResult && mysqli_num_rows($vegMenuItemResult) > 0) {
while ($row = mysqli_fetch_assoc($vegMenuItemResult)) {
// Constructing full image path
$imagePath = $imageDirectory . $row['image_path'];
// Output menu item details along with dynamically constructed image path
echo '<div class="box">';
echo '<div class="box-top">';
echo '<img class="box-image" src="' . $imagePath . '" alt="' . $row['name'] . '">';
echo '<div class="title-flex">';
echo '<h3 class="box-title">' . $row['name'] . '</h3>';
echo '<p class="user-follow-info">' . $row['price'] . ' ₹</p>';
echo '</div>';
echo '<p class="description">' . $row['description'] . '</p>';
echo '</div>';
echo '<form action="manage_cart.php" method="POST">';
if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) {
if ($row['available'] == 1 && $row['quantity'] > 0) {
echo '<button type="submit" name="Add_To_Cart" class="button">Buy</button>';
} else {
echo '<button type="button" class="button" disabled>Not Available</button>';
}
} else {
echo '<a href="new-login.php" class="button">Login to Add to Cart</a>';
}
echo '<input type="hidden" name="Item_name" value="' . $row['name'] . '">';
echo '<input type="hidden" name="price" value="' . $row['price'] . '" >';
echo '</form>';
echo '</div>';
}
} else {
echo '<p>No vegetarian items available.</p>';
}
?>
</div>
</div>
<br>
<div class="sea-foods sea-foods-section" id="sea-foods-section"><br>
<center>
<h3>SEA FOOD</h3>
</center>
<div class="wrap">
<?php
// Base directory where images are stored
$imageDirectory = 'assets/images/menu/sea-food/';
// Fetching veg menu items with image filenames
$vegMenuItemQuery = "SELECT `id`, `name`, `description`, `price`, `quantity`, `available`, `image_path` FROM `menu_items` WHERE `category` = 'Seafood'";
$vegMenuItemResult = mysqli_query($conn, $vegMenuItemQuery);
if ($vegMenuItemResult && mysqli_num_rows($vegMenuItemResult) > 0) {
while ($row = mysqli_fetch_assoc($vegMenuItemResult)) {
// Constructing full image path
$imagePath = $imageDirectory . $row['image_path'];
// Output menu item details along with dynamically constructed image path
echo '<div class="box">';
echo '<div class="box-top">';
echo '<img class="box-image" src="' . $imagePath . '" alt="' . $row['name'] . '">';
echo '<div class="title-flex">';
echo '<h3 class="box-title">' . $row['name'] . '</h3>';
echo '<p class="user-follow-info">' . $row['price'] . ' ₹</p>';
echo '</div>';
echo '<p class="description">' . $row['description'] . '</p>';
echo '</div>';
echo '<form action="manage_cart.php" method="POST">';
if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) {
if ($row['available'] == 1 && $row['quantity'] > 0) {
echo '<button type="submit" name="Add_To_Cart" class="button">Buy</button>';
} else {
echo '<button type="button" class="button" disabled>Not Available</button>';
}
} else {
echo '<a href="new-login.php" class="button">Login to Add to Cart</a>';
}
echo '<input type="hidden" name="Item_name" value="' . $row['name'] . '">';
echo '<input type="hidden" name="price" value="' . $row['price'] . '" >';
echo '</form>';
echo '</div>';
}
} else {
echo '<p>No vegetarian items available.</p>';
}
?>
</div>
</div>
<br>
<div class="chineese chinese-section" id="chinese-section"><br>
<center>
<h3>CHINESE</h3>
</center>
<div class="wrap">
<?php
// Base directory where images are stored
$imageDirectory = 'assets/images/menu/chinese/';
// Fetching veg menu items with image filenames
$vegMenuItemQuery = "SELECT `id`, `name`, `description`, `price`, `quantity`, `available`, `image_path` FROM `menu_items` WHERE `category` = 'Chinese'";
$vegMenuItemResult = mysqli_query($conn, $vegMenuItemQuery);
if ($vegMenuItemResult && mysqli_num_rows($vegMenuItemResult) > 0) {
while ($row = mysqli_fetch_assoc($vegMenuItemResult)) {
// Constructing full image path
$imagePath = $imageDirectory . $row['image_path'];
// Output menu item details along with dynamically constructed image path
echo '<div class="box">';
echo '<div class="box-top">';
echo '<img class="box-image" src="' . $imagePath . '" alt="' . $row['name'] . '">';
echo '<div class="title-flex">';
echo '<h3 class="box-title">' . $row['name'] . '</h3>';
echo '<p class="user-follow-info">' . $row['price'] . ' ₹</p>';
echo '</div>';
echo '<p class="description">' . $row['description'] . '</p>';
echo '</div>';
echo '<form action="manage_cart.php" method="POST">';
if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) {
if ($row['available'] == 1 && $row['quantity'] > 0) {
echo '<button type="submit" name="Add_To_Cart" class="button">Buy</button>';
} else {
echo '<button type="button" class="button" disabled>Not Available</button>';
}
} else {
echo '<a href="new-login.php" class="button">Login to Add to Cart</a>';
}
echo '<input type="hidden" name="Item_name" value="' . $row['name'] . '">';
echo '<input type="hidden" name="price" value="' . $row['price'] . '" >';
echo '</form>';
echo '</div>';
}
} else {
echo '<p>No vegetarian items available.</p>';
}
?>
</div>
</div>
<br>
<?php require "includes/footer.php"; ?>