73 lines
3.1 KiB
PHP
73 lines
3.1 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Restaurants - MajuroEats</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
<?php session_start(); ?>
|
|
<header class="navbar">
|
|
<div class="container">
|
|
<div class="navbar-inner">
|
|
<a href="/" class="logo">MajuroEats</a>
|
|
<nav class="nav-links">
|
|
<a href="index.php#how-it-works">How It Works</a>
|
|
<a href="restaurants.php">Restaurants</a>
|
|
<a href="index.php#contact">Contact</a>
|
|
<?php if (isset($_SESSION['user_id'])): ?>
|
|
<?php if ($_SESSION['user_role'] === 'customer'): ?>
|
|
<a href="customer_dashboard.php">My Account</a>
|
|
<?php elseif ($_SESSION['user_role'] === 'restaurant_owner'): ?>
|
|
<a href="dashboard.php">Dashboard</a>
|
|
<?php endif; ?>
|
|
<a href="logout.php">Log Out</a>
|
|
<?php else: ?>
|
|
<a href="login.php">Login</a>
|
|
<a href="customer_signup.php" class="btn btn-primary">Sign Up</a>
|
|
<?php endif; ?>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="container section">
|
|
<h1 class="page-title">Explore Restaurants</h1>
|
|
<div class="restaurants-grid">
|
|
<?php
|
|
require_once 'db/config.php';
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->query('SELECT id, name, description, image_url FROM restaurants ORDER BY name');
|
|
$restaurants = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
if (count($restaurants) > 0) {
|
|
foreach ($restaurants as $restaurant) {
|
|
echo '<a href="menu.php?id=' . htmlspecialchars($restaurant['id']) . '" class="restaurant-card">';
|
|
echo '<div class="restaurant-card-image" style="background-image: url('' . htmlspecialchars($restaurant['image_url'] ? $restaurant['image_url'] : 'assets/images/placeholder.jpg') . '');"></div>';
|
|
echo '<div class="restaurant-card-content">';
|
|
echo '<h3>' . htmlspecialchars($restaurant['name']) . '</h3>';
|
|
echo '<p>' . htmlspecialchars($restaurant['description']) . '</p>';
|
|
echo '</div>';
|
|
echo '</a>';
|
|
}
|
|
} else {
|
|
echo '<p>No restaurants found.</p>';
|
|
}
|
|
} catch (PDOException $e) {
|
|
echo '<p>Error fetching restaurants. Please try again later.</p>';
|
|
}
|
|
?>
|
|
</div>
|
|
</main>
|
|
|
|
<footer>
|
|
<div class="container">
|
|
<p>© 2025 MajuroEats. All Rights Reserved.</p>
|
|
</div>
|
|
</footer>
|
|
|
|
</body>
|
|
</html>
|