| Server IP : 173.209.174.21 / Your IP : 216.73.216.89 Web Server : Apache/2.4.58 (Ubuntu) System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : nodor ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/thelittlebigshow/app.05-08-26/admin/ |
Upload File : |
<?php
session_start();
ob_start();
require_once 'config/config.php';
require_once BASE_PATH . '/includes/auth_validate.php';
include_once("../db.php");
include BASE_PATH . '/includes/header.php';
// Category name from URL
$category = isset($_GET['cat']) ? trim($_GET['cat']) : '';
$currentYear = date('Y');
?>
<style>
label{
font-size: 16px !important;
}
p{
font-size: 18px !important;
}
.flex-page-header{
display: flex;
justify-content: space-between;
align-items: center;
}
</style>
<!-- Main container -->
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<div class="page-header flex-page-header">
<h1>Vehicles Of <?php echo htmlspecialchars($category); ?></h1>
<a href="categories.php" class="btn btn-primary">Back</a>
</div>
</div>
</div>
<?php include BASE_PATH . '/includes/flash_messages.php';?>
<!-- Table -->
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th width="13%">Name</th>
<th width="13%">Model</th>
<th width="13%">Vote</th>
<th width="13%">Category</th>
</tr>
</thead>
<tbody>
<?php
if ($category === '') {
?>
<tr>
<td colspan="4" align="center">No Category Selected</td>
</tr>
<?php
} else {
// ONLY show current-year vehicles that are active (status = 1)
$sql = "SELECT name, vehicle_model, vote_status, category
FROM vehicles
WHERE category = ?
AND YEAR(created_date) = ?
AND status = 1
ORDER BY vote_status DESC";
if ($stmt = mysqli_prepare($conn, $sql)) {
mysqli_stmt_bind_param($stmt, "si", $category, $currentYear);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
if ($result && mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
?>
<tr>
<td><?php echo htmlspecialchars($row['name']); ?></td>
<td><?php echo htmlspecialchars($row['vehicle_model']); ?></td>
<td><?php echo (int)$row['vote_status']; ?></td>
<td><?php echo htmlspecialchars($row['category']); ?></td>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="4" align="center">No Related Data Found</td>
</tr>
<?php
}
mysqli_stmt_close($stmt);
} else {
?>
<tr>
<td colspan="4" align="center">Query error.</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<!-- //Table -->
</div>
<!-- //Main container -->
<?php include BASE_PATH . '/includes/footer.php';?>