Compare commits

...

2 Commits

Author SHA1 Message Date
Flatlogic Bot
1332379a59 images 2025-09-22 11:43:51 +00:00
Flatlogic Bot
2a5a6010a0 v1 2025-09-22 11:34:19 +00:00
9 changed files with 440 additions and 126 deletions

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

@ -0,0 +1,118 @@
/* Agency Theme */
:root {
--primary: #4A90E2;
--secondary: #50E3C2;
--background: #F4F7F6;
--surface: #FFFFFF;
--text-color: #333333;
--heading-font: 'Poppins', sans-serif;
--body-font: 'Open Sans', sans-serif;
--border-radius: 0.5rem;
}
body {
font-family: var(--body-font);
background-color: var(--background);
color: var(--text-color);
}
h1, h2, h3, h4, h5, h6 {
font-family: var(--heading-font);
font-weight: 600;
}
.btn-primary {
background-color: var(--primary);
border-color: var(--primary);
border-radius: var(--border-radius);
padding: 0.75rem 1.5rem;
font-weight: 600;
transition: all 0.3s ease;
}
.btn-primary:hover {
background-color: #357ABD;
border-color: #357ABD;
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn-secondary {
background-color: var(--secondary);
border-color: var(--secondary);
color: #fff;
border-radius: var(--border-radius);
padding: 0.75rem 1.5rem;
font-weight: 600;
transition: all 0.3s ease;
}
.btn-secondary:hover {
background-color: #45C4A7;
border-color: #45C4A7;
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.navbar {
background-color: var(--surface);
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.hero {
background: linear-gradient(135deg, rgba(74, 144, 226, 0.9), rgba(80, 227, 194, 0.9)), url('../images/pexels/7688336.jpg');
background-size: cover;
background-position: center;
color: white;
padding: 8rem 0;
text-align: center;
}
.hero h1 {
font-size: 3.5rem;
font-weight: 700;
}
.section {
padding: 5rem 0;
}
.card {
border: none;
border-radius: var(--border-radius);
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
transition: all 0.3s ease;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}
.service-icon {
width: 64px;
height: 64px;
color: var(--primary);
}
.form-control {
border-radius: var(--border-radius);
}
.form-control:focus {
border-color: var(--primary);
box-shadow: 0 0 0 0.25rem rgba(74, 144, 226, 0.25);
}
.footer {
background-color: var(--surface);
padding: 2rem 0;
border-top: 1px solid #e9ecef;
}
.toast-container {
position: fixed;
top: 20px;
right: 20px;
z-index: 1055;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

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

@ -0,0 +1,54 @@
document.addEventListener('DOMContentLoaded', function () {
const urlParams = new URLSearchParams(window.location.search);
const status = urlParams.get('status');
if (status) {
let message = '';
let type = 'success';
let title = 'Success!';
if (status === 'success') {
message = 'Your message has been sent successfully. We will get back to you shortly.';
} else if (status === 'error') {
message = 'There was an error sending your message. Please try again.';
type = 'danger';
title = 'Error!';
} else if (status === 'validation_error') {
message = 'Please fill out all fields correctly.';
type = 'warning';
title = 'Validation Error';
}
if (message) {
showToast(title, message, type);
// Clean the URL
window.history.replaceState({}, document.title, window.location.pathname);
}
}
});
function showToast(title, message, type = 'success') {
const toastContainer = document.getElementById('toast-container');
if (!toastContainer) return;
const toastId = 'toast-' + Date.now();
const toastHTML = `
<div id="${toastId}" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header bg-${type} text-white">
<strong class="me-auto">${title}</strong>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body">
${message}
</div>
</div>
`;
toastContainer.insertAdjacentHTML('beforeend', toastHTML);
const toastElement = document.getElementById(toastId);
const toast = new bootstrap.Toast(toastElement, { delay: 5000 });
toast.show();
toastElement.addEventListener('hidden.bs.toast', () => {
toastElement.remove();
});
}

64
contact.php Normal file
View File

@ -0,0 +1,64 @@
<?php
// Basic security: disable direct access
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
header('Location: index.php');
exit;
}
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/mail/MailService.php';
// --- Form data ---
$name = trim($_POST['name'] ?? '');
$email = trim($_POST['email'] ?? '');
$message = trim($_POST['message'] ?? '');
// --- Validation ---
if (empty($name) || empty($email) || empty($message) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
header('Location: index.php?status=validation_error#contact');
exit;
}
try {
// --- Database Persistence ---
$pdo = db(); // Get PDO instance from db/config.php
// Idempotent table creation
$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,
message TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)");
// Insert the new submission
$stmt = $pdo->prepare("INSERT INTO contact_submissions (name, email, message) VALUES (?, ?, ?)");
$stmt->execute([$name, $email, $message]);
// --- Email Notification ---
// The recipient email address. If null, MailService will use MAIL_TO from .env
$recipient = null;
$subject = "New Contact Form Submission from " . htmlspecialchars($name);
$mailResult = MailService::sendContactMessage($name, $email, $message, $recipient, $subject);
if (!empty($mailResult['success'])) {
header('Location: index.php?status=success#contact');
} else {
// Log error if you have a logging system
// error_log("Mail sending failed: " . $mailResult['error']);
header('Location: index.php?status=error#contact');
}
} catch (PDOException $e) {
// Log database error
// error_log("Database error: " . $e->getMessage());
header('Location: index.php?status=error#contact');
exit;
} catch (Exception $e) {
// Log other errors (e.g., mailer)
// error_log("General error: " . $e->getMessage());
header('Location: index.php?status=error#contact');
exit;
}

49
includes/pexels.php Normal file
View File

@ -0,0 +1,49 @@
<?php
function pexels_key() {
$k = getenv('PEXELS_KEY');
return $k && strlen($k) > 0 ? $k : 'Vc99rnmOhHhJAbgGQoKLZtsaIVfkeownoQNbTj78VemUjKh08ZYRbf18';
}
function pexels_get($url) {
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [ 'Authorization: '. pexels_key() ],
CURLOPT_TIMEOUT => 15,
]);
$resp = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($code >= 200 && $code < 300 && $resp) return json_decode($resp, true);
return null;
}
function download_to($srcUrl, $destPath) {
// Ensure the destination directory exists.
$dir = dirname($destPath);
if (!is_dir($dir)) {
if (!mkdir($dir, 0775, true)) {
error_log("Failed to create directory: $dir");
return false;
}
}
$context = stream_context_create([
"ssl" => [
"verify_peer" => false,
"verify_peer_name" => false,
],
]);
$data = file_get_contents($srcUrl, false, $context);
if ($data === false) {
error_log("Failed to download image from: $srcUrl");
return false;
}
if (file_put_contents($destPath, $data) === false) {
error_log("Failed to save image to: $destPath");
return false;
}
return true;
}

265
index.php
View File

@ -1,131 +1,160 @@
<?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>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Creative Agency - Driving Growth Through Digital Experiences</title>
<meta name="description" content="A leading creative agency specializing in web design, development, and digital strategy to help your business grow.">
<meta name="robots" content="index, follow">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://your-domain.com/">
<meta property="og:title" content="Creative Agency - Driving Growth Through Digital Experiences">
<meta property="og:description" content="We build beautiful, functional websites and create strategies that deliver results.">
<meta property="og:image" content="https://picsum.photos/seed/og-image/1200/630">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="https://your-domain.com/">
<meta property="twitter:title" content="Creative Agency - Driving Growth Through Digital Experiences">
<meta property="twitter:description" content="We build beautiful, functional websites and create strategies that deliver results.">
<meta property="twitter:image" content="https://picsum.photos/seed/og-image/1200/630">
<!-- 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.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;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>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&family=Poppins:wght@600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<!-- Toast container for notifications -->
<div id="toast-container" class="toast-container position-fixed top-0 end-0 p-3"></div>
<!-- Header -->
<nav class="navbar navbar-expand-lg navbar-light sticky-top">
<div class="container">
<a class="navbar-brand fw-bold" href="#">🎨 Agency</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="#services">Services</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">
<div class="row">
<div class="col-lg-8 mx-auto">
<h1 class="display-3 mb-4">Digital Experiences That Drive Growth</h1>
<p class="lead mb-5">We are a creative agency that builds beautiful, functional websites and crafts digital strategies that deliver measurable results.</p>
<a href="#contact" class="btn btn-secondary btn-lg">Get a Free Quote</a>
</div>
</div>
</div>
</header>
<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>
<!-- Services Section -->
<section id="services" class="section">
<div class="container">
<div class="text-center mb-5">
<h2 class="display-5">Our Services</h2>
<p class="lead">We offer a complete suite of digital services.</p>
</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>
<div class="row g-4">
<!-- Service 1 -->
<div class="col-md-4">
<div class="card h-100 p-4 text-center">
<div class="mb-3"><i data-feather="layout" class="service-icon"></i></div>
<div class="card-body">
<h3 class="card-title h4">Web Design</h3>
<p class="card-text">Stunning, user-centric designs that capture your brand and engage your audience. Mobile-first and responsive.</p>
<img src="assets/images/pexels/14979020.jpg" class="img-fluid rounded mt-3" alt="A close-up of a user interface design on a tablet.">
</div>
</div>
</div>
<!-- Service 2 -->
<div class="col-md-4">
<div class="card h-100 p-4 text-center">
<div class="mb-3"><i data-feather="code" class="service-icon"></i></div>
<div class="card-body">
<h3 class="card-title h4">Web Development</h3>
<p class="card-text">Clean, scalable, and performant code. From landing pages to complex web applications, we build solutions that work.</p>
<img src="assets/images/pexels/25626512.jpg" class="img-fluid rounded mt-3" alt="Code on a computer screen representing web development.">
</div>
</div>
</div>
<!-- Service 3 -->
<div class="col-md-4">
<div class="card h-100 p-4 text-center">
<div class="mb-3"><i data-feather="trending-up" class="service-icon"></i></div>
<div class="card-body">
<h3 class="card-title h4">Digital Strategy</h3>
<p class="card-text">Data-driven strategies to boost your online presence. SEO, content marketing, and analytics to help you grow.</p>
<img src="assets/images/pexels/4515793.jpg" class="img-fluid rounded mt-3" alt="A chart showing upward trends, representing business growth.">
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="section bg-light">
<div class="container">
<div class="row">
<div class="col-lg-8 mx-auto text-center">
<h2 class="display-5 mb-3">Ready to Start a Project?</h2>
<p class="lead mb-5">Let's talk about your ideas. Fill out the form below and we'll be in touch.</p>
<div class="card p-4 p-md-5">
<form action="contact.php" method="POST">
<div class="mb-3">
<input type="text" class="form-control form-control-lg" id="name" name="name" placeholder="Your Name" required>
</div>
<div class="mb-3">
<input type="email" class="form-control form-control-lg" id="email" name="email" placeholder="Your Email" required>
</div>
<div class="mb-4">
<textarea class="form-control form-control-lg" id="message" name="message" rows="5" placeholder="Tell us about your project" required></textarea>
</div>
<div class="d-grid">
<button type="submit" class="btn btn-primary btn-lg">Send Message</button>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
<!-- Footer -->
<footer class="footer">
<div class="container text-center">
<p class="mb-0">&copy; <?php echo date("Y"); ?> Creative Agency. All Rights Reserved.</p>
</div>
</footer>
<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script>
feather.replace();
</script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>