1.1
This commit is contained in:
parent
d70cbb38d2
commit
7689e6d605
49
contact.php
Normal file
49
contact.php
Normal 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
435
index.php
@ -1,150 +1,297 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
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>
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
<title>TAP2SKILL - Learn. Hustle. Thrive.</title>
|
||||||
<?php
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
// Read project preview data from environment
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Lato:wght@400;700&display=swap" rel="stylesheet">
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<style>
|
||||||
?>
|
:root {
|
||||||
<?php if ($projectDescription): ?>
|
--primary-color: #2A9D8F;
|
||||||
<!-- Meta description -->
|
--secondary-color: #E9C46A;
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
--background-color: #F4F4F4;
|
||||||
<!-- Open Graph meta tags -->
|
--surface-color: #FFFFFF;
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
--text-color: #264653;
|
||||||
<!-- Twitter meta tags -->
|
--gradient-start: #2A9D8F;
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
--gradient-end: #3aafa9;
|
||||||
<?php endif; ?>
|
}
|
||||||
<?php if ($projectImageUrl): ?>
|
body {
|
||||||
<!-- Open Graph image -->
|
font-family: 'Lato', sans-serif;
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
margin: 0;
|
||||||
<!-- Twitter image -->
|
background-color: var(--background-color);
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
color: var(--text-color);
|
||||||
<?php endif; ?>
|
}
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
.container {
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
max-width: 1200px;
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
margin: 0 auto;
|
||||||
<style>
|
padding: 0 24px;
|
||||||
:root {
|
}
|
||||||
--bg-color-start: #6a11cb;
|
header {
|
||||||
--bg-color-end: #2575fc;
|
background-color: var(--surface-color);
|
||||||
--text-color: #ffffff;
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
padding: 16px 0;
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
position: sticky;
|
||||||
}
|
top: 0;
|
||||||
body {
|
z-index: 100;
|
||||||
margin: 0;
|
}
|
||||||
font-family: 'Inter', sans-serif;
|
nav {
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
display: flex;
|
||||||
color: var(--text-color);
|
justify-content: space-between;
|
||||||
display: flex;
|
align-items: center;
|
||||||
justify-content: center;
|
}
|
||||||
align-items: center;
|
.logo {
|
||||||
min-height: 100vh;
|
font-family: 'Poppins', sans-serif;
|
||||||
text-align: center;
|
font-size: 24px;
|
||||||
overflow: hidden;
|
font-weight: 700;
|
||||||
position: relative;
|
color: var(--primary-color);
|
||||||
}
|
text-decoration: none;
|
||||||
body::before {
|
}
|
||||||
content: '';
|
nav ul {
|
||||||
position: absolute;
|
list-style: none;
|
||||||
top: 0;
|
margin: 0;
|
||||||
left: 0;
|
padding: 0;
|
||||||
width: 100%;
|
display: flex;
|
||||||
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>');
|
nav ul li {
|
||||||
animation: bg-pan 20s linear infinite;
|
margin-left: 32px;
|
||||||
z-index: -1;
|
}
|
||||||
}
|
nav ul li a {
|
||||||
@keyframes bg-pan {
|
text-decoration: none;
|
||||||
0% { background-position: 0% 0%; }
|
color: var(--text-color);
|
||||||
100% { background-position: 100% 100%; }
|
font-weight: 600;
|
||||||
}
|
transition: color 0.3s ease;
|
||||||
main {
|
}
|
||||||
padding: 2rem;
|
nav ul li a:hover {
|
||||||
}
|
color: var(--primary-color);
|
||||||
.card {
|
}
|
||||||
background: var(--card-bg-color);
|
.hero {
|
||||||
border: 1px solid var(--card-border-color);
|
background: linear-gradient(45deg, var(--gradient-start), var(--gradient-end));
|
||||||
border-radius: 16px;
|
color: white;
|
||||||
padding: 2rem;
|
padding: 120px 0;
|
||||||
backdrop-filter: blur(20px);
|
text-align: center;
|
||||||
-webkit-backdrop-filter: blur(20px);
|
}
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
.hero h1 {
|
||||||
}
|
font-family: 'Poppins', sans-serif;
|
||||||
.loader {
|
font-size: 56px;
|
||||||
margin: 1.25rem auto 1.25rem;
|
margin: 0 0 16px;
|
||||||
width: 48px;
|
}
|
||||||
height: 48px;
|
.hero p {
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
font-size: 20px;
|
||||||
border-top-color: #fff;
|
margin: 0 0 32px;
|
||||||
border-radius: 50%;
|
}
|
||||||
animation: spin 1s linear infinite;
|
.cta-button {
|
||||||
}
|
font-family: 'Poppins', sans-serif;
|
||||||
@keyframes spin {
|
background-color: var(--secondary-color);
|
||||||
from { transform: rotate(0deg); }
|
color: var(--text-color);
|
||||||
to { transform: rotate(360deg); }
|
padding: 16px 32px;
|
||||||
}
|
border-radius: 8px;
|
||||||
.hint {
|
text-decoration: none;
|
||||||
opacity: 0.9;
|
font-weight: 600;
|
||||||
}
|
transition: transform 0.3s ease;
|
||||||
.sr-only {
|
display: inline-block;
|
||||||
position: absolute;
|
}
|
||||||
width: 1px; height: 1px;
|
.cta-button:hover {
|
||||||
padding: 0; margin: -1px;
|
transform: translateY(-2px);
|
||||||
overflow: hidden;
|
}
|
||||||
clip: rect(0, 0, 0, 0);
|
section {
|
||||||
white-space: nowrap; border: 0;
|
padding: 80px 0;
|
||||||
}
|
}
|
||||||
h1 {
|
.section-title {
|
||||||
font-size: 3rem;
|
font-family: 'Poppins', sans-serif;
|
||||||
font-weight: 700;
|
font-size: 40px;
|
||||||
margin: 0 0 1rem;
|
text-align: center;
|
||||||
letter-spacing: -1px;
|
margin-bottom: 48px;
|
||||||
}
|
}
|
||||||
p {
|
.grid {
|
||||||
margin: 0.5rem 0;
|
display: grid;
|
||||||
font-size: 1.1rem;
|
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||||
}
|
gap: 32px;
|
||||||
code {
|
}
|
||||||
background: rgba(0,0,0,0.2);
|
.card {
|
||||||
padding: 2px 6px;
|
background-color: var(--surface-color);
|
||||||
border-radius: 4px;
|
border-radius: 8px;
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||||||
}
|
padding: 32px;
|
||||||
footer {
|
text-align: center;
|
||||||
position: absolute;
|
}
|
||||||
bottom: 1rem;
|
.testimonial-card {
|
||||||
font-size: 0.8rem;
|
background-color: var(--surface-color);
|
||||||
opacity: 0.7;
|
border-radius: 8px;
|
||||||
}
|
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||||||
</style>
|
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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
|
||||||
<div class="card">
|
<header>
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<nav class="container">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<a href="#" class="logo">TAP2SKILL</a>
|
||||||
<span class="sr-only">Loading…</span>
|
<ul>
|
||||||
</div>
|
<li><a href="#about">About</a></li>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
<li><a href="#features">Features</a></li>
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
<li><a href="#testimonials">Testimonials</a></li>
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
<li><a href="#contact">Contact</a></li>
|
||||||
</div>
|
</ul>
|
||||||
</main>
|
</nav>
|
||||||
<footer>
|
</header>
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
|
||||||
</footer>
|
<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>© 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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user