This commit is contained in:
Flatlogic Bot 2025-10-02 01:33:44 +00:00
parent 8bc1056bc2
commit 4ded33d0ad
5 changed files with 431 additions and 145 deletions

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

@ -0,0 +1,121 @@
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: #F9FAFB;
color: #111827;
}
h1, h2, h3, h4, h5, h6 {
font-family: Georgia, 'Times New Roman', serif;
font-weight: 700;
}
.navbar {
background-color: #FFFFFF;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.navbar-brand {
font-family: Georgia, 'Times New Roman', serif;
font-weight: 700;
color: #4F46E5 !important;
}
.hero {
padding: 6rem 0;
background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(139, 92, 246, 0.05));
}
.hero h1 {
font-size: 3.5rem;
line-height: 1.2;
}
.hero .lead {
font-size: 1.25rem;
color: #4B5563;
}
.btn-primary {
background-color: #4F46E5;
border-color: #4F46E5;
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
font-weight: 600;
transition: background-color 0.2s ease-in-out;
}
.btn-primary:hover {
background-color: #4338CA;
border-color: #4338CA;
}
.btn-secondary {
background-color: transparent;
border-color: #4F46E5;
color: #4F46E5;
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
font-weight: 600;
transition: all 0.2s ease-in-out;
}
.btn-secondary:hover {
background-color: #4F46E5;
color: #FFFFFF;
}
.section {
padding: 5rem 0;
}
.feature-card {
background-color: #FFFFFF;
border: 1px solid #E5E7EB;
border-radius: 0.5rem;
padding: 2rem;
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
height: 100%;
}
.feature-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px rgba(0,0,0,0.1);
}
.feature-card h3 {
color: #4F46E5;
}
.contact-section {
background-color: #FFFFFF;
}
.form-control:focus {
border-color: #8B5CF6;
box-shadow: 0 0 0 0.25rem rgba(139, 92, 246, 0.25);
}
footer {
background-color: #111827;
color: #E5E7EB;
padding: 3rem 0;
}
footer a {
color: #9CA3AF;
text-decoration: none;
transition: color 0.2s ease-in-out;
}
footer a:hover {
color: #FFFFFF;
}
.toast-container {
position: fixed;
bottom: 1rem;
right: 1rem;
z-index: 1090;
}

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

@ -0,0 +1,74 @@
document.addEventListener('DOMContentLoaded', function () {
const contactForm = document.getElementById('contactForm');
if (contactForm) {
contactForm.addEventListener('submit', function (e) {
e.preventDefault();
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const message = document.getElementById('message').value;
const submitButton = this.querySelector('button[type="submit"]');
const originalButtonText = submitButton.innerHTML;
// Basic validation
if (!name || !email || !message) {
showToast('Please fill out all fields.', 'danger');
return;
}
submitButton.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Sending...';
submitButton.disabled = true;
const formData = new FormData(this);
fetch('contact_handler.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
if (data.success) {
showToast('Thank you! Your message has been sent.', 'success');
contactForm.reset();
} else {
showToast(data.error || 'An unknown error occurred.', 'danger');
}
})
.catch(error => {
showToast('An error occurred while sending the message.', 'danger');
console.error('Error:', error);
})
.finally(() => {
submitButton.innerHTML = originalButtonText;
submitButton.disabled = false;
});
});
}
});
function showToast(message, type = 'success') {
const toastContainer = document.getElementById('toast-container');
if (!toastContainer) return;
const toastId = 'toast-' + Date.now();
const toastHTML = `
<div id="${toastId}" class="toast align-items-center text-white bg-${type} border-0" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body">
${message}
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</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', function () {
toastElement.remove();
});
}

70
contact_handler.php Normal file
View File

@ -0,0 +1,70 @@
<?php
header('Content-Type: application/json');
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/mail/MailService.php';
$response = ['success' => false, 'error' => 'An unknown error occurred.'];
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
$response['error'] = 'Invalid request method.';
echo json_encode($response);
exit;
}
$name = trim($_POST['name'] ?? '');
$email = trim($_POST['email'] ?? '');
$message = trim($_POST['message'] ?? '');
if (empty($name) || empty($email) || empty($message)) {
$response['error'] = 'Please fill out all fields.';
echo json_encode($response);
exit;
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$response['error'] = 'Invalid email format.';
echo json_encode($response);
exit;
}
try {
$pdo = db();
// 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 data
$stmt = $pdo->prepare("INSERT INTO contact_submissions (name, email, message) VALUES (?, ?, ?)");
$stmt->execute([$name, $email, $message]);
// Send email notification
$mailTo = getenv('MAIL_TO') ?: 'support@flatlogic.com'; // Fallback recipient
$subject = 'New Contact Form Submission from AI Web App Generator';
$mailResult = MailService::sendContactMessage($name, $email, $message, $mailTo, $subject);
if (!empty($mailResult['success'])) {
$response['success'] = true;
unset($response['error']);
} else {
// Still a success for the user, but log the mail error
$response['success'] = true;
$response['warning'] = 'Could not send notification email.';
error_log('MailService Error: ' . ($mailResult['error'] ?? 'Unknown mail error'));
}
} catch (PDOException $e) {
error_log("Database Error: " . $e->getMessage());
$response['error'] = 'Database error. Please try again later.';
} catch (Exception $e) {
error_log("General Error: " . $e->getMessage());
$response['error'] = 'A server error occurred. Please try again later.';
}
echo json_encode($response);

281
index.php
View File

@ -1,150 +1,143 @@
<?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">
<title>AI Web App Generator</title>
<meta name="description" content="AI Web App Generator: Effortlessly create full-stack web apps with AI-driven design and modern tech stacks.">
<meta name="keywords" content="ai web app generator, full-stack generator, react generator, node.js generator, database schema builder, crud generator, ai coding assistant, custom web application, low-code development, source code ownership, instant preview, automatic deployment">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:title" content="AI Web App Generator">
<meta property="og:description" content="AI Web App Generator: Effortlessly create full-stack web apps with AI-driven design and modern tech stacks.">
<meta property="og:image" content="https://project-screens.s3.amazonaws.com/screenshots/34578/app-hero-20251002-012850.png">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:title" content="AI Web App Generator">
<meta property="twitter:description" content="AI Web App Generator: Effortlessly create full-stack web apps with AI-driven design and modern tech stacks.">
<meta property="twitter:image" content="https://project-screens.s3.amazonaws.com/screenshots/34578/app-hero-20251002-012850.png">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/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&family=Georgia:wght@700&display=swap" rel="stylesheet">
<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>
</div>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer>
<header>
<nav class="navbar navbar-expand-lg navbar-light fixed-top">
<div class="container">
<a class="navbar-brand" href="#">GenApp</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="#features">Features</a></li>
<li class="nav-item"><a class="nav-link" href="#contact">Contact</a></li>
<li class="nav-item"><a class="nav-link btn btn-primary text-white ms-lg-2" href="#">Get Started</a></li>
</ul>
</div>
</div>
</nav>
</header>
<main>
<section class="hero text-center">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-9">
<h1 class="display-3 mb-3">Build Your Web App in Minutes, Not Months</h1>
<p class="lead mb-4">Describe your vision. Our AI generates the full-stack code, from frontend to database. You own it all.</p>
<a href="#" class="btn btn-primary btn-lg">Start Building for Free</a>
<a href="#features" class="btn btn-secondary btn-lg">Explore Features</a>
</div>
</div>
<div class="row justify-content-center mt-5">
<div class="col-lg-10">
<img src="https://picsum.photos/seed/hero/1200/800" class="img-fluid rounded-3 shadow-lg" alt="Abstract visualization of an AI generating a web application interface.">
</div>
</div>
</div>
</section>
<section id="features" class="section">
<div class="container">
<div class="text-center mb-5">
<h2 class="h1">The Future of Application Development</h2>
<p class="lead text-muted">Go from idea to deployment at lightspeed.</p>
</div>
<div class="row g-4">
<div class="col-md-6 col-lg-4">
<div class="feature-card">
<img src="https://picsum.photos/seed/feature1/600/400" class="img-fluid rounded mb-3" alt="A developer selecting a technology stack from a list of logos.">
<h3>AI-Powered Generation</h3>
<p>Use plain text, voice commands, or even screenshots. Our AI understands your requirements and generates a complete application, including UI, logic, and database schema.</p>
</div>
</div>
<div class="col-md-6 col-lg-4">
<div class="feature-card">
<img src="https://picsum.photos/seed/feature2/600/400" class="img-fluid rounded mb-3" alt="A visual database schema builder with tables and relationships.">
<h3>Visual Schema Builder</h3>
<p>Design your data model with an intuitive drag-and-drop interface. Create tables, define fields, and establish relationships without writing a single line of SQL.</p>
</div>
</div>
<div class="col-md-6 col-lg-4">
<div class="feature-card">
<img src="https://picsum.photos/seed/feature3/600/400" class="img-fluid rounded mb-3" alt="Source code editor showing generated React and Node.js code.">
<h3>Full Source Code Ownership</h3>
<p>Download the complete source code for your application. No vendor lock-in. Push it to your GitHub, customize it, and host it wherever you want. You have total control.</p>
</div>
</div>
</div>
</div>
</section>
<section id="contact" class="section contact-section">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-7">
<div class="text-center mb-5">
<h2 class="h1">Have Questions?</h2>
<p class="lead text-muted">Get in touch with our team to learn more about our platform or to discuss enterprise needs.</p>
</div>
<form id="contactForm" novalidate>
<div class="mb-3">
<label for="name" class="form-label">Full 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 Address</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>
<div class="text-center">
<button type="submit" class="btn btn-primary btn-lg">Send Message</button>
</div>
</form>
</div>
</div>
</div>
</section>
</main>
<footer class="text-center">
<div class="container">
<p class="mb-0">&copy; <?php echo date("Y"); ?> GenApp. All rights reserved.</p>
<p><a href="/privacy.php">Privacy Policy</a></p>
</div>
</footer>
<div id="toast-container" class="toast-container"></div>
<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>

28
privacy.php Normal file
View File

@ -0,0 +1,28 @@
<?php
http_response_code(501); // Not Implemented
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Privacy Policy</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
flex-direction: column;
}
</style>
</head>
<body>
<div class="container text-center">
<h1 class="display-4">Privacy Policy</h1>
<p class="lead">This page is under construction.</p>
<a href="/" class="btn btn-primary">Go to Homepage</a>
</div>
</body>
</html>