This commit is contained in:
Flatlogic Bot 2025-10-14 11:54:32 +00:00
parent d70cbb38d2
commit 7689e6d605
2 changed files with 341 additions and 145 deletions

49
contact.php Normal file
View File

@ -0,0 +1,49 @@
<?php
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/mail/MailService.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)) {
http_response_code(400);
echo json_encode(['success' => false, 'message' => 'Invalid input.']);
exit;
}
try {
$pdo = db();
$stmt = $pdo->prepare("INSERT INTO contact_submissions (name, email, message) VALUES (?, ?, ?)");
$stmt->execute([$name, $email, $message]);
} catch (PDOException $e) {
// In a real app, you would log this error.
http_response_code(500);
echo json_encode(['success' => false, 'message' => 'Database error.']);
exit;
}
$to = getenv('MAIL_TO'); // You can set this in your .env file
$subject = 'New Contact Form Submission';
$emailBody = "<p>You have a new contact form submission:</p>"
. "<ul>"
. "<li><strong>Name:</strong> " . htmlspecialchars($name) . "</li>"
. "<li><strong>Email:</strong> " . htmlspecialchars($email) . "</li>"
. "<li><strong>Message:</strong><br>" . nl2br(htmlspecialchars($message)) . "</li>"
. "</ul>";
$result = MailService::sendMail($to, $subject, $emailBody, strip_tags($emailBody), ['reply_to' => $email]);
if ($result['success']) {
echo json_encode(['success' => true, 'message' => 'Message sent successfully!']);
} else {
// In a real app, you would log this error.
http_response_code(500);
echo json_encode(['success' => false, 'message' => 'Failed to send email.']);
}
} else {
http_response_code(405);
echo json_encode(['success' => false, 'message' => 'Method not allowed.']);
}

435
index.php
View File

@ -1,150 +1,297 @@
<?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>TAP2SKILL - Learn. Hustle. Thrive.</title>
<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=Poppins:wght@400;600;700&family=Lato:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--primary-color: #2A9D8F;
--secondary-color: #E9C46A;
--background-color: #F4F4F4;
--surface-color: #FFFFFF;
--text-color: #264653;
--gradient-start: #2A9D8F;
--gradient-end: #3aafa9;
}
body {
font-family: 'Lato', sans-serif;
margin: 0;
background-color: var(--background-color);
color: var(--text-color);
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 24px;
}
header {
background-color: var(--surface-color);
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
padding: 16px 0;
position: sticky;
top: 0;
z-index: 100;
}
nav {
display: flex;
justify-content: space-between;
align-items: center;
}
.logo {
font-family: 'Poppins', sans-serif;
font-size: 24px;
font-weight: 700;
color: var(--primary-color);
text-decoration: none;
}
nav ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
}
nav ul li {
margin-left: 32px;
}
nav ul li a {
text-decoration: none;
color: var(--text-color);
font-weight: 600;
transition: color 0.3s ease;
}
nav ul li a:hover {
color: var(--primary-color);
}
.hero {
background: linear-gradient(45deg, var(--gradient-start), var(--gradient-end));
color: white;
padding: 120px 0;
text-align: center;
}
.hero h1 {
font-family: 'Poppins', sans-serif;
font-size: 56px;
margin: 0 0 16px;
}
.hero p {
font-size: 20px;
margin: 0 0 32px;
}
.cta-button {
font-family: 'Poppins', sans-serif;
background-color: var(--secondary-color);
color: var(--text-color);
padding: 16px 32px;
border-radius: 8px;
text-decoration: none;
font-weight: 600;
transition: transform 0.3s ease;
display: inline-block;
}
.cta-button:hover {
transform: translateY(-2px);
}
section {
padding: 80px 0;
}
.section-title {
font-family: 'Poppins', sans-serif;
font-size: 40px;
text-align: center;
margin-bottom: 48px;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 32px;
}
.card {
background-color: var(--surface-color);
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
padding: 32px;
text-align: center;
}
.testimonial-card {
background-color: var(--surface-color);
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
padding: 32px;
text-align: center;
}
.testimonial-card p {
font-style: italic;
}
.testimonial-card .author {
margin-top: 16px;
font-weight: 700;
}
#contact {
background-color: var(--surface-color);
}
form {
max-width: 600px;
margin: 0 auto;
display: flex;
flex-direction: column;
}
form input, form textarea {
font-family: 'Lato', sans-serif;
padding: 16px;
margin-bottom: 16px;
border: 1px solid #ccc;
border-radius: 8px;
font-size: 16px;
}
form button {
font-family: 'Poppins', sans-serif;
background-color: var(--primary-color);
color: white;
padding: 16px 32px;
border-radius: 8px;
border: none;
font-weight: 600;
cursor: pointer;
transition: background-color 0.3s ease;
}
form button:hover {
background-color: #228b80;
}
footer {
background-color: var(--text-color);
color: white;
text-align: center;
padding: 24px 0;
}
</style>
</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="container">
<a href="#" class="logo">TAP2SKILL</a>
<ul>
<li><a href="#about">About</a></li>
<li><a href="#features">Features</a></li>
<li><a href="#testimonials">Testimonials</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section class="hero">
<div class="container">
<h1>Learn. Hustle. Thrive.</h1>
<p>Your journey to mastery starts here.</p>
<a href="#features" class="cta-button">Explore Features</a>
</div>
</section>
<section id="about">
<div class="container">
<h2 class="section-title">About TAP2SKILL</h2>
<p style="text-align: center; max-width: 800px; margin: 0 auto 48px;">TAP2SKILL is a modern learning platform designed to help you acquire new skills efficiently and effectively. We believe in a hands-on, project-based approach to learning that prepares you for real-world challenges.</p>
</div>
</section>
<section id="features">
<div class="container">
<h2 class="section-title">Core Features</h2>
<div class="grid">
<div class="card">
<h3>Skill Explorer</h3>
<p>Discover new skills and learning paths tailored to your interests and career goals.</p>
</div>
<div class="card">
<h3>Video-Based Learning</h3>
<p>Engage with high-quality video content from industry experts.</p>
</div>
<div class="card">
<h3>Project-Based Tasks</h3>
<p>Apply what you learn with hands-on projects and real-world scenarios.</p>
</div>
</div>
</div>
</section>
<section id="testimonials">
<div class="container">
<h2 class="section-title">What Our Users Say</h2>
<div class="grid">
<div class="testimonial-card">
<p>"TAP2SKILL helped me land my dream job. The project-based learning was a game-changer."</p>
<p class="author">- Alex Doe</p>
</div>
<div class="testimonial-card">
<p>"I love the flexibility of the platform. I can learn at my own pace, anytime, anywhere."</p>
<p class="author">- Jane Smith</p>
</div>
<div class="testimonial-card">
<p>"The instructors are top-notch. I've learned so much in such a short time."</p>
<p class="author">- Sam Wilson</p>
</div>
</div>
</div>
</section>
<section id="contact">
<div class="container">
<h2 class="section-title">Contact Us</h2>
<form id="contact-form" action="contact.php" method="POST">
<input type="text" name="name" placeholder="Your Name" required>
<input type="email" name="email" placeholder="Your Email" required>
<textarea name="message" rows="5" placeholder="Your Message" required></textarea>
<button type="submit">Send Message</button>
</form>
</div>
</section>
</main>
<footer>
<div class="container">
<p>&copy; 2025 TAP2SKILL. All Rights Reserved.</p>
</div>
</footer>
<script>
document.getElementById('contact-form').addEventListener('submit', function(e) {
e.preventDefault();
const form = e.target;
const button = form.querySelector('button');
const buttonText = button.textContent;
button.textContent = 'Sending...';
button.disabled = true;
const formData = new FormData(form);
fetch('contact.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
if (data.success) {
form.reset();
alert('Thank you for your message! We will get back to you shortly.');
} else {
alert('An error occurred: ' + data.message);
}
})
.catch(error => {
console.error('Error:', error);
alert('An unexpected error occurred. Please try again later.');
})
.finally(() => {
button.textContent = buttonText;
button.disabled = false;
});
});
</script>
</body>
</html>