Compare commits

...

1 Commits

Author SHA1 Message Date
Flatlogic Bot
de0994c87d Optera1 2026-01-16 01:34:36 +00:00
4 changed files with 228 additions and 136 deletions

23
add_contact.php Normal file
View File

@ -0,0 +1,23 @@
<?php
require_once 'db/config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$name = $_POST['name'] ?? '';
$email = $_POST['email'] ?? '';
$phone = $_POST['phone'] ?? '';
if (!empty($name)) {
try {
$pdo = db();
$stmt = $pdo->prepare("INSERT INTO contacts (name, email, phone) VALUES (?, ?, ?)");
$stmt->execute([$name, $email, $phone]);
} catch (PDOException $e) {
// In a real app, you'd log this error.
// For now, we'll just ignore it for this simple example.
}
}
}
header('Location: index.php');
exit;
?>

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

@ -0,0 +1,15 @@
body {
background-color: #F9FAFB;
font-family: 'Inter', sans-serif;
}
:root {
--primary-color: #4F46E5;
--secondary-color: #10B981;
--background-color: #F9FAFB;
--surface-color: #FFFFFF;
--text-color: #111827;
}
.btn-primary {
background-color: var(--primary-color);
border-color: var(--primary-color);
}

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

@ -0,0 +1,2 @@
// This file can be used for custom JavaScript

276
index.php
View File

@ -4,147 +4,199 @@ declare(strict_types=1);
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
require_once 'db/config.php';
// Create contacts table if it doesn't exist
try {
$pdo = db();
$pdo->exec("CREATE TABLE IF NOT EXISTS contacts (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255),
phone VARCHAR(50),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)");
} catch (PDOException $e) {
// In a real app, you'd log this error.
die("Could not connect to the database and create table.");
}
$contacts = [];
try {
$pdo = db();
$stmt = $pdo->query("SELECT id, name, email, phone, created_at FROM contacts ORDER BY created_at DESC");
$contacts = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
// In a real app, you'd log this error.
}
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Optera CRM';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<!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 -->
<title>Optera CRM</title>
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
<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 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;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<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;
height: 100vh;
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;
.sidebar {
width: 280px;
background-color: var(--surface-color);
border-right: 1px solid #e5e7eb;
padding: 1.5rem;
display: flex;
flex-direction: column;
}
@keyframes bg-pan {
0% { background-position: 0% 0%; }
100% { background-position: 100% 100%; }
}
main {
.main-content {
flex-grow: 1;
overflow-y: auto;
padding: 2rem;
background-color: var(--background-color);
}
.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);
.sidebar .nav-link {
color: #374151;
font-weight: 500;
}
.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;
.sidebar .nav-link.active, .sidebar .nav-link:hover {
color: var(--primary-color);
background-color: #e0e7ff;
}
@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;
.sidebar .nav-link svg {
margin-right: 0.75rem;
width: 24px;
height: 24px;
}
</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 class="sidebar">
<h1 class="h4 mb-4">Optera CRM</h1>
<ul class="nav flex-column nav-pills">
<li class="nav-item mb-2">
<a class="nav-link d-flex align-items-center" href="#">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
<path stroke-linecap="round" stroke-linejoin="round" d="m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />
</svg>
Dashboard
</a>
</li>
<li class="nav-item mb-2">
<a class="nav-link d-flex align-items-center active" href="#">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-2.438c.155-.155.293-.31.428-.472a9.349 9.349 0 0 0-4.549-2.438c-.472.585-.92 1.252-1.314 1.995a9.344 9.344 0 0 0-2.625.372m-5.625 0a9.38 9.38 0 0 1-2.625-.372A9.337 9.337 0 0 1 3.879 15.2c-.155.155-.293.31-.428.472a9.349 9.349 0 0 1 4.549 2.438c.472-.585.92-1.252 1.314-1.995.043.03.085.058.128.085a9.344 9.344 0 0 1 2.625.372M8.25 12.75a3.375 3.375 0 1 1 7.5 0 3.375 3.375 0 0 1-7.5 0ZM12 15.75a3.375 3.375 0 1 1 0-6.75 3.375 3.375 0 0 1 0 6.75Z" />
</svg>
Contacts
</a>
</li>
<li class="nav-item mb-2"><a class="nav-link d-flex align-items-center" href="#">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" >
<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M9 6.75h6M9 12h6m-6 5.25h6M5.25 6h.008v.008H5.25V6Zm.75 0h.008v.008H6V6Zm.75 0h.008v.008H6.75V6Zm.75 0h.008v.008H7.5V6Zm.75 0h.008v.008H8.25V6Zm.75 0h.008v.008H9V6Zm.75 0h.008v.008H9.75V6Zm.75 0h.008v.008H10.5V6Zm.75 0h.008v.008H11.25V6Zm.75 0h.008v.008H12V6Zm.75 0h.008v.008H12.75V6Zm.75 0h.008v.008H13.5V6Zm.75 0h.008v.008H14.25V6Zm.75 0h.008v.008H15V6Zm.75 0h.008v.008H15.75V6Zm.75 0h.008v.008H16.5V6Zm.75 0h.008v.008H17.25V6Zm.75 0h.008v.008H18V6Zm.75 0h.008v.008H18.75V6Z" />
</svg>
Companies</a></li>
<li class="nav-item mb-2"><a class="nav-link d-flex align-items-center" href="#">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 18 9 11.25l4.306 4.306a11.95 11.95 0 0 1 5.814-5.518l2.74-1.22m0 0-5.94-2.281m5.94 2.28-2.28 5.941" />
</svg>
Deals</a></li>
</ul>
</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="main-content">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2 class="h3">Contacts</h2>
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addContactModal">Add Contact</button>
</div>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer>
<div class="card border-0 shadow-sm">
<div class="card-body">
<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>Created At</th>
</tr>
</thead>
<tbody>
<?php if (empty($contacts)): ?>
<tr>
<td colspan="4" class="text-center py-5">
<p class="mb-2">No contacts yet.</p>
<button class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addContactModal">Add your first contact</button>
</td>
</tr>
<?php else: ?>
<?php foreach ($contacts as $contact): ?>
<tr>
<td><?= htmlspecialchars($contact['name']) ?></td>
<td><?= htmlspecialchars($contact['email']) ?></td>
<td><?= htmlspecialchars($contact['phone']) ?></td>
<td><?= htmlspecialchars((new DateTime($contact['created_at']))->format('M j, Y')) ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Add Contact Modal -->
<div class="modal fade" id="addContactModal" tabindex="-1" aria-labelledby="addContactModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addContactModalLabel">Add New Contact</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form action="add_contact.php" method="POST">
<div class="modal-body">
<div class="mb-3">
<label for="name" class="form-label">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">
</div>
<div class="mb-3">
<label for="phone" class="form-label">Phone</label>
<input type="text" class="form-control" id="phone" name="phone">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save Contact</button>
</div>
</form>
</div>
</div>
</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>