294 lines
9.2 KiB
PHP
294 lines
9.2 KiB
PHP
<?php
|
|
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');
|
|
|
|
$message_sent = false;
|
|
$error_message = '';
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
require_once __DIR__ . '/mail/MailService.php';
|
|
$name = trim($_POST['name'] ?? '');
|
|
$email = trim($_POST['email'] ?? '');
|
|
$message = trim($_POST['message'] ?? '');
|
|
|
|
if (empty($name) || empty($email) || empty($message)) {
|
|
$error_message = "Please fill in all fields.";
|
|
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
|
$error_message = "Invalid email format.";
|
|
} else {
|
|
$to = getenv('MAIL_TO') ?: 'your-email@example.com';
|
|
$res = MailService::sendContactMessage($name, $email, $message, $to, 'Contact Form Submission');
|
|
if (!empty($res['success'])) {
|
|
$message_sent = true;
|
|
} else {
|
|
$error_message = "Failed to send message. " . ($res['error'] ?? '');
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>John Doe - Personal Portfolio</title>
|
|
<meta name="description" content="Welcome to the personal portfolio of John Doe. Explore my work, learn more about me, and get in touch.">
|
|
<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;700&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--bg-color: #f8f9fa;
|
|
--text-color: #212529;
|
|
--primary-color: #007bff;
|
|
--card-bg-color: #ffffff;
|
|
--card-border-color: #dee2e6;
|
|
--shadow-color: rgba(0, 0, 0, 0.1);
|
|
}
|
|
body {
|
|
margin: 0;
|
|
font-family: 'Inter', sans-serif;
|
|
background-color: var(--bg-color);
|
|
color: var(--text-color);
|
|
line-height: 1.6;
|
|
}
|
|
.container {
|
|
max-width: 960px;
|
|
margin: 0 auto;
|
|
padding: 2rem;
|
|
}
|
|
header, section, footer {
|
|
padding: 4rem 0;
|
|
}
|
|
section:nth-child(even) {
|
|
background-color: var(--card-bg-color);
|
|
}
|
|
h1, h2, h3 {
|
|
font-weight: 700;
|
|
margin-bottom: 1rem;
|
|
}
|
|
h1 { font-size: 3rem; }
|
|
h2 { font-size: 2.5rem; text-align: center; margin-bottom: 3rem; }
|
|
p { margin-bottom: 1rem; }
|
|
.btn {
|
|
display: inline-block;
|
|
background-color: var(--primary-color);
|
|
color: #fff;
|
|
padding: 0.75rem 1.5rem;
|
|
border-radius: 8px;
|
|
text-decoration: none;
|
|
transition: background-color: 0.3s;
|
|
}
|
|
.btn:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
#intro {
|
|
text-align: center;
|
|
background-image: url('assets/images/header.jpg');
|
|
background-size: cover;
|
|
background-position: center;
|
|
color: #fff;
|
|
position: relative;
|
|
}
|
|
#intro::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
}
|
|
#intro .container {
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
#portfolio {
|
|
background-image: url('assets/images/portfolio/2442888.jpg');
|
|
background-size: cover;
|
|
background-position: center;
|
|
color: #fff;
|
|
position: relative;
|
|
}
|
|
#portfolio::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
}
|
|
#portfolio .container {
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
.portfolio-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
gap: 2rem;
|
|
}
|
|
.portfolio-item {
|
|
background-color: var(--card-bg-color);
|
|
border: 1px solid var(--card-border-color);
|
|
border-radius: 8px;
|
|
box-shadow: 0 4px 12px var(--shadow-color);
|
|
transition: transform 0.3s;
|
|
color: var(--text-color);
|
|
}
|
|
.portfolio-item:hover {
|
|
transform: translateY(-5px);
|
|
}
|
|
.testimonial {
|
|
font-style: italic;
|
|
text-align: center;
|
|
max-width: 700px;
|
|
margin: 0 auto;
|
|
}
|
|
.contact-form {
|
|
max-width: 600px;
|
|
margin: 0 auto;
|
|
}
|
|
.form-group {
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
.form-group input, .form-group textarea {
|
|
width: 100%;
|
|
padding: 0.75rem;
|
|
border: 1px solid var(--card-border-color);
|
|
border-radius: 8px;
|
|
}
|
|
.alert {
|
|
padding: 1rem;
|
|
margin-bottom: 1rem;
|
|
border-radius: 8px;
|
|
}
|
|
.alert-success {
|
|
background-color: #d4edda;
|
|
color: #155724;
|
|
}
|
|
.alert-danger {
|
|
background-color: #f8d7da;
|
|
color: #721c24;
|
|
}
|
|
footer {
|
|
text-align: center;
|
|
font-size: 0.9rem;
|
|
color: #6c757d;
|
|
}
|
|
@media (max-width: 768px) {
|
|
h1 { font-size: 2.5rem; }
|
|
h2 { font-size: 2rem; }
|
|
header, section { padding: 3rem 0; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<header id="intro">
|
|
<div class="container">
|
|
<h1>John Doe</h1>
|
|
<p>Creative Developer & Designer</p>
|
|
<a href="#contact" class="btn">Get in Touch</a>
|
|
</div>
|
|
</header>
|
|
|
|
<section id="portfolio">
|
|
<div class="container">
|
|
<h2>Portfolio</h2>
|
|
<div class="portfolio-grid">
|
|
<?php
|
|
$portfolio_images_path = __DIR__ . '/portfolio_images.json';
|
|
$portfolio_images = [];
|
|
if (file_exists($portfolio_images_path)) {
|
|
$portfolio_images = json_decode(file_get_contents($portfolio_images_path), true);
|
|
}
|
|
|
|
$projects = [
|
|
["name" => "Project One", "description" => "A brief description of the project, its purpose, and the technologies used. Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "image" => $portfolio_images[0] ?? 'https://picsum.photos/seed/project1/600/400'],
|
|
["name" => "Project Two", "description" => "A brief description of the project, its purpose, and the technologies used. Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "image" => $portfolio_images[1] ?? 'https://picsum.photos/seed/project2/600/400'],
|
|
["name" => "Project Three", "description" => "A brief description of the project, its purpose, and the technologies used. Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "image" => $portfolio_images[2] ?? 'https://picsum.photos/seed/project3/600/400']
|
|
];
|
|
|
|
foreach ($projects as $project) {
|
|
?>
|
|
<div class="portfolio-item">
|
|
<img src="<?= htmlspecialchars(str_replace('\\', '/', $project['image'])) ?>" alt="<?= htmlspecialchars($project['name']) ?>" style="width: 100%; height: auto; border-radius: 8px 8px 0 0;">
|
|
<div style="padding: 1.5rem;">
|
|
<h3><?= htmlspecialchars($project['name']) ?></h3>
|
|
<p><?= htmlspecialchars($project['description']) ?></p>
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
|
|
|
|
<section id="about">
|
|
<div class="container">
|
|
<h2>About Me</h2>
|
|
<p>Hello! I'm John Doe, a passionate developer with a love for creating beautiful and functional web experiences. I have a background in both design and development, allowing me to build projects from concept to completion. I'm always eager to learn new technologies and take on challenging projects.</p>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="testimonials">
|
|
<div class="container">
|
|
<h2>Testimonials</h2>
|
|
<div class="testimonial">
|
|
<p>"Working with John was a fantastic experience. He is a true professional with a keen eye for detail. The final product exceeded all our expectations."</p>
|
|
<cite>- Jane Smith, CEO of ExampleCorp</cite>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="contact">
|
|
<div class="container">
|
|
<h2>Contact Me</h2>
|
|
<div class="contact-form">
|
|
<?php if ($message_sent): ?>
|
|
<div class="alert alert-success">Thank you for your message! I'll get back to you shortly.</div>
|
|
<?php endif; ?>
|
|
<?php if ($error_message): ?>
|
|
<div class="alert alert-danger"><?= htmlspecialchars($error_message) ?></div>
|
|
<?php endif; ?>
|
|
<form action="#contact" method="post">
|
|
<div class="form-group">
|
|
<label for="name">Name</label>
|
|
<input type="text" id="name" name="name" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="email">Email</label>
|
|
<input type="email" id="email" name="email" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="message">Message</label>
|
|
<textarea id="message" name="message" rows="5" required></textarea>
|
|
</div>
|
|
<button type="submit" class="btn">Send Message</button>
|
|
</form>
|
|
<p style="text-align: center; margin-top: 1rem; font-size: 0.9rem; color: #6c757d;">
|
|
This is for testing purposes only — Flatlogic does not guarantee usage of the mail server. Please set up your own SMTP in <code>.env</code> (MAIL_/SMTP_ vars).
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<footer>
|
|
<div class="container">
|
|
<p>© <?= date('Y') ?> John Doe. All rights reserved.</p>
|
|
</div>
|
|
</footer>
|
|
|
|
</body>
|
|
</html>
|