-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcar-listing.php
More file actions
305 lines (272 loc) · 11.2 KB
/
Copy pathcar-listing.php
File metadata and controls
305 lines (272 loc) · 11.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
<?php
/**
* ============================================================================
* Car Rental System - Car Listing Page
* ============================================================================
*
* This file handles the display of the vehicle inventory. It fetches vehicle
* details from the database, supports pagination (if implemented), and provides
* sidebar filters for users to refine their search by Brand or Fuel Type.
*
* ----------------------------------------------------------------------------
* AUTHORSHIP & CREDITS (Amey Thakur)
* ----------------------------------------------------------------------------
* This project was developed by the Amey Thakur:
* - Amey Thakur
*
*
*
*
* @package CarRentalSystem
* @subpackage Frontend
* @author Amey Thakur (Lead)
* @link https://github.com/Amey-Thakur
* @repository https://github.com/Amey-Thakur/CAR-RENTAL-SYSTEM
* @version 1.0.0
* @date 2021-01-19
* @license MIT
*
* @requires PHP 7.0+
* @requires MySQL 5.7+
* @requires Bootstrap 3.x
* @requires jQuery 3.x
*
* ============================================================================
* CHANGE LOG:
* ----------------------------------------------------------------------------
* 2021-01-19 - Initial release - Amey Thakur
* ============================================================================
*/
/**
* Session Initialization
*
* Starts any existing session to ensure user state (login status) is preserved
* across the navigation.
*/
session_start();
/**
* Database Configuration
*
* Includes the main configuration file to establish the PDO database connection.
*/
include('includes/config.php');
/**
* Error Reporting
*
* Suppresses error display for production use case.
*/
error_reporting(0);
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<!--
============================================================================
META INFORMATION & SEO
============================================================================
-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="keywords" content="">
<meta name="description" content="">
<title>AHNA | CAR Rental</title>
<!--
============================================================================
STYLESHEET DEPENDENCIES
============================================================================
1. Bootstrap: Framework for responsive layout.
2. Style.css: Custom override styles.
3. Owl Carousel: Touch-enabled jQuery plugin for carousels.
4. Slick: Standard carousel.
5. Bootstrap Slider: Input range sliders.
6. FontAwesome: Iconography.
-->
<link rel="stylesheet" href="assets/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="assets/css/style.css" type="text/css">
<link rel="stylesheet" href="assets/css/owl.carousel.css" type="text/css">
<link rel="stylesheet" href="assets/css/owl.transitions.css" type="text/css">
<link href="assets/css/slick.css" rel="stylesheet">
<link href="assets/css/bootstrap-slider.min.css" rel="stylesheet">
<link href="assets/css/font-awesome.min.css" rel="stylesheet">
<!-- Apple Touch Icons for iOS home screen shortcuts -->
<link rel="apple-touch-icon-precomposed" sizes="144x144"
href="assets/images/favicon-icon/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114"
href="assets/images/favicon-icon/apple-touch-icon-114-precomposed.html">
<link rel="apple-touch-icon-precomposed" sizes="72x72"
href="assets/images/favicon-icon/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="assets/images/favicon-icon/apple-touch-icon-57-precomposed.png">
<!-- Favicon -->
<link rel="shortcut icon" href="assets/images/favicon-icon/favicon.png">
<!-- Typography: Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Play&display=swap" rel="stylesheet">
<!-- Inline styles for component-specific overrides -->
<style>
div {
font-family: Play;
font-size: 20px;
color: BLUE;
}
</style>
</head>
<body style="background-color:aqua;">
<!--
============================================================================
HEADER COMPONENT
============================================================================
Includes the common navigation bar.
-->
<?php include('includes/header.php'); ?>
<br /><br />
<!-- Main Grid Container -->
<div class="container">
<div class="row">
<!--
========================================================================
PRIMARY CONTENT COLUMN (Right Side)
Contains the list of vehicles.
========================================================================
(col-md-push-3 used for visual reordering if needed, ensuring content comes first in DOM)
-->
<div class="col-md-9 col-md-push-3">
<!-- Result Count / Sorting Options -->
<div class="result-sorting-wrapper" style="background-color:black;">
<div class="sorting-count" style="color:blue;">
<?php
// Query 1: Fetch total count of vehicles
$sql = "SELECT id from tblvehicles";
$query = $dbh->prepare($sql);
$query->bindParam(':vhid', $vhid, PDO::PARAM_STR); // Note: :vhid is not used in the query string above but bound here.
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
$cnt = $query->rowCount();
?>
<p style="color:blue;">
<center><span style="color:blue;"><?php echo htmlentities($cnt); ?> CARS</span></center>
</p>
</div>
</div>
<?php
// Query 2: Fetch vehicle details along with Brand Name using a JOIN operation
$sql = "SELECT tblvehicles.*,tblbrands.BrandName,tblbrands.id as bid from tblvehicles join tblbrands on tblbrands.id=tblvehicles.VehiclesBrand";
$query = $dbh->prepare($sql);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
$cnt = 1;
// Check if results exist
if ($query->rowCount() > 0) {
// Iterate through each vehicle record
foreach ($results as $result) {
?>
<!-- Vehicle Card Component -->
<div class="product-listing-m gray-bg">
<div class="product-listing-img">
<!-- Vehicle Image -->
<img src="admin/img/vehicleimages/<?php echo htmlentities($result->Vimage1); ?>" class="img-responsive"
alt="Image" /> </a>
</div>
<div class="product-listing-content">
<!-- Vehicle Title & Brand -->
<h5>
<a href="vehicle-details.php?vhid=<?php echo htmlentities($result->id); ?>">
<?php echo htmlentities($result->BrandName); ?>, <?php echo htmlentities($result->VehiclesTitle); ?>
</a>
</h5>
<!-- Pricing Information -->
<p class="list-price">₹<?php echo htmlentities($result->PricePerDay); ?> Per Day Rental</p>
<!-- Key Attributes List -->
<ul>
<li><i class="fa fa-user" aria-hidden="true"></i><?php echo htmlentities($result->SeatingCapacity); ?>
seats</li>
<li><i class="fa fa-calendar" aria-hidden="true"></i><?php echo htmlentities($result->ModelYear); ?> model
</li>
<li><i class="fa fa-car" aria-hidden="true"></i><?php echo htmlentities($result->FuelType); ?></li>
</ul>
<!-- Action Button: View Details -->
<a href="vehicle-details.php?vhid=<?php echo htmlentities($result->id); ?>" class="btn"
style="background-color:blue;">View Details </a>
</div>
</div>
<?php
} // End foreach
} // End if
?>
</div>
<!--
========================================================================
SIDEBAR WIDGETS (Left Side)
Contains search filters for Brands and Fuel Type.
========================================================================
-->
<aside class="col-md-3 col-md-pull-9">
<div class="sidebar_widget" style="background-color:black;">
<div class="widget_heading">
<h5 style="color:blue;">> Find Your Car </h5>
</div>
<div class="sidebar_filter">
<!-- Filter Form: Submits to search-carresult.php -->
<form action="search-carresult.php" method="post">
<!-- Filter: Select Brand -->
<div class="form-group select">
<select class="form-control" name="brand">
<option>Select Brand</option>
<?php
// Query 3: Fetch all brands for the dropdown
$sql = "SELECT * from tblbrands ";
$query = $dbh->prepare($sql);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
$cnt = 1;
if ($query->rowCount() > 0) {
foreach ($results as $result) { ?>
<option value="<?php echo htmlentities($result->id); ?>">
<?php echo htmlentities($result->BrandName); ?>
</option>
<?php }
} ?>
</select>
</div>
<!-- Filter: Select Fuel Type -->
<div class="form-group select">
<select class="form-control" name="fueltype">
<option>Select Fuel Type</option>
<option value="Petrol">Petrol</option>
<option value="Diesel">Diesel</option>
</select>
</div>
<!-- Submit Button -->
<div class="form-group">
<button type="submit" class="btn btn-block" style="background-color:blue;">SEARCH</button>
</div>
</form>
</div>
</div>
</aside>
<!-- /Sidebar -->
</div>
</div>
<br /><br />
<!--
============================================================================
FOOTER & MODALS
============================================================================
-->
<?php include('includes/footer.php'); ?>
<?php include('includes/login.php'); ?>
<?php include('includes/registration.php'); ?>
<?php include('includes/forgotpassword.php'); ?>
<!--
============================================================================
JAVASCRIPT LIBRARIES
============================================================================
-->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/interface.js"></script>
<script src="assets/switcher/js/switcher.js"></script>
<script src="assets/js/bootstrap-slider.min.js"></script>
<script src="assets/js/slick.min.js"></script>
<script src="assets/js/owl.carousel.min.js"></script>
</body>
</html>