36842-vm/index.php
Flatlogic Bot 56987f61a1 v2
2025-12-10 20:27:56 +00:00

297 lines
16 KiB
PHP

<?php
session_start();
// Check if the user is logged in, otherwise redirect to login page
if (!isset($_SESSION["user_id"])) {
header("location: login.php");
exit;
}
require_once __DIR__ . '/mail/MailService.php';
$message_sent = false;
$error_message = '';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = strip_tags(trim($_POST["name"]));
$email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL);
$message = strip_tags(trim($_POST["message"]));
if (empty($name) || empty($message) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error_message = "Please fill out all fields and provide a valid email address.";
} else {
$to = getenv('MAIL_TO') ?: 'admin@example.com'; // Fallback for local testing
$subject = "New Contact Form Submission from " . $name;
$email_body = "Name: {$name}<br>";
$email_body .= "Email: {$email}<br><br>";
$email_body .= "Message:<br>{$message}";
$text_body = "Name: {$name}\n";
$text_body .= "Email: {$email}\n\n";
$text_body .= "Message:\n{$message}";
$result = MailService::sendMail($to, $subject, $email_body, $text_body, ['reply_to' => $email]);
if (!empty($result['success'])) {
$message_sent = true;
} else {
$error_message = "Sorry, there was an error sending your message. Please try again later.";
// error_log("MailService Error: " . ($result['error'] ?? 'Unknown error'));
}
}
}
?>
<!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($_SERVER['PROJECT_NAME'] ?? 'Packaging Solutions'); ?></title>
<meta name="description" content="<?php echo htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'Custom packaging for your business.'); ?>">
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;700&family=Lato:wght@400;700&display=swap" rel="stylesheet">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="80">
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top" id="mainNav">
<div class="container">
<a class="navbar-brand" href="#"><img src="assets/pasted-20251210-201942-d2c32489.jpg" alt="<?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'PackagingCo'); ?> Logo" style="height: 40px;"></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a class="nav-link" href="#why-us">Why Us</a></li>
<li class="nav-item"><a class="nav-link" href="#offers">Offers</a></li>
<li class="nav-item"><a class="nav-link" href="#products">Products</a></li>
<li class="nav-item"><a class="nav-link" href="#faq">FAQ</a></li>
<li class="nav-item"><a class="nav-link" href="#contact">Contact</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Welcome, <?php echo htmlspecialchars($_SESSION['username']); ?>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- Hero Section -->
<header class="hero-section text-white text-center">
<div class="container d-flex align-items-center flex-column">
<h1 class="hero-heading mb-3">Innovative Packaging, Perfectly Crafted</h1>
<p class="hero-subheading mb-4">From concept to creation, we deliver custom packaging solutions that protect your products and elevate your brand.</p>
<a href="#contact" class="btn btn-accent btn-lg">Request a Free Quote</a>
</div>
</header>
<!-- Why Us Section -->
<section id="why-us" class="page-section">
<div class="container">
<h2 class="text-center mt-0">Why Choose Us?</h2>
<hr class="divider">
<div class="row">
<div class="col-lg-3 col-md-6 text-center">
<div class="mt-5">
<div class="mb-2"><i class="bi-gem fs-1 text-primary"></i></div>
<h3 class="h4 mb-2">Dynamic Design</h3>
<p class="text-muted mb-0">Use our tools to design your vision or work with our team for something unique.</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="mt-5">
<div class="mb-2"><i class="bi-rulers fs-1 text-primary"></i></div>
<h3 class="h4 mb-2">Precision Engineering</h3>
<p class="text-muted mb-0">Every fold, cut, and print is managed with state-of-the-art precision.</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="mt-5">
<div class="mb-2"><i class="bi-truck fs-1 text-primary"></i></div>
<h3 class="h4 mb-2">Reliable Delivery</h3>
<p class="text-muted mb-0">Instant lead times and transparent tracking, from our factory to your door.</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="mt-5">
<div class="mb-2"><i class="bi-headset fs-1 text-primary"></i></div>
<h3 class="h4 mb-2">Dedicated Support</h3>
<p class="text-muted mb-0">Our sales and support teams are here to ensure your success.</p>
</div>
</div>
</div>
</div>
</section>
<!-- Offers Section -->
<section id="offers" class="page-section bg-light">
<div class="container">
<h2 class="text-center">Our Partnership Offers</h2>
<hr class="divider">
<p class="text-center text-muted mb-5">We also build websites for companies, with unique partnership models.</p>
<div class="row justify-content-center">
<div class="col-lg-4 mb-4">
<div class="card h-100 shadow border-0">
<div class="card-body p-4">
<h5 class="card-title text-center fw-bold">Option A: Freemium</h5>
<hr>
<p class="card-text text-center">50% de économies et 50% des bénéfices sur le chiffre d'affaire qui vient de notre réseau.</p>
</div>
</div>
</div>
<div class="col-lg-4 mb-4">
<div class="card h-100 shadow border-0 card-featured">
<div class="card-body p-4">
<h5 class="card-title text-center fw-bold">Option B: Performance</h5>
<hr>
<p class="card-text text-center">Dépenses=X, prix de l'abonnement 0,5% de X + variable sur la performance commerciale 40% sur le bénéfice généré.</p>
</div>
</div>
</div>
<div class="col-lg-4 mb-4">
<div class="card h-100 shadow border-0">
<div class="card-body p-4">
<h5 class="card-title text-center fw-bold">Option C: Subscription</h5>
<hr>
<p class="card-text text-center">1,2% de X + variable sur la performance 30% sur le bénéfice généré.</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Products Section -->
<section id="products" class="page-section">
<div class="container">
<h2 class="text-center">Our Products</h2>
<hr class="divider">
<p class="text-center text-muted">A glimpse into the customizable packaging solutions we offer. The full interactive catalog is coming soon.</p>
<div class="row g-4 mt-4">
<div class="col-md-3"><div class="product-placeholder">Carton</div></div>
<div class="col-md-3"><div class="product-placeholder">Plastique</div></div>
<div class="col-md-3"><div class="product-placeholder">Print sur Carton</div></div>
<div class="col-md-3"><div class="product-placeholder">Étiquette</div></div>
</div>
</div>
</section>
<!-- FAQ Section -->
<section id="faq" class="page-section bg-light">
<div class="container">
<h2 class="text-center">Frequently Asked Questions</h2>
<hr class="divider">
<div class="accordion accordion-flush" id="faqAccordion">
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingOne">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseOne" aria-expanded="false" aria-controls="flush-collapseOne">
What is the minimum order quantity?
</button>
</h2>
<div id="flush-collapseOne" class="accordion-collapse collapse" aria-labelledby="flush-headingOne" data-bs-parent="#faqAccordion">
<div class="accordion-body text-muted">Our minimum order quantity varies depending on the product complexity and material. Please contact us for a specific quote.</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingTwo">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseTwo" aria-expanded="false" aria-controls="flush-collapseTwo">
Can I upload my own artwork?
</button>
</h2>
<div id="flush-collapseTwo" class="accordion-collapse collapse" aria-labelledby="flush-headingTwo" data-bs-parent="#faqAccordion">
<div class="accordion-body text-muted">Yes! Our upcoming online design tool will allow you to upload artwork, position it on a 3D mockup, and see a live preview before you order.</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingThree">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseThree" aria-expanded="false" aria-controls="flush-collapseThree">
What are the lead times?
</button>
</h2>
<div id="flush-collapseThree" class="accordion-collapse collapse" aria-labelledby="flush-headingThree" data-bs-parent="#faqAccordion">
<div class="accordion-body text-muted">Lead times are calculated instantly based on your design, materials, and quantity. You will see an estimated delivery date before you finalize your order.</div>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="page-section">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8 text-center">
<h2 class="mt-0">Let's Get In Touch!</h2>
<hr class="divider">
<p class="text-muted mb-5">Ready to start your next project with us? Send us a messages and we will get back to you as soon as possible!</p>
</div>
</div>
<div class="row gx-5 justify-content-center">
<div class="col-lg-6">
<?php if ($message_sent): ?>
<div class="alert alert-success text-center" role="alert">
Thank you! Your message has been sent successfully.
</div>
<?php endif; ?>
<?php if ($error_message): ?>
<div class="alert alert-danger text-center" role="alert">
<?php echo htmlspecialchars($error_message); ?>
</div>
<?php endif; ?>
<form id="contactForm" method="POST" action="index.php#contact">
<!-- Name input-->
<div class="form-floating mb-3">
<input class="form-control" id="name" name="name" type="text" placeholder="Enter your name..." required />
<label for="name">Full name</label>
</div>
<!-- Email address input-->
<div class="form-floating mb-3">
<input class="form-control" id="email" name="email" type="email" placeholder="name@example.com" required />
<label for="email">Email address</label>
</div>
<!-- Message input-->
<div class="form-floating mb-3">
<textarea class="form-control" id="message" name="message" type="text" placeholder="Enter your message here..." style="height: 10rem" required></textarea>
<label for="message">Message</label>
</div>
<!-- Submit Button-->
<div class="d-grid">
<button class="btn btn-primary btn-xl" id="submitButton" type="submit">Nous contactez</button>
</div>
</form>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="bg-light py-5">
<div class="container">
<div class="small text-center text-muted">Copyright &copy; <?php echo date("Y"); ?> - <?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'PackagingCo'); ?></div>
</div>
</footer>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<!-- Custom JS-->
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>