34873-vm/index.php
Flatlogic Bot 76b627d181 1.0
2025-10-11 10:54:51 +00:00

134 lines
6.2 KiB
PHP

<?php
$notification = null;
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['contact_form'])) {
require_once __DIR__ . '/mail/MailService.php';
$name = filter_var(trim($_POST['name']), FILTER_SANITIZE_STRING);
$email = filter_var(trim($_POST['email']), FILTER_SANITIZE_EMAIL);
$message = filter_var(trim($_POST['message']), FILTER_SANITIZE_STRING);
if (empty($name) || !filter_var($email, FILTER_VALIDATE_EMAIL) || empty($message)) {
$notification = ['status' => 'error', 'message' => 'Please fill all fields correctly.'];
} else {
// IMPORTANT: Ask the user for the recipient email address.
// For now, we use the default from .env or MailService config.
$to = null;
$subject = 'New Contact Form Submission from ' . $name;
$res = MailService::sendContactMessage($name, $email, $message, $to, $subject);
if (!empty($res['success'])) {
$notification = ['status' => 'success', 'message' => 'Thank you! Your message has been sent.'];
} else {
// Do not expose detailed error messages to the user.
error_log('MailService Error: ' . $res['error']);
$notification = ['status' => 'error', 'message' => 'Sorry, there was an error sending your message. Please try again later.'];
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CrownEd - Luxury Education Platform</title>
<meta name="description" content="CrownEd is a next-generation learning platform offering past papers, AI-powered study assistance, and premium educational content.">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<header>
<div class="container">
<a href="/" class="logo">CrownEd</a>
<nav>
<ul>
<li><a href="#features">Features</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#" class="btn">Login</a></li>
</ul>
</nav>
</div>
</header>
<main>
<section class="hero">
<div class="container">
<h1>Unlock Your Academic Potential</h1>
<p>Experience a new era of learning with AI-powered tools, extensive resources, and a community dedicated to excellence.</p>
<a href="#" class="btn">Get Started Now</a>
</div>
</section>
<section id="features" class="section">
<div class="container">
<h2 class="section-title">Platform Features</h2>
<div class="card">
<h3>Past Papers Archive</h3>
<p>Access a vast and organized library of past examination papers. Search, filter, and download resources to prepare effectively.</p>
</div>
<div class="card">
<h3>AI Study Helper</h3>
<p>Our intelligent assistant helps you tackle difficult questions, understand complex topics, and get personalized study recommendations.</p>
</div>
<div class="card">
<h3>Community & Collaboration</h3>
<p>Connect with peers and educators. Share knowledge, form study groups, and grow together in a supportive environment.</p>
</div>
</div>
</section>
<section id="about" class="section">
<div class="container">
<h2 class="section-title">About CrownEd</h2>
<p style="max-width: 800px; margin: 0 auto; color: var(--text-muted-color);">CrownEd was founded on the principle that every student deserves access to the best educational tools. We blend traditional resources with cutting-edge technology to create a learning experience that is not only effective but also inspiring. Our mission is to empower the next generation of leaders, thinkers, and innovators.</p>
</div>
</section>
<section id="contact" class="section">
<div class="container">
<h2 class="section-title">Get In Touch</h2>
<div class="card" style="max-width: 600px; margin: 0 auto;">
<form id="contactForm" method="POST" action="/#contact">
<input type="hidden" name="contact_form" value="1">
<div class="form-group">
<label for="name">Full Name</label>
<input type="text" id="name" name="name" class="form-control" required>
</div>
<div class="form-group">
<label for="email">Email Address</label>
<input type="email" id="email" name="email" class="form-control" required>
</div>
<div class="form-group">
<label for="message">Message</label>
<textarea id="message" name="message" class="form-control" required></textarea>
</div>
<button type="submit" class="btn">Send Message</button>
</form>
</div>
<div style="margin-top: 20px; font-size: 0.9em;">
This is for testing purposes only — Flatlogic does not guarantee usage of the mail server. Please set up your own SMTP in .env (MAIL_/SMTP_ vars) with our AI Agent.
</div>
</div>
</section>
</main>
<footer>
<div class="container">
<p>&copy; <?php echo date("Y"); ?> CrownEd. All Rights Reserved.</p>
<p>
<a href="privacy.php">Privacy Policy</a>
</p>
</div>
</footer>
<?php if ($notification): ?>
<div id="notification" class="<?php echo $notification['status']; ?>" style="display: block;">
<?php echo htmlspecialchars($notification['message']); ?>
</div>
<?php endif; ?>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>