-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpg.php
368 lines (359 loc) · 13 KB
/
pg.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
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
<?php
include("config.php");
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=No">
<link rel="stylesheet" type="text/css" href="files/css/bootstrap.css">
<script type="text/javascript" src="files/js/bootstrap.js"></script>
<script type="text/javascript" src="files/js/bootstrap.bundle.js"></script>
<link rel="stylesheet" type="text/css" href="fontawesome/css/all.css">
<link rel="stylesheet" type="text/css" href="navbar.css">
<link rel="icon" href="images/logo1.png">
<title>Prostay</title>
<style>
body {
padding: 0;
margin: 0;
}
.text-yellow {
color: #FFED46;
}
.bg-yellow {
background-color: #FFED46;
}
hr {
background-color: #FFED46;
}
.first-div {
margin-top: 85px;
}
.container {
padding-top: 10px;
padding-bottom: 20px;
}
.form-group {
padding-right: 50px;
}
.form-control {
padding-left: 20px;
}
.btn-yellow {
background-color: #FFED46;
border: 1px solid white;
}
.btn:hover {
border: 1px solid black;
}
.btn-div {
border-radius: 24px;
}
.title {
font-size: 25px;
font-weight: 500;
margin-bottom: 0;
font-family: serif;
}
.filter-title {
font-size: 20px;
font-weight: 400;
margin-bottom: 0;
font-family: serif;
}
.city-title {
font-size: 16px;
font-weight: 450;
margin-bottom: 0;
}
.location-title {
font-size: 16px;
font-weight: 450;
margin-bottom: 0;
}
.category-title {
font-size: 18px;
font-weight: 450;
margin-bottom: 0;
}
.card {
max-width: 400px;
max-height: 600px;
}
.card-img-top {
max-height: 35vh;
min-height: 35vh;
}
.rating {
padding: 7px;
}
.address1 {
font-size: 20px;
font-weight: 450;
margin-bottom: 0;
padding-bottom: 0;
}
.address2 {
font-size: 17px;
font-weight: 425;
margin-bottom: 0;
padding-bottom: 0;
}
.address3 {
font-size: 16px;
font-weight: 425;
margin-bottom: 0;
padding-bottom: 0;
}
.rate {
font-width: 500;
padding: 10px;
}
@media (max-width: 992px) {
}
@media (max-width: 756px) {
}
@media (max-width: 425px) {
.navbar-brand {
max-height: 9vh;
}
.first-div {
margin-top: 85px;
}
.card-img-top {
max-height: auto;
min-height: 35vh;
}
}
@media (max-width: 361px) {
}
@media (max-width: 345px) {
.navbar-brand {
max-height: 8vh;
}
.first-div {
margin-top: 80px;
}
}
@media (max-width: 256px) {
.navbar-brand {
max-height: 5vh;
}
.first-div {
margin-top: 70px;
}
}
</style>
</head>
<body class="bg-light">
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<a href="index.php"><img class="navbar-brand logo-shift" src="images/logo-black.png" alt="logo"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="index.php">HOME <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link active" href="pg.php">PG's</a>
</li>
<li class="nav-item">
<a class="nav-link" href="partners.php">PARTNER WITH US</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.php">ABOUT</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.php">CONTACT</a>
</li>
<li class="nav-item">
<a class="nav-link" href="blogs.php">BLOG</a>
</li>
<?php
if(isset($_SESSION['EMAIL'])) {
?>
<li class="nav-item">
<a class="nav-link" href="logout.php">LOGOUT</a>
</li>
<?php } else { ?>
<li class="nav-item">
<a class="nav-link" href="signup.php">SIGNUP</a>
</li>
<li class="nav-item">
<a class="nav-link" href="login.php">LOGIN</a>
</li>
<?php } ?>
</ul>
</div>
</nav>
<div class="container shadow" style="background-color: white;">
<p class="text-center title" style="margin-top: 90px;">Available PG's</p>
<hr style="height: 2px; margin: 3px;">
<!-- filter -->
<!-- city -->
<p class="text-dark city-title"><i class="fas fa-city"></i>  Search By City</p>
<div class="row">
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
<div class="mr-2" role="group" aria-label="First group">
<div class="col-lg-12 col-md-12 col-sm-12 col-12" style="margin-top: -10px;">
<?php
$sql1 = "SELECT DISTINCT(CITY) FROM addcard";
$result1 = mysqli_query($conn, $sql1) or die("SELECT DISTINCT QUERY NOT RUNNING");
while($row1 = mysqli_fetch_assoc($result1)) {
?>
<?php
if(isset($_GET['CITY']) && $row1['CITY'] == $_GET['CITY']) {
$active = "1px solid black";
} else {
$active = "none";
}
?>
<a href="pg.php?CITY=<?php echo $row1['CITY'];?>" class="btn bg-yellow" style="border-radius: 25px; font-size: 14px; border: <?php echo $active; ?>; text-align: center; margin-top: 8px;"><?php echo $row1['CITY'];?></a>
<?php }?>
</div>
</div>
</div>
</div>
<!-- Locations -->
<?php
if(isset($_GET['CITY'])) {
?>
<p class="text-dark location-title"><i class="fa fa-map-marker"></i>  Available Locations</p>
<div class="row">
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
<div class="mr-2" role="group" aria-label="First group">
<div class="col-lg-12 col-md-12 col-sm-12 col-12"style="margin-top: -6px;">
<?php
$city = $_GET['CITY'];
$sql2 = "SELECT DISTINCT(LOCATION) FROM addcard WHERE CITY = '{$city}'";
$result2 = mysqli_query($conn, $sql2) or die("DISTINCT LOCATION QUERY NOT RUNNING");
while($row2 = mysqli_fetch_assoc($result2)) {
?>
<?php
if(isset($_GET['LOCATION']) && $row2['LOCATION'] == $_GET['LOCATION']) {
$active = "1px solid black";
} else {
$active = "none";
}
?>
<a href="pg.php?CITY=<?php echo $city;?>&LOCATION=<?php echo $row2['LOCATION'];?>" class="btn bg-yellow my-1" style="border-radius: 25px; font-size: 14px; border: <?php echo $active;?>; margin-top: 8px;"><?php echo $row2['LOCATION'];?></a>
<?php }?>
</div>
</div>
</div>
</div>
<?php } ?>
<!-- category -->
<p class="text-dark category-title"><i class="fas fa-male"></i><i class="fas fa-female"></i>  Search By Category</p>
<div class="row">
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
<div class="mr-2" role="group" aria-label="First group">
<div class="col-lg-12 col-md-12 col-sm-12 col-12" style="margin-bottom: 10px;">
<?php
if(isset($_GET['CATEGORY'])) {
if($_GET['CATEGORY'] == "boys") {
$activeboys = "1px solid black";
} else {
$activeboys = " ";
}
if($_GET['CATEGORY'] == "girls") {
$activegirls = "1px solid black";
} else {
$activegirls = " ";
}
}
?>
<?php
if(isset($_GET['CITY']) && isset($_GET['LOCATION']))
{
$city = $_GET['CITY'];
$location = $_GET['LOCATION'];
?>
<a href="pg.php?CITY=<?php echo $city;?>&LOCATION=<?php echo $location;?>&CATEGORY=<?php echo"boys";?>" class="btn bg-yellow" style="border-radius: 25px; border: <?php echo $activeboys; ?>">Boys PG's</a>
<a href="pg.php?CITY=<?php echo $city;?>&LOCATION=<?php echo $location;?>&CATEGORY=<?php echo"girls";?>" class="btn bg-yellow" style="border-radius: 25px; border: <?php echo $activegirls; ?>">Girls PG's</a>
<?php } else if(isset($_GET['CITY'])) { ?>
<a href="pg.php?CITY=<?php echo $city;?>&CATEGORY=<?php echo"boys";?>" class="btn bg-yellow" style="border-radius: 25px; font-size: 14px; border: <?php echo $activeboys; ?>">Boys PG's</a>
<a href="pg.php?CITY=<?php echo $city;?>&CATEGORY=<?php echo"girls";?>" class="btn bg-yellow" style="border-radius: 25px; font-size: 14px;">Girls PG's</a>
<?php } else { ?>
<a href="pg.php?CATEGORY=<?php echo"boys";?>" class="btn bg-yellow" style="border-radius: 25px; font-size: 14px; border: <?php echo $activeboys; ?>">Boys PG's</a>
<a href="pg.php?CATEGORY=<?php echo"girls";?>" class="btn bg-yellow" style="border-radius: 25px; font-size: 14px; border: <?php echo $activegirls; ?>">Girls PG's</a>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- Cards -->
<div class="row">
<?php
if(isset($_GET['CITY']) && isset($_GET['LOCATION']) && isset($_GET['CATEGORY'])) {
$city = $_GET['CITY'];
$location = $_GET['LOCATION'];
$category = $_GET['CATEGORY'];
$sql = "SELECT * FROM addcard WHERE CITY = '{$city}' && LOCATION = '{$location}' && CATEGORY = '{$category}' ORDER BY RATING DESC";
}
else if(isset($_GET['CITY']) && isset($_GET['LOCATION'])) {
$city = $_GET['CITY'];
$location = $_GET['LOCATION'];
$sql = "SELECT * FROM addcard WHERE CITY = '{$city}' && LOCATION = '{$location}' ORDER BY RATING DESC";
}
else if(isset($_GET['CITY']) && isset($_GET['CATEGORY'])) {
$city = $_GET['CITY'];
$category = $_GET['CATEGORY'];
$sql = "SELECT * FROM addcard WHERE CITY = '{$city}' && CATEGORY = '{$category}' ORDER BY RATING DESC";
}
else if(isset($_GET['LOCATION']) && isset($_GET['CATEGORY'])) {
$location = $_GET['LOCATION'];
$category = $_GET['CATEGORY'];
$sql = "SELECT * FROM addcard WHERE LOCATION = '{$location}' && CATEGORY = '{$category}' ORDER BY RATING DESC";
}
else if(isset($_GET['CITY'])) {
$city = $_GET['CITY'];
$sql = "SELECT * FROM addcard WHERE CITY = '{$city}' ORDER BY RATING DESC";
}
else if(isset($_GET['CATEGORY'])) {
$category = $_GET['CATEGORY'];
$sql = "SELECT * FROM addcard WHERE CATEGORY = '{$category}' ORDER BY RATING DESC";
}
else {
$sql = "SELECT * FROM addcard ORDER BY RATING DESC";
}
$result = mysqli_query($conn, $sql) or die("Filter QUERY NOT RUNNING");
if(mysqli_num_rows($result) == 0) {
echo $category." pg's are not available in this location";
} else {
while($row = mysqli_fetch_assoc($result)) {
?>
<div class="col-lg-4 col-md-4 col-sm-12 col-12" style="margin-bottom: 20px">
<div class="card mx-auto" style="border: 3px solid #FFED46;">
<a href="pg-details.php?ID=<?php echo $row['ID'];?>&RATING=<?php echo $row['RATING'];?>"><img class="card-img-top" src="images/<?php echo $row['IMAGE'];?>" alt="Card image"/></a>
<div class="card-body bg-light">
<?php if(strlen($row['PGNAME']) > 21){?>
<p class="card-text address1" style="margin-bottom: 3px;"><?php echo substr($row['PGNAME'],0,20)."...."; ?></p><span class="bg-yellow" style="float:right; padding: 5px 6px; margin-top: -35px;"><i class="fas fa-star"><?php echo $row['RATING'];?></i></span>
<?php } else {?>
<p class="card-text address1" style="margin-bottom: 3px;"><?php echo $row['PGNAME']; ?></p><span class="bg-yellow" style="float:right; padding: 5px 6px; margin-top: -35px;"><i class="fas fa-star"><?php echo $row['RATING'];?></i></span>
<?php }?>
<?php if(strlen($row['ADDRESS3']) > 25){?>
<p class="card-text text-muted address2" style="margin-bottom: 3px;"><?php echo substr($row['ADDRESS3'],0,25)."...."; ?></p>
<?php } else {?>
<p class="card-text text-muted address2" style="margin-bottom: 3px;"><?php echo $row['ADDRESS3']; ?></p>
<?php }?>
<p class="card-text text-muted address3" style="margin-bottom: 3px;"><?php echo $row['CITY']; ?></p>
<h4 class="card-text bg-dark text-light text-center" style="font-size: 19px; font-width: 500; padding: 3px 5px;">STARTING RENT <i class="fas fa-rupee-sign"></i><span class="text-yellow"><?php echo $row['PRICE']; ?></span></h4>
<div align="right">
<a href="pg-details.php?ID=<?php echo $row['ID'];?>&RATING=<?php echo $row['RATING'];?>" class="btn btn-warning">Check PG Reviews</a>
</div>
</div> <!-- card body div -->
</div> <!-- card div -->
</div>
<?php } }?>
</div> <!-- row div -->
</div> <!-- container div -->
<br><br>
<!-- footer -->
<?php include('footer.php');?>
</body>
</html>