Auto commit: 2025-11-22T23:07:07.858Z

This commit is contained in:
Flatlogic Bot 2025-11-22 23:07:07 +00:00
parent fc8edd7aec
commit daabfea417
4 changed files with 463 additions and 144 deletions

118
assets/css/custom.css Normal file
View File

@ -0,0 +1,118 @@
:root {
--primary-color: #3E66F8;
--secondary-color: #FF6B6B;
--background-color: #F8F9FA;
--surface-color: #FFFFFF;
--text-color: #212529;
--light-text-color: #6c757d;
}
body {
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: var(--background-color);
color: var(--text-color);
}
.navbar-brand {
font-weight: bold;
}
.hero {
background: linear-gradient(120deg, var(--primary-color), #2E52D9);
color: white;
padding: 6rem 0;
text-align: center;
}
.hero h1 {
font-size: 3.5rem;
font-weight: 700;
}
.hero p {
font-size: 1.25rem;
max-width: 600px;
margin: 1rem auto;
}
.btn-primary {
background-color: var(--primary-color);
border-color: var(--primary-color);
border-radius: 0.5rem;
padding: 0.75rem 1.5rem;
font-weight: 500;
transition: all 0.3s ease;
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.btn-secondary {
background-color: var(--secondary-color);
border-color: var(--secondary-color);
border-radius: 0.5rem;
padding: 0.75rem 1.5rem;
font-weight: 500;
transition: all 0.3s ease;
}
.btn-secondary:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.section {
padding: 5rem 0;
}
.section-title {
text-align: center;
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 3rem;
}
.card {
border: none;
border-radius: 0.5rem;
box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}
.portfolio-card .card-img-top {
border-top-left-radius: 0.5rem;
border-top-right-radius: 0.5rem;
}
.contact-form {
background: var(--surface-color);
padding: 3rem;
border-radius: 0.5rem;
box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
}
.form-control {
border-radius: 0.5rem;
padding: 0.75rem;
}
.form-control:focus {
box-shadow: 0 0 0 0.25rem rgba(62, 102, 248, 0.25);
border-color: var(--primary-color);
}
.footer {
background: var(--surface-color);
padding: 2rem 0;
text-align: center;
border-top: 1px solid #e9ecef;
}

64
assets/js/main.js Normal file
View File

@ -0,0 +1,64 @@
document.addEventListener('DOMContentLoaded', function () {
// Smooth scroll for navigation links
const navLinks = document.querySelectorAll('.nav-link');
navLinks.forEach(link => {
if (link.hash !== '') {
link.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.hash);
if (target) {
window.scrollTo({
top: target.offsetTop - 70, // Adjust for fixed navbar
behavior: 'smooth'
});
}
});
}
});
// Contact form submission
const contactForm = document.getElementById('contactForm');
const toastContainer = document.getElementById('notificationToast');
const toastBody = document.querySelector('#notificationToast .toast-body');
const toast = new bootstrap.Toast(toastContainer);
if (contactForm) {
contactForm.addEventListener('submit', function (e) {
e.preventDefault();
const formData = new FormData(this);
const submitButton = this.querySelector('button[type="submit"]');
submitButton.disabled = true;
submitButton.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Sending...';
fetch('contact_handler.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
if (data.success) {
toastBody.textContent = 'Message sent successfully! Thank you.';
toastContainer.classList.remove('bg-danger');
toastContainer.classList.add('bg-success');
contactForm.reset();
} else {
toastBody.textContent = data.error || 'An unknown error occurred.';
toastContainer.classList.remove('bg-success');
toastContainer.classList.add('bg-danger');
}
toast.show();
})
.catch(error => {
toastBody.textContent = 'A network error occurred. Please try again.';
toastContainer.classList.remove('bg-success');
toastContainer.classList.add('bg-danger');
toast.show();
})
.finally(() => {
submitButton.disabled = false;
submitButton.innerHTML = 'Send Message';
});
});
}
});

107
contact_handler.php Normal file
View File

@ -0,0 +1,107 @@
<?php
header('Content-Type: application/json');
// Load dependencies
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/mail/MailService.php';
// --- Database Schema Setup ---
try {
$pdo = db();
$pdo->exec("CREATE TABLE IF NOT EXISTS contact_submissions (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
subject VARCHAR(255) NOT NULL,
message TEXT NOT NULL,
submitted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)");
} catch (PDOException $e) {
error_log("Database schema creation failed: " . $e->getMessage());
echo json_encode(['success' => false, 'error' => 'Could not initialize database. Please try again later.']);
exit;
}
// --- Form Submission Handling ---
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
echo json_encode(['success' => false, 'error' => 'Invalid request method.']);
exit;
}
// --- Input Validation ---
$name = trim($_POST['name'] ?? '');
$email = trim($_POST['email'] ?? '');
$subject = trim($_POST['subject'] ?? '');
$message = trim($_POST['message'] ?? '');
if (empty($name) || empty($email) || empty($subject) || empty($message)) {
echo json_encode(['success' => false, 'error' => 'Please fill out all fields.']);
exit;
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo json_encode(['success' => false, 'error' => 'Please provide a valid email address.']);
exit;
}
// --- Store in Database ---
try {
$stmt = $pdo->prepare("INSERT INTO contact_submissions (name, email, subject, message) VALUES (?, ?, ?, ?)");
$stmt->execute([$name, $email, $subject, $message]);
} catch (PDOException $e) {
error_log("Database insert failed: " . $e->getMessage());
echo json_encode(['success' => false, 'error' => 'Could not save your message. Please try again later.']);
exit;
}
// --- Send Email Notifications ---
$siteOwnerEmail = getenv('MAIL_TO') ?: (getenv('MAIL_FROM') ?: 'admin@example.com');
$projectName = $_SERVER['PROJECT_NAME'] ?? 'Your Website';
// 1. Notification to Site Owner
$ownerSubject = "New Contact Form Submission: " . htmlspecialchars($subject);
$ownerHtmlBody = "
<h2>New message from your website contact form:</h2>
<p><strong>Name:</strong> " . htmlspecialchars($name) . "</p>
<p><strong>Email:</strong> " . htmlspecialchars($email) . "</p>
<p><strong>Subject:</strong> " . htmlspecialchars($subject) . "</p>
<p><strong>Message:</strong></p>
<p>" . nl2br(htmlspecialchars($message)) . "</p>
";
$ownerTextBody = "New message from your website contact form:\nName: $name\nEmail: $email\nSubject: $subject\nMessage:\n$message";
MailService::sendMail(
$siteOwnerEmail,
$ownerSubject,
$ownerHtmlBody,
$ownerTextBody,
['reply_to' => $email]
);
// 2. Auto-reply to Visitor
$visitorSubject = "Thank you for contacting " . $projectName;
$visitorHtmlBody = "
<h2>Thank You For Your Message!</h2>
<p>Hello " . htmlspecialchars($name) . ",</p>
<p>We have received your message and will get back to you as soon as possible.</p>
<p>Here is a copy of your submission:</p>
<hr>
<p><strong>Subject:</strong> " . htmlspecialchars($subject) . "</p>
<p><strong>Message:</strong></p>
<p>" . nl2br(htmlspecialchars($message)) . "</p>
<hr>
<p>Best regards,<br>" . $projectName . "</p>
";
$visitorTextBody = "Hello $name,\nThank you for your message! We have received it and will get back to you shortly.\n\nYour submission:\nSubject: $subject\nMessage: $message\n\nBest regards,\n" . $projectName;
MailService::sendMail(
$email,
$visitorSubject,
$visitorHtmlBody,
$visitorTextBody
);
// --- Success Response ---
echo json_encode(['success' => true]);

318
index.php
View File

@ -1,150 +1,180 @@
<?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');
?>
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<?php
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<?php if ($projectDescription): ?>
<!-- Meta description -->
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
<!-- Open Graph meta tags -->
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<!-- Twitter meta tags -->
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<!-- Open Graph image -->
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<?php endif; ?>
<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-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>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- SEO & Meta Tags -->
<title><?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'Personal Portfolio'); ?></title>
<meta name="description" content="<?php echo htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'A personal portfolio website to showcase work and skills.'); ?>">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:title" content="<?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'Personal Portfolio'); ?>">
<meta property="og:description" content="<?php echo htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'A personal portfolio website to showcase work and skills.'); ?>">
<meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:title" content="<?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'Personal Portfolio'); ?>">
<meta property="twitter:description" content="<?php echo htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'A personal portfolio website to showcase work and skills.'); ?>">
<meta property="twitter:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
<!-- Favicon -->
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🚀</text></svg>">
<!-- Stylesheets -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<main>
<div class="card">
<h1>Analyzing your requirements and generating your website…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
</div>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : '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>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm sticky-top">
<div class="container">
<a class="navbar-brand" href="#">🚀 John Doe</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="#contact">Contact</a></li>
</ul>
</div>
</div>
</nav>
<!-- Hero Section -->
<header id="home" class="hero">
<div class="container">
<h1>Creative Developer & Designer</h1>
<p class="lead">I build beautiful, functional, and user-centric web experiences.</p>
<a href="#portfolio" class="btn btn-light btn-lg">View My Work</a>
</div>
</header>
<!-- About Section -->
<section id="about" class="section">
<div class="container">
<h2 class="section-title">About Me</h2>
<div class="row align-items-center">
<div class="col-lg-6">
<img src="https://i.pravatar.cc/500?img=7" class="img-fluid rounded-circle shadow-lg" alt="A portrait of John Doe">
</div>
<div class="col-lg-6 mt-4 mt-lg-0">
<h3>Hello, I'm John Doe.</h3>
<p class="text-muted">I am a passionate and results-oriented web developer with over 5 years of experience in creating dynamic websites and applications. My expertise lies in front-end technologies, but I am also proficient in back-end development, allowing me to build complete and robust solutions.</p>
<p class="text-muted">I believe in clean code, intuitive design, and the power of technology to solve real-world problems. When I'm not coding, I enjoy hiking, photography, and exploring new coffee shops.</p>
<div class="mt-4">
<a href="#contact" class="btn btn-primary">Get In Touch</a>
<a href="#" class="btn btn-outline-primary ms-2">Download CV</a>
</div>
</div>
</div>
</div>
</section>
<!-- Portfolio Section -->
<section id="portfolio" class="section bg-light">
<div class="container">
<h2 class="section-title">My Portfolio</h2>
<div class="row g-4">
<!-- Portfolio Item 1 -->
<div class="col-md-6 col-lg-4">
<div class="card portfolio-card">
<img src="https://images.pexels.com/photos/1181244/pexels-photo-1181244.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" class="card-img-top" alt="Portfolio Project 1">
<div class="card-body">
<h5 class="card-title">Project One</h5>
<p class="card-text text-muted">A web application for managing tasks and boosting productivity. Built with modern JavaScript frameworks.</p>
<a href="#" class="btn btn-sm btn-primary">View Details</a>
</div>
</div>
</div>
<!-- Portfolio Item 2 -->
<div class="col-md-6 col-lg-4">
<div class="card portfolio-card">
<img src="https://images.pexels.com/photos/3861969/pexels-photo-3861969.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" class="card-img-top" alt="Portfolio Project 2">
<div class="card-body">
<h5 class="card-title">Project Two</h5>
<p class="card-text text-muted">An e-commerce platform with a focus on user experience and a clean, minimalist design.</p>
<a href="#" class="btn btn-sm btn-primary">View Details</a>
</div>
</div>
</div>
<!-- Portfolio Item 3 -->
<div class="col-md-6 col-lg-4">
<div class="card portfolio-card">
<img src="https://images.pexels.com/photos/5775854/pexels-photo-5775854.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" class="card-img-top" alt="Portfolio Project 3">
<div class="card-body">
<h5 class="card-title">Project Three</h5>
<p class="card-text text-muted">A corporate website redesign that resulted in a 40% increase in user engagement.</p>
<a href="#" class="btn btn-sm btn-primary">View Details</a>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="section">
<div class="container">
<h2 class="section-title">Get In Touch</h2>
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="contact-form">
<form id="contactForm">
<div class="row g-3">
<div class="col-md-6">
<label for="name" class="form-label">Your Name</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="col-md-6">
<label for="email" class="form-label">Your Email</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="col-12">
<label for="subject" class="form-label">Subject</label>
<input type="text" class="form-control" id="subject" name="subject" required>
</div>
<div class="col-12">
<label for="message" class="form-label">Message</label>
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
</div>
<div class="col-12 text-center">
<button type="submit" class="btn btn-primary btn-lg">Send Message</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="footer">
<div class="container">
<p class="text-muted mb-0">&copy; <?php echo date("Y"); ?> <?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'John Doe'); ?>. All Rights Reserved.</p>
</div>
</footer>
<!-- Toast Notification -->
<div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
<div id="notificationToast" class="toast align-items-center text-white border-0" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body"></div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer>
<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>
</html>