38468-vm/index.php
Flatlogic Bot 0c0cc2ad68 sadiq
2026-02-16 04:29:28 +00:00

96 lines
4.2 KiB
PHP

<?php
require_once __DIR__ . '/db/config.php';
// Fetch "Hot Deal" cars for the landing page
try {
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM cars WHERE is_hot_deal = 1 LIMIT 6");
$stmt->execute();
$hot_deals = $stmt->fetchAll();
} catch (PDOException $e) {
$hot_deals = [];
}
// Meta tags from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Premium Car Marketplace in Afghanistan - University Final-Year Project 2026.';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
include __DIR__ . '/includes/header.php';
?>
<main>
<!-- Hero Section -->
<section class="hero">
<div class="container">
<h1>Premium Car Marketplace <br> <span class="text-gold">Afghanistan 2026</span></h1>
<p>Experience the future of car buying with our enterprise-level marketplace. Premium cars, verified sellers, and smooth transactions.</p>
<div class="hero-btns">
<a href="cars.php" class="btn btn-primary">Browse All Cars</a>
<a href="#hot-deals" class="btn btn-outline" style="margin-left: 15px;">Hot Deals</a>
</div>
</div>
</section>
<!-- Stats Section -->
<section class="container mt-4">
<div class="row">
<div class="col-4">
<div class="glass-card text-center">
<h2 class="text-gold">20+</h2>
<p class="text-muted">Premium Cars</p>
</div>
</div>
<div class="col-4">
<div class="glass-card text-center">
<h2 class="text-gold">1.2k</h2>
<p class="text-muted">Active Users</p>
</div>
</div>
<div class="col-4">
<div class="glass-card text-center">
<h2 class="text-gold">4</h2>
<p class="text-muted">Major Cities</p>
</div>
</div>
</div>
</section>
<!-- Hot Deals Section -->
<section id="hot-deals" class="car-grid">
<div class="container">
<h2 class="section-title">Hot <span class="text-gold">Deals</span></h2>
<div class="row">
<?php if (empty($hot_deals)): ?>
<div class="col-12 text-center">
<p class="text-muted">No hot deals available at the moment.</p>
</div>
<?php else: ?>
<?php foreach ($hot_deals as $car): ?>
<div class="col-4">
<div class="glass-card car-card">
<span class="badge-hot">Hot Deal</span>
<div class="car-img-container">
<img src="<?php echo htmlspecialchars($car['main_image']); ?>" alt="<?php echo htmlspecialchars($car['brand'] . ' ' . $car['model']); ?>" class="car-img" onerror="this.src='https://images.pexels.com/photos/170811/pexels-photo-170811.jpeg?auto=compress&cs=tinysrgb&w=600'">
</div>
<div class="car-info">
<h3><?php echo htmlspecialchars($car['brand'] . ' ' . $car['model']); ?></h3>
<div class="car-details">
<span>Year: <?php echo $car['year']; ?></span>
<span>City: <?php echo htmlspecialchars($car['city']); ?></span>
</div>
<div class="justify-between align-center d-flex">
<span class="car-price">$<?php echo number_format($car['price']); ?></span>
<a href="car_detail.php?id=<?php echo $car['id']; ?>" class="btn btn-outline">Details</a>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
</section>
</main>
<?php include __DIR__ . '/includes/footer.php'; ?>