34000-vm/index.php
2025-09-10 21:21:48 +00:00

230 lines
11 KiB
PHP

<?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GiftShop - Gifts for Every Occasion</title>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<!-- Google Fonts & Custom CSS -->
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-light bg-transparent fixed-top">
<div class="container">
<a class="navbar-brand" href="#">GiftShop</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a class="nav-link" href="#products">Products</a></li>
<li class="nav-item"><a class="nav-link" href="#about">About</a></li>
<li class="nav-item"><a class="nav-link" href="#contact">Contact</a></li>
<li class="nav-item">
<a class="nav-link" href="basket.php">
<i class="bi bi-cart"></i> Basket (<?= array_sum($_SESSION['basket'] ?? []) ?>)
</a>
</li>
</ul>
<a href="#products" class="btn btn-primary ms-lg-3">Browse Catalog</a>
</div>
</div>
</nav>
<!-- Hero Section -->
<header id="home" class="hero text-center text-white">
<div class="container">
<h1 class="display-4">Gifts for Every Occasion.</h1>
<p class="lead my-4">Discover unique flowers, candies, books, and more. Perfectly packaged and delivered with care.</p>
<a href="#products" class="btn btn-primary btn-lg">Browse Catalog</a>
<a href="#contact" class="btn btn-secondary btn-lg ms-2">Contact Us</a>
</div>
</header>
<!-- Features Section -->
<section id="features" class="py-5">
<div class="container text-center">
<div class="row">
<div class="col-md-4 mb-4">
<i class="bi bi-gift section-icon mb-3"></i>
<h3>Wide Variety</h3>
<p>From fresh flowers to unique home goods, find the perfect present for anyone.</p>
</div>
<div class="col-md-4 mb-4">
<i class="bi bi-box-seam section-icon mb-3"></i>
<h3>Custom Packaging</h3>
<p>Make your gift extra special with our beautiful and creative packaging options.</p>
</div>
<div class="col-md-4 mb-4">
<i class="bi bi-truck section-icon mb-3"></i>
<h3>Fast Delivery</h3>
<p>We ensure your gifts are delivered quickly and with the utmost care across Poland.</p>
</div>
</div>
</div>
</section>
<!-- Products Section -->
<section id="products" class="py-5 bg-light">
<div class="container">
<div class="text-center mb-5">
<h2>Our Products</h2>
<p class="lead">Browse our curated collection of gifts.</p>
</div>
<?php if (isset($_SESSION['message'])):
foreach ($_SESSION['message'] as $type => $message):
?>
<div class="alert alert-<?= $type ?> alert-dismissible fade show" role="alert">
<?= htmlspecialchars($message) ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php
endforeach;
unset($_SESSION['message']);
endif;
?>
<div class="row">
<?php
require_once 'db/config.php';
$pdo = db();
$stmt = $pdo->query('SELECT id, name, description, price, stock_quantity, image_url FROM products ORDER BY name');
$products = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($products):
foreach ($products as $product):
?>
<div class="col-md-4 mb-4">
<div class="card h-100">
<img src="<?= htmlspecialchars($product['image_url'] ? 'uploads/' . $product['image_url'] : 'https://picsum.photos/seed/product-' . $product['id'] . '/600/400') ?>" class="card-img-top" alt="<?= htmlspecialchars($product['name']) ?>">
<div class="card-body d-flex flex-column">
<h5 class="card-title"><?= htmlspecialchars($product['name']) ?></h5>
<p class="card-text"><?= htmlspecialchars($product['description']) ?></p>
<div class="mt-auto">
<p class="h4 text-primary mb-3">$<?= number_format($product['price'], 2) ?></p>
<form action="basket.php" method="post">
<input type="hidden" name="product_id" value="<?= $product['id'] ?>">
<input type="hidden" name="action" value="add">
<input type="hidden" name="return_url" value="index.php">
<button type="submit" class="btn btn-primary w-100" <?= ($product['stock_quantity'] <= 0) ? 'disabled' : '' ?>>
<i class="bi bi-cart-plus"></i> <?= ($product['stock_quantity'] > 0) ? 'Add to Basket' : 'Out of Stock' ?>
</button>
</form>
</div>
</div>
</div>
</div>
<?php
endforeach;
else:
?>
<div class="col-12">
<p class="text-center">No products found. Please check back later!</p>
</div>
<?php endif; ?>
</div>
</div>
</section>
<!-- Testimonials Section -->
<section id="about" class="py-5">
<div class="container">
<div class="text-center mb-5">
<h2>What Our Customers Say</h2>
</div>
<div class="row">
<div class="col-md-4 mb-5">
<div class="card testimonial-card text-center p-4">
<img src="https://picsum.photos/seed/avatar1/96/96" class="avatar mx-auto" alt="Customer avatar">
<div class="card-body">
<p class="card-text fst-italic">"The most beautiful gift basket I've ever received! The quality and presentation were top-notch."</p>
<footer class="blockquote-footer mt-3">Anna K.</footer>
</div>
</div>
</div>
<div class="col-md-4 mb-5">
<div class="card testimonial-card text-center p-4">
<img src="https://picsum.photos/seed/avatar2/96/96" class="avatar mx-auto" alt="Customer avatar">
<div class="card-body">
<p class="card-text fst-italic">"Fast delivery and the flowers were so fresh. My go-to for last-minute gifts!"</p>
<footer class="blockquote-footer mt-3">Piotr Z.</footer>
</div>
</div>
</div>
<div class="col-md-4 mb-5">
<div class="card testimonial-card text-center p-4">
<img src="https://picsum.photos/seed/avatar3/96/96" class="avatar mx-auto" alt="Customer avatar">
<div class="card-body">
<p class="card-text fst-italic">"I love the unique items you can't find anywhere else. Highly recommended!"</p>
<footer class="blockquote-footer mt-3">Ewa N.</footer>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="py-5 bg-light">
<div class="container">
<div class="text-center mb-5">
<h2>Get In Touch</h2>
<p class="lead">Have a question or a special request? Let us know!</p>
</div>
<div class="row justify-content-center">
<div class="col-lg-8">
<form id="contactForm" novalidate>
<div id="form-feedback"></div>
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" required>
<div class="invalid-feedback">Please enter your name.</div>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email" required>
<div class="invalid-feedback">Please enter a valid email address.</div>
</div>
<div class="mb-3">
<label for="message" class="form-label">Message</label>
<textarea class="form-control" id="message" rows="5" required></textarea>
<div class="invalid-feedback">Please enter your message.</div>
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary btn-lg">Send Message</button>
</div>
</form>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="py-4">
<div class="container text-center">
<p class="mb-2">&copy; <?php echo date("Y"); ?> GiftShop. All Rights Reserved.</p>
<div>
<a href="#" class="text-dark mx-2"><i class="bi bi-facebook"></i></a>
<a href="#" class="text-dark mx-2"><i class="bi bi-instagram"></i></a>
<a href="#" class="text-dark mx-2"><i class="bi bi-pinterest"></i></a>
</div>
<div class="mt-3">
<a href="login.php" class="text-muted">Admin Login</a>
</div>
</div>
</footer>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<!-- Custom JS -->
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>