37650-vm/index.php
Flatlogic Bot 9643b213d0 sad
2026-01-21 08:43:40 +00:00

124 lines
6.3 KiB
PHP

<?php
session_start();
require_once __DIR__ . '/db/config.php';
// Fetch Featured Cars
$cars = [];
try {
$pdo = db();
// Fetch more cars to showcase the design
$stmt = $pdo->query("SELECT * FROM cars WHERE status = 'approved' ORDER BY created_at DESC LIMIT 8");
$cars = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (Exception $e) {
error_log("DB Error: " . $e->getMessage());
// You can set a user-friendly error message here if you want
}
// Meta variables from environment - important for platform integration
$projectName = getenv('PROJECT_NAME') ?: 'Car Sells in Afghanistan';
$projectDesc = getenv('PROJECT_DESCRIPTION') ?: 'The best marketplace for buying and selling cars in Afghanistan.';
$projectImage = getenv('PROJECT_IMAGE_URL') ?: 'https://images.pexels.com/photos/120049/pexels-photo-120049.jpeg?auto=compress&cs=tinysrgb&w=1200';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo htmlspecialchars($projectName); ?> - Modern Car Marketplace</title>
<meta name="description" content="<?php echo htmlspecialchars($projectDesc); ?>">
<!-- Open Graph / Social Media Meta -->
<meta property="og:title" content="<?php echo htmlspecialchars($projectName); ?>">
<meta property="og:description" content="<?php echo htmlspecialchars($projectDesc); ?>">
<meta property="og:image" content="<?php echo htmlspecialchars($projectImage); ?>">
<!-- Libs -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<?php include 'partials/navbar.php'; ?>
<!-- Hero Section -->
<header class="container-fluid vh-100 d-flex align-items-center justify-content-center text-white text-center" style="background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('https://images.pexels.com/photos/3764984/pexels-photo-3764984.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2') no-repeat center center/cover;">
<div class="col-lg-8">
<h1 class="display-3">Your Dream Car Awaits</h1>
<p class="lead my-4">Discover the best deals on new and used cars in Afghanistan. Quality, trust, and transparency guaranteed.</p>
<a href="#featured-cars" class="btn btn-primary btn-lg">Explore Cars</a>
<a href="car_list.php" class="btn btn-secondary btn-lg">View All Listings</a>
</div>
</header>
<!-- Featured Cars Section -->
<section id="featured-cars" class="section-padding">
<div class="container">
<div class="text-center mb-5">
<h2 class="h1">Featured Vehicles</h2>
<p class="lead text-muted">Hand-picked selection of our finest cars available right now.</p>
</div>
<div class="row g-4">
<?php if (!empty($cars)): ?>
<?php foreach (array_slice($cars, 0, 4) as $car): // Show only 4 featured ?>
<div class="col-md-6 col-lg-3 d-flex align-items-stretch">
<div class="card w-100">
<img src="<?php echo htmlspecialchars($car['image_url'] ?: 'https://via.placeholder.com/400x300?text=No+Image'); ?>" class="card-img-top" alt="<?php echo htmlspecialchars($car['make'].[ 'model']); ?>">
<div class="card-body d-flex flex-column">
<h5 class="card-title"><?php echo htmlspecialchars($car['make'] . ' ' . $car['model']); ?></h5>
<p class="card-text text-muted"><?php echo htmlspecialchars($car['year']); ?> &bull; <?php echo number_format($car['mileage']); ?> km</p>
<h4 class="mt-auto mb-3 text-end">$<?php echo number_format($car['price']); ?></h4>
<a href="car_detail.php?id=<?php echo $car['id']; ?>" class="btn btn-primary">View Details</a>
</div>
</div>
</div>
<?php endforeach; ?>
<?php else: ?>
<div class="col-12">
<div class="alert alert-info text-center">No featured cars available at the moment. Please check back soon!</div>
</div>
<?php endif; ?>
</div>
</div>
</section>
<!-- How It Works Section -->
<section class="section-padding bg-light">
<div class="container">
<div class="text-center mb-5">
<h2 class="h1">How It Works</h2>
<p class="lead text-muted">A simple, transparent, and secure process.</p>
</div>
<div class="row g-4 text-center">
<div class="col-md-4">
<div class="card p-4 h-100">
<i class="bi bi-search fs-1 text-primary mb-3"></i>
<h3>1. Find Your Car</h3>
<p>Browse our curated selection of high-quality vehicles. Use filters to narrow down your perfect match.</p>
</div>
</div>
<div class="col-md-4">
<div class="card p-4 h-100">
<i class="bi bi-journal-check fs-1 text-primary mb-3"></i>
<h3>2. Book a Test Drive</h3>
<p>Schedule a test drive online. We'll confirm your appointment and prepare the vehicle for you.</p>
</div>
</div>
<div class="col-md-4">
<div class="card p-4 h-100">
<i class="bi bi-patch-check-fill fs-1 text-primary mb-3"></i>
<h3>3. Secure Your Deal</h3>
<p>Finalize your purchase with our secure payment system and drive away in your new car with confidence.</p>
</div>
</div>
</div>
</div>
</section>
<?php include 'partials/footer.php'; ?>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>