Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b395f8ab2 |
104
admin.php
Normal file
104
admin.php
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// Define a simple password. In a real application, use a more secure method.
|
||||||
|
define('ADMIN_PASSWORD', 'password');
|
||||||
|
|
||||||
|
// Check if the user is trying to log in
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['password'])) {
|
||||||
|
if ($_POST['password'] === ADMIN_PASSWORD) {
|
||||||
|
$_SESSION['is_admin'] = true;
|
||||||
|
header('Location: admin.php');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$error = 'Invalid password';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the user is not logged in, show the login form
|
||||||
|
if (!isset($_SESSION['is_admin']) || !$_SESSION['is_admin']) {
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Admin Login</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body data-bs-theme="dark">
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<h1 class="mb-4 text-center">Admin Login</h1>
|
||||||
|
<?php if (isset($error)): ?>
|
||||||
|
<div class="alert alert-danger"><?= $error ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="password" class="form-label">Password</label>
|
||||||
|
<input type="password" class="form-control" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary w-100">Login</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->query("SELECT * FROM contact_messages ORDER BY created_at DESC");
|
||||||
|
$messages = $stmt->fetchAll();
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("DB ERROR: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Admin - Contact Messages</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body data-bs-theme="dark">
|
||||||
|
<div class="container mt-5">
|
||||||
|
<h1 class="mb-4">Contact Form Submissions</h1>
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<thead class="thead-dark">
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Message</th>
|
||||||
|
<th>Submitted At</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (empty($messages)): ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="5" class="text-center">No messages yet.</td>
|
||||||
|
</tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($messages as $message): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= htmlspecialchars($message['id']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($message['name']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($message['email']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($message['message']) ?></td>
|
||||||
|
<td><?= htmlspecialchars($message['created_at']) ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
38
assets/css/custom.css
Normal file
38
assets/css/custom.css
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
body {
|
||||||
|
padding-top: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section {
|
||||||
|
background: url('https://picsum.photos/1600/900') no-repeat center center;
|
||||||
|
background-size: cover;
|
||||||
|
height: 100vh;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section .container {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.125);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-scrolled {
|
||||||
|
background-color: #212529 !important;
|
||||||
|
transition: background-color 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
section {
|
||||||
|
scroll-margin-top: 56px;
|
||||||
|
}
|
||||||
33
assets/js/main.js
Normal file
33
assets/js/main.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Custom JS for interactions
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
// Smooth scrolling for internal links
|
||||||
|
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||||
|
anchor.addEventListener('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
document.querySelector(this.getAttribute('href')).scrollIntoView({
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Navbar style change on scroll
|
||||||
|
const navbar = document.querySelector('.navbar');
|
||||||
|
window.addEventListener('scroll', () => {
|
||||||
|
if (window.scrollY > 50) {
|
||||||
|
navbar.classList.add('navbar-scrolled');
|
||||||
|
} else {
|
||||||
|
navbar.classList.remove('navbar-scrolled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Form validation
|
||||||
|
const form = document.querySelector('.needs-validation');
|
||||||
|
form.addEventListener('submit', event => {
|
||||||
|
if (!form.checkValidity()) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
form.classList.add('was-validated');
|
||||||
|
}, false);
|
||||||
|
});
|
||||||
BIN
assets/pasted-20250908-175824-e3e0b4b5.png
Normal file
BIN
assets/pasted-20250908-175824-e3e0b4b5.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 637 KiB |
BIN
assets/pasted-20250908-175831-d581827c.png
Normal file
BIN
assets/pasted-20250908-175831-d581827c.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 637 KiB |
BIN
assets/pasted-20250908-175900-723f6444.png
Normal file
BIN
assets/pasted-20250908-175900-723f6444.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 637 KiB |
BIN
assets/pasted-20250908-180047-785facbb.png
Normal file
BIN
assets/pasted-20250908-180047-785facbb.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 637 KiB |
18
db/migrations/001_create_contact_messages_table.php
Normal file
18
db/migrations/001_create_contact_messages_table.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../config.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$sql = "
|
||||||
|
CREATE TABLE IF NOT EXISTS contact_messages (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
name VARCHAR(255) NOT NULL,
|
||||||
|
email VARCHAR(255) NOT NULL,
|
||||||
|
message TEXT NOT NULL,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);";
|
||||||
|
$pdo->exec($sql);
|
||||||
|
echo "Table 'contact_messages' created successfully." . PHP_EOL;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("DB ERROR: " . $e->getMessage());
|
||||||
|
}
|
||||||
313
index.php
313
index.php
@ -1,131 +1,200 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
declare(strict_types=1);
|
|
||||||
@ini_set('display_errors', '1');
|
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
<title>Filip the Founder</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
<link rel="stylesheet" href="assets/css/custom.css">
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body data-bs-theme="dark">
|
||||||
<main>
|
|
||||||
|
<!-- Navbar -->
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="#">Filip F.</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="#work">Work</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#about">About</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>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<!-- Hero Section -->
|
||||||
|
<header id="hero" class="hero-section text-center text-white d-flex align-items-center justify-content-center">
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="display-3">Filip the Founder</h1>
|
||||||
|
<p class="lead">Building innovative web applications for a brighter future.</p>
|
||||||
|
<a href="#contact" class="btn btn-primary btn-lg">Contact Me</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- Work Section -->
|
||||||
|
<section id="work" class="py-5">
|
||||||
|
<div class="container">
|
||||||
|
<h2 class="text-center mb-5">My Work</h2>
|
||||||
|
<div class="row">
|
||||||
|
<!-- Project 1 -->
|
||||||
|
<div class="col-md-4 mb-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<img src="https://picsum.photos/600/400?random=1" class="card-img-top" alt="Project 1">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<div class="card-body">
|
||||||
<span class="sr-only">Loading…</span>
|
<h5 class="card-title">Project One</h5>
|
||||||
|
<p class="card-text">A brief description of the first project, highlighting the technologies used and the problem solved.</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="hint">Flatlogic AI is collecting your requirements and applying the first changes.</p>
|
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</div>
|
||||||
<footer>
|
<!-- Project 2 -->
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<div class="col-md-4 mb-4">
|
||||||
|
<div class="card">
|
||||||
|
<img src="https://picsum.photos/600/400?random=2" class="card-img-top" alt="Project 2">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Project Two</h5>
|
||||||
|
<p class="card-text">A brief description of the second project, highlighting the technologies used and the problem solved.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Project 3 -->
|
||||||
|
<div class="col-md-4 mb-4">
|
||||||
|
<div class="card">
|
||||||
|
<img src="https://picsum.photos/600/400?random=3" class="card-img-top" alt="Project 3">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Project Three</h5>
|
||||||
|
<p class="card-text">A brief description of the third project, highlighting the technologies used and the problem solved.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- About Section -->
|
||||||
|
<section id="about" class="py-5 bg-dark-subtle">
|
||||||
|
<div class="container">
|
||||||
|
<h2 class="text-center mb-5">About Me</h2>
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-md-4 text-center">
|
||||||
|
<img src="https://picsum.photos/256/256" class="img-fluid rounded-circle mb-3" alt="Filip">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<p class="lead">I'm Filip, a passionate founder and developer with a knack for creating elegant and effective web solutions. With over a decade of experience in the industry, I specialize in turning complex problems into simple, beautiful, and intuitive designs.</p>
|
||||||
|
<p>My goal is to build applications that not only function flawlessly but also provide a delightful user experience. I'm always excited to take on new challenges and collaborate with clients to bring their visions to life.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Testimonials Section -->
|
||||||
|
<section id="testimonials" class="py-5">
|
||||||
|
<div class="container">
|
||||||
|
<h2 class="text-center mb-5">Testimonials</h2>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 mb-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<img src="https://picsum.photos/96/96?random=7" class="rounded-circle mb-3" alt="Testimonial 1">
|
||||||
|
<p class="card-text">"Filip is a true professional. The quality of his work and his dedication to our project was outstanding."</p>
|
||||||
|
<footer class="blockquote-footer">Jane Doe, CEO of Innovate Inc.</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 mb-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<img src="https://picsum.photos/96/96?random=8" class="rounded-circle mb-3" alt="Testimonial 2">
|
||||||
|
<p class="card-text">"Working with Filip was a breeze. He understood our vision perfectly and delivered beyond our expectations."</p>
|
||||||
|
<footer class="blockquote-footer">John Smith, Founder of Tech Solutions</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 mb-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<img src="https://picsum.photos/96/96?random=9" class="rounded-circle mb-3" alt="Testimonial 3">
|
||||||
|
<p class="card-text">"The final product was polished, and the user feedback has been overwhelmingly positive. Highly recommended!"</p>
|
||||||
|
<footer class="blockquote-footer">Emily White, Project Manager at Creative Minds</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Contact Section -->
|
||||||
|
<section id="contact" class="py-5 bg-dark-subtle">
|
||||||
|
<div class="container">
|
||||||
|
<h2 class="text-center mb-4">Contact Me</h2>
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<?php if (isset($_GET['status']) && $_GET['status'] === 'success'): ?>
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
Your message has been sent successfully!
|
||||||
|
</div>
|
||||||
|
<?php elseif (isset($_GET['status']) && $_GET['status'] === 'error'): ?>
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
There was an error sending your message. Please check the form and try again.
|
||||||
|
</div>
|
||||||
|
<?php elseif (isset($_GET['status']) && $_GET['status'] === 'dberror'): ?>
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
There was a problem with the database. Please try again later.
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form id="contactForm" action="submit_contact.php" method="POST" class="needs-validation" novalidate>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Name</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="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" name="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" name="message" rows="4" required></textarea>
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
Please enter your message.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary w-100">Send Message</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<footer class="py-4 bg-dark text-white text-center">
|
||||||
|
<div class="container">
|
||||||
|
<a href="#" class="text-white me-3"><i class="bi bi-github"></i></a>
|
||||||
|
<a href="#" class="text-white me-3"><i class="bi bi-linkedin"></i></a>
|
||||||
|
<a href="#" class="text-white"><i class="bi bi-twitter"></i></a>
|
||||||
|
<p class="mt-3 mb-0">© 2025 Filip the Founder. All Rights Reserved.</p>
|
||||||
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
29
submit_contact.php
Normal file
29
submit_contact.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$name = trim($_POST['name']);
|
||||||
|
$email = trim($_POST['email']);
|
||||||
|
$message = trim($_POST['message']);
|
||||||
|
|
||||||
|
if (empty($name) || empty($email) || empty($message) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
// Handle validation error
|
||||||
|
header('Location: index.php?status=error');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$sql = "INSERT INTO contact_messages (name, email, message) VALUES (?, ?, ?)";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute([$name, $email, $message]);
|
||||||
|
|
||||||
|
// Redirect with success status
|
||||||
|
header('Location: index.php?status=success#contact');
|
||||||
|
exit;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// Handle DB error
|
||||||
|
header('Location: index.php?status=dberror');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user