220 lines
11 KiB
PHP
220 lines
11 KiB
PHP
<?php
|
|
session_start();
|
|
$message = '';
|
|
if (isset($_SESSION['message'])) {
|
|
$message = $_SESSION['message'];
|
|
unset($_SESSION['message']);
|
|
}
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
require_once __DIR__ . '/db/config.php';
|
|
require_once __DIR__ . '/mail/MailService.php';
|
|
|
|
$name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
|
|
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
|
|
$message_body = filter_input(INPUT_POST, 'message', FILTER_SANITIZE_STRING);
|
|
|
|
if ($name && $email && $message_body) {
|
|
try {
|
|
$pdo = db();
|
|
$sql = "INSERT INTO contact_submissions (name, email, message) VALUES (?, ?, ?)";
|
|
$stmt = $pdo->prepare($sql);
|
|
$stmt->execute([$name, $email, $message_body]);
|
|
|
|
// Send email notification
|
|
$to = getenv('MAIL_TO') ?: null;
|
|
$subject = 'New Contact Form Submission';
|
|
$htmlBody = "
|
|
<h1>New Contact Form Submission</h1>
|
|
<p><strong>Name:</strong> {$name}</p>
|
|
<p><strong>Email:</strong> {$email}</p>
|
|
<p><strong>Message:</strong></p>
|
|
<p>{$message_body}</p>
|
|
";
|
|
$textBody = "Name: {$name}\nEmail: {$email}\nMessage:\n{$message_body}";
|
|
|
|
MailService::sendMail($to, $subject, $htmlBody, $textBody, ['reply_to' => $email]);
|
|
|
|
$_SESSION['message'] = '<div class="alert alert-success">Thank you for your message. It has been sent.</div>';
|
|
} catch (PDOException $e) {
|
|
$_SESSION['message'] = '<div class="alert alert-danger">There was a database error. Please try again later.</div>';
|
|
} catch (Exception $e) {
|
|
$_SESSION['message'] = '<div class="alert alert-danger">There was an error sending the email. Please try again later.</div>';
|
|
}
|
|
} else {
|
|
$_SESSION['message'] = '<div class="alert alert-danger">Please fill out all fields correctly.</div>';
|
|
}
|
|
header("Location: index.php#contact");
|
|
exit;
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<!-- SEO Meta Tags -->
|
|
<title>new lamp stack</title>
|
|
<meta name="description" content="New Lamp Stack: Streamline your web development projects with an efficient, integrated solution for dynamic websites.">
|
|
<meta name="keywords" content="lamp stack development, web application development, personal landing page, php development, dynamic websites, modern web design, responsive design, web development solution, portfolio website, contact form integration">
|
|
|
|
<!-- Open Graph / Facebook -->
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:title" content="new lamp stack">
|
|
<meta property="og:description" content="New Lamp Stack: Streamline your web development projects with an efficient, integrated solution for dynamic websites.">
|
|
<meta property="og:image" content="https://project-screens.s3.amazonaws.com/screenshots/34548/app-hero-20251001-095254.png">
|
|
|
|
<!-- Twitter -->
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:image" content="https://project-screens.s3.amazonaws.com/screenshots/34548/app-hero-20251001-095254.png">
|
|
|
|
<!-- Stylesheets -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<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=Inter:wght@400;600;700&family=Georgia&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
|
|
<!-- Header -->
|
|
<header class="navbar navbar-expand-lg navbar-light bg-light sticky-top">
|
|
<div class="container">
|
|
<a class="navbar-brand fw-bold" href="#">MyProject</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="#home">Home</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#about">About</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#portfolio">Portfolio</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#testimonials">Testimonials</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="#contact">Contact</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main>
|
|
<!-- Hero Section -->
|
|
<section id="home" class="section text-center" style="background-image: url('https://picsum.photos/seed/hero/1600/900'); background-size: cover; background-position: center; min-height: 90vh; display: flex; align-items: center;">
|
|
<div class="container glassmorphism p-5">
|
|
<h1 class="display-3 fw-bold">Welcome to <span class="gradient-text">My New App</span></h1>
|
|
<p class="lead my-4">A modern, responsive landing page built on the LAMP stack.</p>
|
|
<a href="#contact" class="btn btn-primary btn-lg">Get in Touch</a>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- About Section -->
|
|
<section id="about" class="section">
|
|
<div class="container">
|
|
<div class="row align-items-center">
|
|
<div class="col-lg-6">
|
|
<h2 class="mb-4">About Me</h2>
|
|
<p>This is a space to tell your story. Who are you? What do you do? What are you passionate about? Keep it concise and engaging.</p>
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
|
|
</div>
|
|
<div class="col-lg-6 text-center">
|
|
<img src="https://picsum.photos/seed/about/500/500" class="img-fluid rounded-circle" alt="A portrait of the site owner.">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Portfolio Section -->
|
|
<section id="portfolio" class="section bg-light">
|
|
<div class="container">
|
|
<h2 class="text-center mb-5">My Work</h2>
|
|
<div class="row">
|
|
<div class="col-md-6 mb-4">
|
|
<div class="card">
|
|
<img src="https://picsum.photos/seed/work1/800/600" class="card-img-top" alt="Placeholder for a portfolio project.">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Project One</h5>
|
|
<p class="card-text">A brief description of the project, its purpose, and the technologies used.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6 mb-4">
|
|
<div class="card">
|
|
<img src="https://picsum.photos/seed/work2/800/600" class="card-img-top" alt="Placeholder for another portfolio project.">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Project Two</h5>
|
|
<p class="card-text">A brief description of the project, its purpose, and the technologies used.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Testimonials Section -->
|
|
<section id="testimonials" class="section">
|
|
<div class="container">
|
|
<h2 class="text-center mb-5">What People Are Saying</h2>
|
|
<div class="row">
|
|
<div class="col-md-4 text-center">
|
|
<img src="https://picsum.photos/seed/face1/100/100" class="rounded-circle mb-3" alt="A testimonial provider's face.">
|
|
<p class="fst-italic">"This is a fantastic service! Highly recommended."</p>
|
|
<p class="fw-bold">- Jane Doe</p>
|
|
</div>
|
|
<div class="col-md-4 text-center">
|
|
<img src="https://picsum.photos/seed/face2/100/100" class="rounded-circle mb-3" alt="A testimonial provider's face.">
|
|
<p class="fst-italic">"Incredible results and a pleasure to work with."</p>
|
|
<p class="fw-bold">- John Smith</p>
|
|
</div>
|
|
<div class="col-md-4 text-center">
|
|
<img src="https://picsum.photos/seed/face3/100/100" class="rounded-circle mb-3" alt="A testimonial provider's face.">
|
|
<p class="fst-italic">"A game-changer for our business."</p>
|
|
<p class="fw-bold">- Sam Wilson</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Contact Section -->
|
|
<section id="contact" class="section bg-light">
|
|
<div class="container">
|
|
<h2 class="text-center mb-5">Contact Me</h2>
|
|
<div class="row justify-content-center">
|
|
<div class="col-lg-6">
|
|
<?php if ($message): ?>
|
|
<?php echo $message; ?>
|
|
<?php endif; ?>
|
|
<form method="POST" action="index.php#contact">
|
|
<div class="mb-3">
|
|
<label for="name" class="form-label">Name</label>
|
|
<input type="text" class="form-control" id="name" name="name" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="email" class="form-label">Email</label>
|
|
<input type="email" class="form-control" id="email" name="email" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="message" class="form-label">Message</label>
|
|
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Send Message</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
|
|
<!-- Footer -->
|
|
<footer class="py-4 bg-dark text-white text-center">
|
|
<div class="container">
|
|
<p class="mb-0">Copyright © <?php echo date('Y'); ?> MyProject. All Rights Reserved.</p>
|
|
<a href="privacy.php" class="text-white">Privacy Policy</a>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- Scripts -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
</body>
|
|
</html>
|