35049-vm/index.php
Flatlogic Bot 119d467b75 v2.0
2025-10-19 03:32:56 +00:00

92 lines
4.0 KiB
PHP

<?php
require_once __DIR__ . '/db/config.php';
$success_toast = false;
if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['name'])) {
$name = trim($_POST['name']);
if (!empty($name)) {
try {
$pdo = db();
$stmt = $pdo->prepare("INSERT INTO submissions (name) VALUES (?)");
$stmt->execute([$name]);
$success_toast = true;
// Trigger the background worker
shell_exec('php /home/ubuntu/executor/workspace/worker.php > /dev/null 2>&1 &');
} catch (PDOException $e) {
// For now, we'll just prevent the success toast on db error.
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lead Enricher</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
<div class="container-fluid">
<a class="navbar-brand" href="index.php">
<i class="bi bi-person-bounding-box text-primary"></i>
Lead Enricher
</a>
<div class="collapse navbar-collapse">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="analyst_dashboard.php">Dashboard</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Hero Section -->
<div class="container col-xl-10 col-xxl-8 px-4 py-5">
<div class="row align-items-center g-lg-5 py-5">
<div class="col-lg-7 text-center text-lg-start">
<h1 class="display-4 fw-bold lh-1 mb-3">Enrich Leads, Effortlessly</h1>
<p class="col-lg-10 fs-4">Submit a name, and our AI will find and classify their social profiles, industry, and location. Turn a simple name into a rich lead.</p>
</div>
<div class="col-md-10 mx-auto col-lg-5">
<form class="p-4 p-md-5 border rounded-3 bg-white shadow-sm" method="POST" action="index.php">
<div class="form-floating mb-3">
<input type="text" class="form-control" id="name" name="name" placeholder="e.g., John Doe" required>
<label for="name">Full Name</label>
</div>
<button class="w-100 btn btn-lg btn-primary" type="submit">Enrich Name</button>
<hr class="my-4">
<small class="text-muted">By clicking Enrich Name, you agree to the terms of use.</small>
</form>
</div>
</div>
</div>
<!-- Toast Notification -->
<?php if ($success_toast): ?>
<div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
<div id="successToast" class="toast show align-items-center text-white bg-primary border-0" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body">
<i class="bi bi-check-circle-fill me-2"></i>
Name submitted successfully! We'll start the enrichment process.
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
<?php endif; ?>
<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>
</html>