-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
282 lines (248 loc) · 11.7 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
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
<?php
require 'config/config.php';
$data = [];
if(isset($_POST['search'])) {
// Get data from FORM
$keywords = $_POST['keywords'];
$location = $_POST['location'];
//keywords based search
$keyword = explode(',', $keywords);
$concats = "(";
$numItems = count($keyword);
$i = 0;
foreach ($keyword as $key => $value) {
# code...
if(++$i === $numItems){
$concats .= "'".$value."'";
}else{
$concats .= "'".$value."',";
}
}
$concats .= ")";
//end of keywords based search
//location based search
$locations = explode(',', $location);
$loc = "(";
$numItems = count($locations);
$i = 0;
foreach ($locations as $key => $value) {
# code...
if(++$i === $numItems){
$loc .= "'".$value."'";
}else{
$loc .= "'".$value."',";
}
}
$loc .= ")";
//end of location based search
try {
//foreach ($keyword as $key => $value) {
# code...
$stmt = $connect->prepare("SELECT * FROM room_rental_registrations_apartment WHERE country IN $concats OR country IN $loc OR state IN $concats OR state IN $loc OR city IN $concats OR city IN $loc OR address IN $concats OR address IN $loc OR rooms IN $concats OR landmark IN $concats OR landmark IN $loc OR rent IN $concats OR deposit IN $concats");
$stmt->execute();
$data2 = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt = $connect->prepare("SELECT * FROM room_rental_registrations WHERE country IN $concats OR country IN $loc OR state IN $concats OR state IN $loc OR city IN $concats OR city IN $loc OR rooms IN $concats OR address IN $concats OR address IN $loc OR landmark IN $concats OR rent IN $concats OR deposit IN $concats");
$stmt->execute();
$data8 = $stmt->fetchAll(PDO::FETCH_ASSOC);
$data = array_merge($data2, $data8);
}catch(PDOException $e) {
$errMsg = $e->getMessage();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>App</title>
<!-- Bootstrap core CSS -->
<link href="assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom fonts for this template -->
<link href="assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<link href='https://fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'>
<!-- Custom styles for this template -->
<link href="assets/css/rent.css" rel="stylesheet">
<link href="assets/css/style.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark fixed-top" id="mainNav">
<div class="container">
<a class="navbar-brand js-scroll-trigger" href="#page-top">Logo/Home</a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
Menu
<i class="fa fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav text-uppercase ml-auto">
<li class="nav-item">
<a class="nav-link js-scroll-trigger" href="#search">Search</a>
</li>
<?php
if(empty($_SESSION['username'])){
echo '<li class="nav-item">';
echo '<a class="nav-link" href="./auth/login.php">Login</a>';
echo '</li>';
}else{
echo '<li class="nav-item">';
echo '<a class="nav-link" href="./auth/dashboard.php">Home</a>';
echo '</li>';
}
?>
<li class="nav-item">
<a class="nav-link" href="./auth/register.php">Register</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Header -->
<header class="masthead">
<div class="container">
<div class="intro-text">
<div class="intro-lead-in">Welcome To Room Rental Registration!</div>
<div class="intro-heading text-uppercase">It's Nice To See You<br></div>
</div>
</div>
</header>
<!-- Search -->
<section id="search">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading text-uppercase">Search</h2>
<h3 class="section-subheading text-muted">Search rooms or homes for hire.</h3>
</div>
</div>
<div class="row">
<div class="col-md-12">
<form action="" method="POST" class="center" novalidate>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input class="form-control" id="keywords" name="keywords" type="text" placeholder="Key words(Ex: 1bhk,rent..)" required data-validation-required-message="Please enter keywords">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<input class="form-control" id="location" type="text" name="location" placeholder="Location" required data-validation-required-message="Please enter location.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<button id="" class="btn btn-success btn-md text-uppercase" name="search" value="search" type="submit">Search</button>
</div>
</div>
</div>
</form>
<?php
if(isset($errMsg)){
echo '<div style="color:#FF0000;text-align:center;font-size:17px;">'.$errMsg.'</div>';
}
if(count($data) !== 0){
echo "<h2 class='text-center'>List of Apartment Details</h2>";
}else{
//echo "<h2 class='text-center' style='color:red;'>Try Some other keywords</h2>";
}
?>
<?php
foreach ($data as $key => $value) {
echo '<div class="card card-inverse card-info mb-3" style="padding:1%;">
<div class="card-block">';
// echo '<a class="btn btn-warning float-right" href="update.php?id='.$value['id'].'&act=';if(isset($value['ap_number_of_plats'])){ echo "ap"; }else{ echo "indi"; } echo '">Edit</a>';
echo '<div class="row">
<div class="col-4">
<h4 class="text-center">Owner Details</h4>';
echo '<p><b>Owner Name: </b>'.$value['fullname'].'</p>';
echo '<p><b>Mobile Number: </b>'.$value['mobile'].'</p>';
echo '<p><b>Alternate Number: </b>'.$value['alternat_mobile'].'</p>';
echo '<p><b>Email: </b>'.$value['email'].'</p>';
echo '<p><b>Country: </b>'.$value['country'].'</p><p><b> State: </b>'.$value['state'].'</p><p><b> City: </b>'.$value['city'].'</p>';
if ($value['image'] !== 'uploads/') {
# code...
echo '<img src="app/'.$value['image'].'" width="100">';
}
echo '</div>
<div class="col-5">
<h4 class="text-center">Room Details</h4>';
// echo '<p><b>Country: </b>'.$value['country'].'<b> State: </b>'.$value['state'].'<b> City: </b>'.$value['city'].'</p>';
echo '<p><b>Plot Number: </b>'.$value['plot_number'].'</p>';
if(isset($value['sale'])){
echo '<p><b>Sale: </b>'.$value['sale'].'</p>';
}
if(isset($value['apartment_name']))
echo '<div class="alert alert-success" role="alert"><p><b>Apartment Name: </b>'.$value['apartment_name'].'</p></div>';
if(isset($value['ap_number_of_plats']))
echo '<div class="alert alert-success" role="alert"><p><b>Plat Number: </b>'.$value['ap_number_of_plats'].'</p></div>';
echo '<p><b>Available Rooms: </b>'.$value['rooms'].'</p>';
echo '<p><b>Address: </b>'.$value['address'].'</p><p><b> Landmark: </b>'.$value['landmark'].'</p>';
echo '</div>
<div class="col-3">
<h4>Other Details</h4>';
echo '<p><b>Accommodation: </b>'.$value['accommodation'].'</p>';
echo '<p><b>Description: </b>'.$value['description'].'</p>';
if($value['vacant'] == 0){
echo '<div class="alert alert-danger" role="alert"><p><b>Occupied</b></p></div>';
}else{
echo '<div class="alert alert-success" role="alert"><p><b>Vacant</b></p></div>';
}
echo '</div>
</div>
</div>
</div>';
}
?>
</div>
</div>
</div>
<br><br><br><br><br><br>
</section>
<!-- Footer -->
<footer style="background-color: #ccc;">
<div class="container">
<div class="row">
<div class="col-md-4">
<span class="copyright">Copyright © Your Website 2018</span>
</div>
<div class="col-md-4">
<ul class="list-inline social-buttons">
<li class="list-inline-item">
<a href="#">
<i class="fa fa-twitter"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#">
<i class="fa fa-facebook"></i>
</a>
</li>
<li class="list-inline-item">
<a href="#">
<i class="fa fa-linkedin"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
</footer>
<!-- Bootstrap core JavaScript -->
<script src="assets/plugins/jquery/jquery.min.js"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<!-- Plugin JavaScript -->
<script src="assets/plugins/jquery-easing/jquery.easing.min.js"></script>
<!-- Contact form JavaScript -->
<script src="assets/js/jqBootstrapValidation.js"></script>
<script src="assets/js/contact_me.js"></script>
<!-- Custom scripts for this template -->
<script src="assets/js/rent.js"></script>
</body>
</html>