53 lines
2.0 KiB
PHP
53 lines
2.0 KiB
PHP
<?php
|
|
if (session_status() === PHP_SESSION_NONE) {
|
|
session_start();
|
|
}
|
|
require_once __DIR__ . '/../db/config.php';
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Premium Car Marketplace Afghanistan';
|
|
|
|
// List of admin pages that use the sidebar layout
|
|
$adminPages = [
|
|
'admin_dashboard.php',
|
|
'admin_cars.php',
|
|
'admin_users.php',
|
|
'admin_messages.php',
|
|
'admin_purchases.php'
|
|
];
|
|
$currentPage = basename($_SERVER['SCRIPT_NAME']);
|
|
$isAdminPage = in_array($currentPage, $adminPages);
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>AfgCars | Premium Marketplace</title>
|
|
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>">
|
|
|
|
<link rel="stylesheet" href="assets/css/fonts.css">
|
|
<link rel="stylesheet" href="assets/css/style.css?v=<?= time() ?>">
|
|
</head>
|
|
<body>
|
|
<?php if (!$isAdminPage): ?>
|
|
<nav>
|
|
<a href="index.php" class="logo">AfgCars</a>
|
|
<ul class="nav-links">
|
|
<li><a href="index.php">Home</a></li>
|
|
<li><a href="cars.php">Marketplace</a></li>
|
|
<li><a href="about.php">About</a></li>
|
|
<li><a href="contact.php">Contact</a></li>
|
|
</ul>
|
|
<div class="nav-actions" style="display: flex; align-items: center; gap: 1rem;">
|
|
<?php if (isset($_SESSION['user_id'])): ?>
|
|
<?php if (($_SESSION['role'] ?? '') === 'admin'): ?>
|
|
<a href="admin_dashboard.php" class="btn-auth">Admin Panel</a>
|
|
<?php else: ?>
|
|
<a href="dashboard.php" class="btn-auth">My Account</a>
|
|
<?php endif; ?>
|
|
<a href="logout.php" class="btn-auth" style="border-color: rgba(255, 71, 87, 0.3); color: var(--danger);">Logout</a>
|
|
<?php else: ?>
|
|
<a href="login.php" class="btn-auth">Login / Register</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</nav>
|
|
<?php endif; ?>
|