Compare commits

...

2 Commits

Author SHA1 Message Date
Flatlogic Bot
b20a76b7ff tgb 2026-02-09 02:36:11 +00:00
Flatlogic Bot
00a5c5a638 Version 1 2026-01-19 00:06:34 +00:00
6 changed files with 550 additions and 142 deletions

109
api/chat.php Normal file
View File

@ -0,0 +1,109 @@
<?php
require_once __DIR__ . '/../db/config.php';
require_once __DIR__ . '/../ai/LocalAIApi.php';
header('Content-Type: application/json');
$input = json_decode(file_get_contents('php://input'), true);
if (isset($input['action']) && $input['action'] === 'get_past_timesheets') {
try {
$pdo = db();
$stmt = $pdo->query("SELECT DATE(created_at) as timesheet_date, JSON_ARRAYAGG(JSON_OBJECT('id', id, 'task', task, 'project', project, 'output_type', output_type, 'duration', duration, 'timestamp', DATE_FORMAT(created_at, '%Y-%m-%d %H:%i:%s'))) as activities FROM activity_log GROUP BY timesheet_date ORDER BY timesheet_date DESC");
$past_timesheets = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(['past_timesheets' => $past_timesheets]);
} catch (PDOException $e) {
http_response_code(500);
error_log("DB Error: " . $e->getMessage());
echo json_encode(['error' => 'Database error while fetching past timesheets']);
}
exit;
}
if (isset($input['action']) && $input['action'] === 'manual_log') {
$task_description = $input['type'] . ': ' . $input['task'];
$project = $input['project'];
// For manual entries, we can set a duration of 0 or make it an optional field.
$duration_formatted = '00:00:00';
try {
$pdo = db();
$stmt = $pdo->prepare("INSERT INTO activity_log (task, project, output_type, duration) VALUES (?, ?, ?, ?)");
$stmt->execute([$task_description, $project, 'Human', $duration_formatted]);
$new_log_id = $pdo->lastInsertId();
$log_stmt = $pdo->prepare("SELECT *, DATE_FORMAT(created_at, '%Y-%m-%d %H:%i:%s') as timestamp FROM activity_log WHERE id = ?");
$log_stmt->execute([$new_log_id]);
$new_log_entry = $log_stmt->fetch(PDO::FETCH_ASSOC);
echo json_encode(['new_log_entry' => $new_log_entry]);
} catch (PDOException $e) {
http_response_code(500);
error_log("DB Error: " . $e->getMessage());
echo json_encode(['error' => 'Database error while logging manual entry']);
}
exit;
}
$user_message = $input['message'] ?? '';
if (empty($user_message)) {
echo json_encode(['error' => 'Empty message']);
exit;
}
$start_time = microtime(true);
// Use the LocalAIApi to get a response from the AI
$ai_response_data = LocalAIApi::createResponse([
'input' => [
['role' => 'system', 'content' => 'You are a helpful assistant.'],
['role' => 'user', 'content' => $user_message],
],
]);
if (empty($ai_response_data['success'])) {
http_response_code(500);
error_log('AI API Error: ' . ($ai_response_data['error'] ?? 'Unknown error'));
echo json_encode(['error' => 'Failed to get response from AI', 'details' => $ai_response_data['error'] ?? '']);
exit;
}
$ai_message = LocalAIApi::extractText($ai_response_data);
if ($ai_message === '') {
$decoded = LocalAIApi::decodeJsonFromResponse($ai_response_data);
$ai_message = $decoded ? json_encode($decoded, JSON_UNESCAPED_UNICODE) : 'Empty response from AI.';
}
$end_time = microtime(true);
$duration_seconds = round($end_time - $start_time);
$duration_formatted = gmdate("H:i:s", $duration_seconds);
$project_name = 'Chat Interaction';
try {
$pdo = db();
$stmt = $pdo->prepare("INSERT INTO activity_log (task, project, output_type, duration) VALUES (?, ?, ?, ?)");
$stmt->execute([$ai_message, $project_name, 'AI', $duration_formatted]);
// Fetch the new log entry to return it
$new_log_id = $pdo->lastInsertId();
$log_stmt = $pdo->prepare("SELECT *, DATE_FORMAT(created_at, '%Y-%m-%d %H:%i:%s') as timestamp FROM activity_log WHERE id = ?");
$log_stmt->execute([$new_log_id]);
$new_log_entry = $log_stmt->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
http_response_code(500);
error_log("DB Error: " . $e->getMessage());
echo json_encode(['error' => 'Database error while logging']);
exit;
}
echo json_encode([
'reply' => $ai_message,
'new_log_entry' => $new_log_entry
]);

31
api/leads.php Normal file
View File

@ -0,0 +1,31 @@
<?php
header('Content-Type: application/json');
require_once __DIR__ . '/../db/config.php';
require_once __DIR__ . '/../mail/MailService.php';
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
echo json_encode(['success' => false, 'error' => 'Invalid request method']);
exit;
}
$name = trim($_POST['name'] ?? '');
$email = trim($_POST['email'] ?? '');
$message = trim($_POST['message'] ?? '');
if (empty($name) || empty($email) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo json_encode(['success' => false, 'error' => 'Please provide a valid name and email address.']);
exit;
}
try {
$stmt = db()->prepare("INSERT INTO leads (name, email, message) VALUES (?, ?, ?)");
$stmt->execute([$name, $email, $message]);
// Optional: Send email notification
// MailService::sendContactMessage($name, $email, $message);
echo json_encode(['success' => true, 'message' => 'Thank you! We will get back to you shortly.']);
} catch (Exception $e) {
error_log($e->getMessage());
echo json_encode(['success' => false, 'error' => 'Something went wrong. Please try again later.']);
}

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

@ -0,0 +1,120 @@
:root {
--primary-color: #8A2BE2; /* Electric Purple */
--secondary-color: #1A1A1A; /* Deep Charcoal */
--accent-color: #FF3E00; /* Vibrant Orange/Red */
--bg-color: #0F0F0F;
--text-color: #FFFFFF;
--text-muted: #A0A0A0;
--card-bg: #1A1A1A;
--border-color: #333333;
}
body {
background-color: var(--bg-color);
color: var(--text-color);
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
line-height: 1.6;
}
h1, h2, h3, h4, h5, h6 {
font-weight: 800;
letter-spacing: -0.02em;
}
.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.btn-primary {
background-color: var(--primary-color);
border: none;
padding: 12px 24px;
font-weight: 600;
transition: all 0.3s ease;
border-radius: 4px;
}
.btn-primary:hover {
background-color: #7A1BD2;
transform: translateY(-2px);
box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}
.navbar {
background-color: rgba(15, 15, 15, 0.9) !important;
backdrop-filter: blur(10px);
border-bottom: 1px solid var(--border-color);
}
.hero-section {
padding: 120px 0;
background: radial-gradient(circle at 50% 50%, rgba(138, 43, 226, 0.1) 0%, rgba(15, 15, 15, 1) 70%);
}
.section-padding {
padding: 100px 0;
}
.card {
background-color: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 4px;
transition: all 0.3s ease;
}
.card:hover {
border-color: var(--primary-color);
}
.service-card {
padding: 40px;
height: 100%;
}
.service-icon {
font-size: 2.5rem;
margin-bottom: 20px;
color: var(--primary-color);
}
.form-control {
background-color: #222;
border: 1px solid var(--border-color);
color: #fff;
padding: 12px;
border-radius: 4px;
}
.form-control:focus {
background-color: #2a2a2a;
border-color: var(--primary-color);
color: #fff;
box-shadow: none;
}
.footer {
border-top: 1px solid var(--border-color);
padding: 60px 0;
background-color: #0A0A0A;
}
.badge-vibrant {
background-color: var(--accent-color);
color: white;
font-size: 0.8rem;
padding: 5px 12px;
border-radius: 20px;
}
/* Toast styling */
.toast-container {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 1050;
}
.toast {
background-color: var(--card-bg);
border: 1px solid var(--primary-color);
color: white;
}

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

@ -0,0 +1,66 @@
document.addEventListener('DOMContentLoaded', function() {
const contactForm = document.getElementById('contactForm');
const toastContainer = document.getElementById('toast-container');
if (contactForm) {
contactForm.addEventListener('submit', function(e) {
e.preventDefault();
const submitBtn = contactForm.querySelector('button[type="submit"]');
const originalBtnText = submitBtn.innerHTML;
submitBtn.disabled = true;
submitBtn.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Sending...';
const formData = new FormData(contactForm);
fetch('api/leads.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
if (data.success) {
showToast(data.message, 'success');
contactForm.reset();
} else {
showToast(data.error || 'Something went wrong.', 'danger');
}
})
.catch(error => {
console.error('Error:', error);
showToast('An error occurred. Please try again.', 'danger');
})
.finally(() => {
submitBtn.disabled = false;
submitBtn.innerHTML = originalBtnText;
});
});
}
function showToast(message, type) {
const toastId = 'toast-' + Date.now();
const toastHTML = `
<div id="${toastId}" class="toast show" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header bg-dark text-white border-bottom border-secondary">
<strong class="me-auto">${type === 'success' ? 'Success' : 'Error'}</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>
`;
const toastElement = document.createElement('div');
toastElement.innerHTML = toastHTML;
toastContainer.appendChild(toastElement);
setTimeout(() => {
const toast = document.getElementById(toastId);
if (toast) {
toast.classList.remove('show');
setTimeout(() => toast.remove(), 500);
}
}, 5000);
}
});

View File

@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS leads (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
message TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

351
index.php
View File

@ -1,150 +1,225 @@
<?php <?php
declare(strict_types=1); require_once 'db/config.php';
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION; $projectName = $_SERVER['PROJECT_NAME'] ?? 'VibeSocial Agency';
$now = date('Y-m-d H:i:s'); $projectDesc = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Modern Social Media Marketing for high-growth startups and SMBs.';
?> ?>
<!doctype html> <!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><?php echo htmlspecialchars($projectName); ?> | Premium SMM Agency</title>
<?php <meta name="description" content="<?php echo htmlspecialchars($projectDesc); ?>">
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? ''; <!-- Bootstrap 5 CSS -->
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
?> <!-- Google Fonts - Inter -->
<?php if ($projectDescription): ?> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap" rel="stylesheet">
<!-- Meta description --> <!-- Custom CSS -->
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' /> <link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<!-- 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>
</head> </head>
<body> <body>
<main>
<div class="card"> <!-- Navigation -->
<h1>Analyzing your requirements and generating your website…</h1> <nav class="navbar navbar-expand-lg navbar-dark sticky-top">
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes"> <div class="container">
<span class="sr-only">Loading…</span> <a class="navbar-brand fw-bold fs-4" href="#"><?php echo htmlspecialchars($projectName); ?></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<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="#services">Services</a></li>
<li class="nav-item"><a class="nav-link" href="#portfolio">Portfolio</a></li>
<li class="nav-item"><a class="nav-link" href="#pricing">Pricing</a></li>
<li class="nav-item"><a class="nav-link btn btn-primary ms-lg-3 text-white" href="#contact">Book a Call</a></li>
</ul>
</div> </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> </div>
</main> </nav>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC) <!-- Hero Section -->
<section class="hero-section text-center">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-10">
<span class="badge badge-vibrant mb-3">#1 Rated SMM Agency 2026</span>
<h1 class="display-3 fw-bold mb-4">We Scale Your Brand via <span class="text-primary">Social Excellence.</span></h1>
<p class="lead text-muted mb-5 fs-4"><?php echo htmlspecialchars($projectDesc); ?></p>
<div class="d-flex justify-content-center gap-3">
<a href="#contact" class="btn btn-primary btn-lg">Start Growing Now</a>
<a href="#services" class="btn btn-outline-light btn-lg">Our Services</a>
</div>
</div>
</div>
</div>
</section>
<!-- Services Section -->
<section id="services" class="section-padding">
<div class="container">
<div class="text-center mb-5">
<h2 class="display-5 fw-bold">Our Core Expertise</h2>
<p class="text-muted">Tailored strategies to dominate every platform.</p>
</div>
<div class="row g-4">
<div class="col-md-4">
<div class="card service-card">
<div class="service-icon"></div>
<h3>Content Strategy</h3>
<p class="text-muted">High-converting viral content designed to capture attention and drive engagement across TikTok, Reels, and YouTube.</p>
</div>
</div>
<div class="col-md-4">
<div class="card service-card">
<div class="service-icon"></div>
<h3>Paid Acquisition</h3>
<p class="text-muted">Data-driven Meta and TikTok ad campaigns focused on ROI and scalable customer acquisition for your business.</p>
</div>
</div>
<div class="col-md-4">
<div class="card service-card">
<div class="service-icon"></div>
<h3>Community Management</h3>
<p class="text-muted">Building loyal fanbases and handling 24/7 engagement to turn followers into lifelong brand advocates.</p>
</div>
</div>
</div>
</div>
</section>
<!-- Portfolio Stub -->
<section id="portfolio" class="section-padding bg-dark">
<div class="container">
<div class="row align-items-center">
<div class="col-lg-6">
<h2 class="display-5 fw-bold mb-4">Real Results for <span class="text-primary">Real Brands.</span></h2>
<p class="text-muted mb-4">We don't just post; we perform. Our clients see an average of 300% growth in organic reach within the first 90 days.</p>
<ul class="list-unstyled text-muted mb-5">
<li class="mb-2"> 50M+ Organic Impressions Generated</li>
<li class="mb-2"> $10M+ Managed Ad Spend</li>
<li class="mb-2"> 500+ Viral Videos Produced</li>
</ul>
</div>
<div class="col-lg-6">
<div class="row g-3">
<div class="col-6">
<div class="card h-100 p-4 text-center">
<h4 class="text-primary fw-bold">12.5%</h4>
<small class="text-muted">Avg. CTR</small>
</div>
</div>
<div class="col-6">
<div class="card h-100 p-4 text-center">
<h4 class="text-primary fw-bold">2.4M</h4>
<small class="text-muted">Followers Gained</small>
</div>
</div>
<div class="col-12">
<div class="card h-100 p-4 text-center">
<h4 class="text-primary fw-bold">4.8x</h4>
<small class="text-muted">Average ROAS</small>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Pricing Section -->
<section id="pricing" class="section-padding">
<div class="container">
<div class="text-center mb-5">
<h2 class="display-5 fw-bold">Simple, Transparent Pricing</h2>
<p class="text-muted">No hidden fees. Just growth.</p>
</div>
<div class="row g-4 justify-content-center">
<div class="col-md-4">
<div class="card p-5 h-100">
<h3 class="fs-5">Growth</h3>
<div class="display-6 fw-bold my-3">$1,999<span class="fs-6 text-muted">/mo</span></div>
<p class="text-muted small">Perfect for startups.</p>
<hr class="border-secondary">
<ul class="list-unstyled mb-5">
<li> 3 Platforms Managed</li>
<li> 12 Original Videos/mo</li>
<li> Basic Paid Ad Setup</li>
<li> Monthly Reporting</li>
</ul>
<a href="#contact" class="btn btn-outline-light mt-auto">Choose Plan</a>
</div>
</div>
<div class="col-md-4">
<div class="card p-5 h-100 border-primary">
<div class="badge bg-primary mb-2">Most Popular</div>
<h3 class="fs-5">Scale</h3>
<div class="display-6 fw-bold my-3">$3,999<span class="fs-6 text-muted">/mo</span></div>
<p class="text-muted small">For established brands.</p>
<hr class="border-secondary">
<ul class="list-unstyled mb-5">
<li> 5 Platforms Managed</li>
<li> 25 Original Videos/mo</li>
<li> Advanced Paid Ads + Retargeting</li>
<li> 24/7 Community Support</li>
</ul>
<a href="#contact" class="btn btn-primary mt-auto">Choose Plan</a>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="section-padding bg-dark">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8 text-center mb-5">
<h2 class="display-5 fw-bold">Ready to Dominate?</h2>
<p class="text-muted">Fill out the form below and our strategy team will be in touch within 24 hours.</p>
</div>
<div class="col-lg-6">
<div class="card p-4 p-md-5">
<form id="contactForm">
<div class="mb-4">
<label for="name" class="form-label">Full Name</label>
<input type="text" class="form-control" id="name" name="name" placeholder="John Doe" required>
</div>
<div class="mb-4">
<label for="email" class="form-label">Work Email</label>
<input type="email" class="form-control" id="email" name="email" placeholder="john@company.com" required>
</div>
<div class="mb-4">
<label for="message" class="form-label">How can we help?</label>
<textarea class="form-control" id="message" name="message" rows="4" placeholder="Tell us about your project goals..."></textarea>
</div>
<button type="submit" class="btn btn-primary w-100 btn-lg">Send Message</button>
</form>
</div>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="footer text-center">
<div class="container">
<h3 class="fw-bold mb-4"><?php echo htmlspecialchars($projectName); ?></h3>
<div class="d-flex justify-content-center gap-4 mb-4">
<a href="#" class="text-muted text-decoration-none">Twitter</a>
<a href="#" class="text-muted text-decoration-none">Instagram</a>
<a href="#" class="text-muted text-decoration-none">LinkedIn</a>
</div>
<p class="text-muted small">&copy; <?php echo date('Y'); ?> <?php echo htmlspecialchars($projectName); ?>. All rights reserved.</p>
</div>
</footer> </footer>
<!-- Toast Container -->
<div id="toast-container" class="toast-container"></div>
<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body> </body>
</html> </html>