V1
This commit is contained in:
parent
62fefa6a53
commit
7985ade2ba
194
assets/css/custom.css
Normal file
194
assets/css/custom.css
Normal file
@ -0,0 +1,194 @@
|
||||
body {
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
background-color: #F8F9FA;
|
||||
color: #343A40;
|
||||
}
|
||||
|
||||
.hero {
|
||||
background: linear-gradient(45deg, #007BFF, #0056b3);
|
||||
color: white;
|
||||
padding: 100px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.hero h1 {
|
||||
font-family: Georgia, 'Times New Roman', Times, serif;
|
||||
font-size: 3.5rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.features {
|
||||
padding: 80px 0;
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
font-size: 3rem;
|
||||
color: #007BFF;
|
||||
}
|
||||
|
||||
#invite-form-section {
|
||||
padding: 80px 0;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.toast-container {
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
z-index: 1050;
|
||||
}
|
||||
|
||||
/* Dashboard Styles */
|
||||
.dashboard-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16px 32px;
|
||||
background-color: #FFFFFF;
|
||||
border-bottom: 1px solid #DEE2E6;
|
||||
}
|
||||
|
||||
.dashboard-header .logo a {
|
||||
font-family: Georgia, 'Times New Roman', Times, serif;
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
color: #007BFF;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.dashboard-nav a {
|
||||
margin-left: 24px;
|
||||
text-decoration: none;
|
||||
color: #6C757D;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.dashboard-nav a.active {
|
||||
color: #007BFF;
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
border: 1px solid #007BFF;
|
||||
padding: 8px 16px;
|
||||
border-radius: 4px;
|
||||
color: #007BFF;
|
||||
}
|
||||
|
||||
.logout-btn:hover {
|
||||
background-color: #007BFF;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.dashboard-main {
|
||||
padding: 32px;
|
||||
}
|
||||
|
||||
.dashboard-title {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.dashboard-title h1 {
|
||||
font-family: Georgia, 'Times New Roman', Times, serif;
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
|
||||
.date-range-picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border: 1px solid #DEE2E6;
|
||||
padding: 8px 12px;
|
||||
border-radius: 4px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.date-range-picker input {
|
||||
border: none;
|
||||
outline: none;
|
||||
font-size: 1rem;
|
||||
color: #6C757D;
|
||||
}
|
||||
|
||||
.date-range-picker svg {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.metrics-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
||||
gap: 24px;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.metric-card {
|
||||
background-color: #FFFFFF;
|
||||
padding: 24px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #DEE2E6;
|
||||
}
|
||||
|
||||
.metric-title {
|
||||
font-size: 1rem;
|
||||
color: #6C757D;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.metric-value {
|
||||
font-size: 2rem;
|
||||
font-weight: bold;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.metric-change {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.metric-change.positive {
|
||||
color: #28A745;
|
||||
}
|
||||
|
||||
.metric-change.negative {
|
||||
color: #DC3545;
|
||||
}
|
||||
|
||||
.chart-section {
|
||||
background-color: #FFFFFF;
|
||||
padding: 24px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #DEE2E6;
|
||||
}
|
||||
|
||||
.chart-title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.chart {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: flex-end;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.chart-bar-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.chart-bar {
|
||||
width: 70%;
|
||||
background: linear-gradient(to top, #007BFF, #0056b3);
|
||||
border-radius: 4px 4px 0 0;
|
||||
transition: height 0.5s ease-in-out;
|
||||
}
|
||||
|
||||
.chart-label {
|
||||
margin-top: 8px;
|
||||
font-size: 0.875rem;
|
||||
color: #6C757D;
|
||||
}
|
||||
62
assets/js/main.js
Normal file
62
assets/js/main.js
Normal file
@ -0,0 +1,62 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const inviteForm = document.getElementById('invite-form');
|
||||
if (inviteForm) {
|
||||
inviteForm.addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
const email = document.getElementById('email').value;
|
||||
const formData = new FormData();
|
||||
formData.append('email', email);
|
||||
|
||||
fetch('request_invite.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
showToast(data.message, data.success ? 'success' : 'error');
|
||||
if (data.success) {
|
||||
inviteForm.reset();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
showToast('An unexpected error occurred.', 'error');
|
||||
console.error('Error:', error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function showToast(message, type) {
|
||||
const toastContainer = document.getElementById('toast-container');
|
||||
if (!toastContainer) return;
|
||||
|
||||
const toast = document.createElement('div');
|
||||
toast.className = `toast align-items-center text-white bg-${type === 'success' ? 'success' : 'danger'} border-0 show`;
|
||||
toast.setAttribute('role', 'alert');
|
||||
toast.setAttribute('aria-live', 'assertive');
|
||||
toast.setAttribute('aria-atomic', 'true');
|
||||
|
||||
const toastBody = document.createElement('div');
|
||||
toastBody.className = 'd-flex';
|
||||
toastBody.innerHTML = `<div class="toast-body">${message}</div><button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>`;
|
||||
|
||||
toast.appendChild(toastBody);
|
||||
toastContainer.appendChild(toast);
|
||||
|
||||
const bsToast = new bootstrap.Toast(toast);
|
||||
bsToast.show();
|
||||
|
||||
setTimeout(() => {
|
||||
bsToast.hide();
|
||||
setTimeout(() => toast.remove(), 500);
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
anchor.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
document.querySelector(this.getAttribute('href')).scrollIntoView({
|
||||
behavior: 'smooth'
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
88
dashboard.php
Normal file
88
dashboard.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
// Dummy data for the dashboard
|
||||
$client_name = "Example Client";
|
||||
$data = [
|
||||
"sessions" => ["value" => "12,345", "change" => "+5.2%"],
|
||||
"conversions" => ["value" => "678", "change" => "+12.8%"],
|
||||
"ad_spend" => ["value" => "$2,456", "change" => "-3.1%"],
|
||||
"clicks" => ["value" => "34,567", "change" => "+8.4%"],
|
||||
"keyword_ranks" => ["value" => "5", "change" => "+2"],
|
||||
"backlinks" => ["value" => "1,234", "change" => "+50"],
|
||||
"site_audit_score" => ["value" => "88/100", "change" => "+3"],
|
||||
"calls" => ["value" => "98", "change" => "+15%"],
|
||||
];
|
||||
|
||||
// Dummy data for the main chart (e.g., sessions over time)
|
||||
$chart_data = [
|
||||
"labels" => ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
||||
"values" => [5000, 5500, 6200, 7100, 8000, 8500, 9200, 9800, 10500, 11200, 12000, 12345],
|
||||
];
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo htmlspecialchars($client_name); ?> - Marketing Dashboard</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Georgia:wght@700&family=Helvetica+Neue:wght@400&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/custom.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header class="dashboard-header">
|
||||
<div class="logo">
|
||||
<a href="index.php">AgencyMoguls</a>
|
||||
</div>
|
||||
<nav class="dashboard-nav">
|
||||
<a href="#overview" class="active">Overview</a>
|
||||
<a href="#reports">Reports</a>
|
||||
<a href="#settings">Settings</a>
|
||||
<a href="index.php" class="logout-btn">Logout</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="dashboard-main">
|
||||
<div class="dashboard-title">
|
||||
<h1><?php echo htmlspecialchars($client_name); ?>'s Dashboard</h1>
|
||||
<div class="date-range-picker">
|
||||
<input type="text" value="Last 30 Days">
|
||||
<svg width="14" height="8" viewBox="0 0 14 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L13 1" stroke="#6C757D" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="metrics-grid">
|
||||
<?php foreach ($data as $key => $metric): ?>
|
||||
<div class="metric-card">
|
||||
<h3 class="metric-title"><?php echo ucwords(str_replace("_", " ", $key)); ?></h3>
|
||||
<p class="metric-value"><?php echo htmlspecialchars($metric['value']); ?></p>
|
||||
<p class="metric-change <?php echo strpos($metric['change'], '+') !== false ? 'positive' : 'negative'; ?>">
|
||||
<?php echo htmlspecialchars($metric['change']); ?>
|
||||
</p>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</section>
|
||||
|
||||
<section class="chart-section">
|
||||
<div class="chart-container">
|
||||
<h2 class="chart-title">Sessions Over Time</h2>
|
||||
<!-- Simple bar chart using inline styles for dummy representation -->
|
||||
<div class="chart">
|
||||
<?php
|
||||
$max_value = max($chart_data['values']);
|
||||
foreach ($chart_data['values'] as $index => $value):
|
||||
$height_percentage = ($value / $max_value) * 100;
|
||||
?>
|
||||
<div class="chart-bar-wrapper">
|
||||
<div class="chart-bar" style="height: <?php echo $height_percentage; ?>%;"></div>
|
||||
<span class="chart-label"><?php echo $chart_data['labels'][$index]; ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
234
index.php
234
index.php
@ -1,150 +1,94 @@
|
||||
<?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>Agency Marketing Dashboard</title>
|
||||
<meta name="description" content="Built with Flatlogic Generator">
|
||||
<meta name="keywords" content="marketing reporting, client dashboard, seo reporting, ppc analytics, social media performance, automated reports, agency tools, keyword tracking, backlink monitoring, site audit, Built with Flatlogic Generator">
|
||||
<meta property="og:title" content="Agency Marketing Dashboard">
|
||||
<meta property="og:description" content="Built with Flatlogic Generator">
|
||||
<meta property="og:image" content="">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:image" content="">
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
||||
</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 class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="#">AgencyAnalytics</a>
|
||||
<div>
|
||||
<a href="dashboard.php" class="btn btn-secondary">View Dashboard</a>
|
||||
<a href="#invite-form-section" class="btn btn-primary">Request Invite</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<section class="hero">
|
||||
<div class="container">
|
||||
<h1>Automated Client Reporting for Marketing Agencies</h1>
|
||||
<p class="lead">Save time, track performance, and create custom, branded reports with ease.</p>
|
||||
<a href="#invite-form-section" class="btn btn-light btn-lg mt-3">Get Started</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="features text-center">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-4 mb-4">
|
||||
<i data-feather="bar-chart-2" class="feature-icon mb-3"></i>
|
||||
<h3>All-in-One Dashboards</h3>
|
||||
<p>Connect all your marketing channels and see your data in one place.</p>
|
||||
</div>
|
||||
<div class="col-md-4 mb-4">
|
||||
<i data-feather="file-text" class="feature-icon mb-3"></i>
|
||||
<h3>Automated Reports</h3>
|
||||
<p>Create beautiful, custom reports and schedule them to send automatically.</p>
|
||||
</div>
|
||||
<div class="col-md-4 mb-4">
|
||||
<i data-feather="briefcase" class="feature-icon mb-3"></i>
|
||||
<h3>Branded for Your Agency</h3>
|
||||
<p>White-label the platform with your own logo and branding.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="invite-form-section">
|
||||
<div class="container text-center">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<h2>Request an Invitation</h2>
|
||||
<p>Get exclusive access to the platform.</p>
|
||||
<form id="invite-form">
|
||||
<div class="input-group mb-3">
|
||||
<input type="email" id="email" class="form-control form-control-lg" placeholder="Enter your email" required>
|
||||
<button class="btn btn-primary" type="submit">Request Invite</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer class="text-center py-4">
|
||||
<div class="container">
|
||||
<p class="text-muted">© <?php echo date("Y"); ?> AgencyAnalytics. All rights reserved.</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<div id="toast-container" class="toast-container"></div>
|
||||
|
||||
<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>
|
||||
<script>
|
||||
feather.replace();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
30
request_invite.php
Normal file
30
request_invite.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/mail/MailService.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
echo json_encode(['success' => false, 'message' => 'Invalid request method.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
|
||||
|
||||
if (!$email) {
|
||||
echo json_encode(['success' => false, 'message' => 'Please provide a valid email address.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$to = getenv('MAIL_TO') ?: 'admin@example.com'; // Fallback email
|
||||
$subject = 'New Invite Request';
|
||||
$body = "A new invite request has been received from: {$email}";
|
||||
$name = 'Invite Request Form';
|
||||
|
||||
$result = MailService::sendContactMessage($name, $email, $body, $to, $subject);
|
||||
|
||||
if ($result['success']) {
|
||||
echo json_encode(['success' => true, 'message' => 'Thank you! Your invite request has been received.']);
|
||||
} else {
|
||||
error_log('MailService Error: ' . $result['error']);
|
||||
echo json_encode(['success' => false, 'message' => 'Sorry, there was an error sending your request. Please try again later.']);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user