202 lines
9.8 KiB
PHP
202 lines
9.8 KiB
PHP
<?php
|
|
session_start();
|
|
$content = json_decode(file_get_contents('content.json'), true);
|
|
?>
|
|
<!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($content['site_title']); ?></title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
|
|
<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=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link href="assets/css/dashboard.css?v=<?php echo time(); ?>" rel="stylesheet">
|
|
</head>
|
|
<body>
|
|
|
|
<nav class="navbar navbar-expand-lg navbar-light bg-white sticky-top shadow-sm">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="#">
|
|
<i class="bi bi-buildings"></i>
|
|
<?php echo htmlspecialchars($content['site_name']); ?>
|
|
</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav ms-auto align-items-center">
|
|
<li class="nav-item"><a class="nav-link nav-link-custom" href="#about">About</a></li>
|
|
<li class="nav-item"><a class="nav-link nav-link-custom" href="#features">Features</a></li>
|
|
<li class="nav-item"><a class="nav-link nav-link-custom" href="#contact">Contact</a></li>
|
|
<?php if (isset($_SESSION['user_id'])): ?>
|
|
<li class="nav-item"><a class="nav-link" href="dashboard.php">Dashboard</a></li>
|
|
<li class="nav-item"><a class="nav-link" href="logout.php">Logout</a></li>
|
|
<?php else: ?>
|
|
<li class="nav-item"><a class="btn btn-outline-secondary me-2" href="login.php">Login</a></li>
|
|
<li class="nav-item"><a class="btn btn-primary" href="register.php">Register</a></li>
|
|
<?php endif; ?>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<header class="hero-section">
|
|
<div class="container">
|
|
<h1><?php echo htmlspecialchars($content['hero_title']); ?></h1>
|
|
<p class="lead"><?php echo htmlspecialchars($content['hero_subtitle']); ?></p>
|
|
<?php if (!isset($_SESSION['user_id'])) : ?>
|
|
<a href="register.php" class="btn btn-light btn-lg">Get Started Today</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</header>
|
|
|
|
<main>
|
|
<section id="about" class="section">
|
|
<div class="container">
|
|
<div class="row align-items-center">
|
|
<div class="col-md-6">
|
|
<h2 class="section-title text-start"><?php echo htmlspecialchars($content['about_us_title']); ?></h2>
|
|
<p><?php echo htmlspecialchars($content['about_us_content_1']); ?></p>
|
|
<p><?php echo htmlspecialchars($content['about_us_content_2']); ?></p>
|
|
</div>
|
|
<div class="col-md-6 text-center">
|
|
<img src="assets/images/about-us.jpg" class="img-fluid rounded shadow" alt="About Us Image">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="features" class="section bg-light">
|
|
<div class="container">
|
|
<h2 class="section-title"><?php echo htmlspecialchars($content['features_title']); ?></h2>
|
|
<div class="row g-4">
|
|
<div class="col-md-4">
|
|
<div class="feature-card">
|
|
<i class="bi bi-graph-up-arrow feature-icon"></i>
|
|
<h3><?php echo htmlspecialchars($content['feature_1_title']); ?></h3>
|
|
<p><?php echo htmlspecialchars($content['feature_1_content']); ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="feature-card">
|
|
<i class="bi bi-people-fill feature-icon"></i>
|
|
<h3><?php echo htmlspecialchars($content['feature_2_title']); ?></h3>
|
|
<p><?php echo htmlspecialchars($content['feature_2_content']); ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="feature-card">
|
|
<i class="bi bi-headset feature-icon"></i>
|
|
<h3><?php echo htmlspecialchars($content['feature_3_title']); ?></h3>
|
|
<p><?php echo htmlspecialchars($content['feature_3_content']); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="contact" class="section">
|
|
<div class="container">
|
|
<h2 class="section-title"><?php echo htmlspecialchars($content['contact_us_title']); ?></h2>
|
|
<p class="lead mb-5"><?php echo htmlspecialchars($content['contact_us_content']); ?></p>
|
|
<div class="row justify-content-center">
|
|
<div class="col-lg-8">
|
|
<div class="alert alert-info" role="alert">
|
|
For testing purposes, emails will be sent to <strong><?php echo htmlspecialchars(getenv('MAIL_TO') ?: getenv('MAIL_FROM')); ?></strong>. You can ask me to change this for you.
|
|
</div>
|
|
<form action="submit_contact.php" method="POST">
|
|
<div class="mb-3">
|
|
<input type="text" class="form-control" name="name" placeholder="Your Name" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<input type="email" class="form-control" name="email" placeholder="Your Email" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<textarea class="form-control" name="message" rows="5" placeholder="Your Message" required></textarea>
|
|
</div>
|
|
<div class="text-center">
|
|
<button type="submit" class="btn btn-primary btn-lg">Send Message</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
|
|
<footer class="text-center p-4 bg-dark text-white">
|
|
<div class="container">
|
|
<p class="mb-0">© <?php echo date("Y"); ?> <?php echo htmlspecialchars($content['site_name']); ?>. All Rights Reserved.</p>
|
|
</div>
|
|
</footer>
|
|
|
|
<button class="chat-open-button" onclick="openChat()">
|
|
<i class="bi bi-chat-dots-fill"></i>
|
|
</button>
|
|
|
|
<div class="chat-popup" id="chatPopup">
|
|
<div class="chat-header">
|
|
<span>AI Assistant</span>
|
|
<button type="button" class="btn-close btn-close-white" aria-label="Close" onclick="closeChat()"></button>
|
|
</div>
|
|
<div class="chat-messages" id="chatMessages">
|
|
<div class="chat-message bot-message">Hi! How can I help you today?</div>
|
|
</div>
|
|
<div class="chat-input">
|
|
<input type="text" id="userInput" class="form-control" placeholder="Type a message..." onkeydown="if(event.keyCode == 13) sendMessage()">
|
|
<button class="btn btn-primary" onclick="sendMessage()"><i class="bi bi-send-fill"></i></button>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script>
|
|
function openChat() {
|
|
document.getElementById("chatPopup").style.display = "flex";
|
|
document.querySelector(".chat-open-button").style.display = "none";
|
|
}
|
|
|
|
function closeChat() {
|
|
document.getElementById("chatPopup").style.display = "none";
|
|
document.querySelector(".chat-open-button").style.display = "block";
|
|
}
|
|
|
|
function sendMessage() {
|
|
const userInput = document.getElementById("userInput");
|
|
const message = userInput.value;
|
|
if (message.trim() === "") return;
|
|
|
|
appendMessage(message, "user");
|
|
userInput.value = "";
|
|
|
|
fetch("ai_agent.php", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify({ message: message }),
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
appendMessage(data.reply, "bot");
|
|
})
|
|
.catch(error => {
|
|
console.error("Error:", error);
|
|
appendMessage("Sorry, something went wrong.", "bot");
|
|
});
|
|
}
|
|
|
|
function appendMessage(message, sender) {
|
|
const chatMessages = document.getElementById("chatMessages");
|
|
const messageElement = document.createElement("div");
|
|
messageElement.classList.add("chat-message", sender + "-message");
|
|
messageElement.innerText = message;
|
|
chatMessages.appendChild(messageElement);
|
|
chatMessages.scrollTop = chatMessages.scrollHeight;
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|