This commit is contained in:
Flatlogic Bot 2025-12-10 20:22:37 +00:00
parent 16ee483003
commit de6425d950
6 changed files with 642 additions and 143 deletions

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

@ -0,0 +1,176 @@
/*
Global Styles
*/
body {
font-family: 'Lato', sans-serif;
color: #2c3e50; /* Midnight Blue */
background-color: #ecf0f1; /* Light Gray */
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
font-family: 'Montserrat', sans-serif;
font-weight: 700;
}
.page-section {
padding: 6rem 0;
}
.divider {
height: 0.2rem;
max-width: 3.25rem;
margin: 1.5rem auto;
background-color: #18bc9c; /* Turquoise */
opacity: 1;
}
.btn-xl {
padding: 1.25rem 2.25rem;
font-size: 0.85rem;
font-weight: 700;
text-transform: uppercase;
border: none;
border-radius: 10rem;
}
/* Navigation */
#mainNav {
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
background-color: #fff;
transition: background-color 0.2s ease;
}
#mainNav .navbar-brand {
font-family: 'Montserrat', sans-serif;
font-weight: 700;
color: #2c3e50;
}
#mainNav .nav-link {
color: #2c3e50;
font-weight: 700;
padding: 0.75rem 1rem;
letter-spacing: 0.05em;
}
#mainNav .nav-link:hover, #mainNav .nav-link.active {
color: #18bc9c;
}
/* Hero Section */
.hero-section {
padding: 10rem 0;
background-color: #2c3e50; /* Midnight Blue */
background-image: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
color: white;
position: relative;
}
.hero-heading {
font-size: 2.8rem;
font-weight: 700;
}
.hero-subheading {
font-size: 1.25rem;
font-weight: 300;
max-width: 700px;
}
.btn-accent {
background-color: #18bc9c; /* Turquoise */
color: white;
border-radius: 0.25rem;
transition: all 0.3s ease;
}
.btn-accent:hover {
background-color: #15a589;
color: white;
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
/* Why Us Section */
#why-us .fs-1 {
color: #2c3e50 !important;
}
/* Offers Section */
.card {
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.1) !important;
}
.card-featured {
border: 2px solid #18bc9c;
}
/* Products Section */
.product-placeholder {
background-color: #fff;
border: 1px dashed #bdc3c7;
color: #7f8c8d;
display: flex;
align-items: center;
justify-content: center;
height: 150px;
border-radius: 0.5rem;
font-weight: 500;
font-family: 'Montserrat', sans-serif;
}
/* FAQ Section */
.accordion-item {
background-color: #fff;
border: 0;
border-radius: 0.5rem;
margin-bottom: 1rem;
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}
.accordion-button {
border-radius: 0.5rem;
font-weight: 500;
font-family: 'Montserrat', sans-serif;
}
.accordion-button:not(.collapsed) {
color: #18bc9c;
background-color: #ecf0f1;
box-shadow: none;
}
.accordion-button:focus {
box-shadow: 0 0 0 0.25rem rgba(24, 188, 156, 0.25);
}
/* Contact Section */
#contact .form-control {
border-radius: 0.25rem;
}
#contact .form-control:focus {
border-color: #18bc9c;
box-shadow: 0 0 0 0.25rem rgba(24, 188, 156, 0.25);
}
.btn-primary {
background-color: #2c3e50;
border-color: #2c3e50;
border-radius: 0.25rem;
}
.btn-primary:hover {
background-color: #1a252f;
border-color: #1a252f;
}
/* Footer */
footer.bg-light {
background-color: #ffffff !important;
border-top: 1px solid #e9ecef;
}

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

@ -0,0 +1,54 @@
/*!
* Start Bootstrap - Agency v7.0.11 (https://startbootstrap.com/theme/agency)
* Copyright 2013-2022 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-agency/blob/master/LICENSE)
*/
//
// Scripts
//
window.addEventListener('DOMContentLoaded', event => {
// Navbar shrink function
var navbarShrink = function () {
const navbarCollapsible = document.body.querySelector('#mainNav');
if (!navbarCollapsible) {
return;
}
if (window.scrollY === 0) {
navbarCollapsible.classList.remove('navbar-shrink')
} else {
navbarCollapsible.classList.add('navbar-shrink')
}
};
// Shrink the navbar
navbarShrink();
// Shrink the navbar when page is scrolled
document.addEventListener('scroll', navbarShrink);
// Activate Bootstrap scrollspy on the main nav element
const mainNav = document.body.querySelector('#mainNav');
if (mainNav) {
new bootstrap.ScrollSpy(document.body, {
target: '#mainNav',
offset: 74,
});
};
// Collapse responsive navbar when toggler is visible
const navbarToggler = document.body.querySelector('.navbar-toggler');
const responsiveNavItems = [].slice.call(
document.querySelectorAll('#navbarResponsive .nav-link')
);
responsiveNavItems.map(function (responsiveNavItem) {
responsiveNavItem.addEventListener('click', () => {
if (window.getComputedStyle(navbarToggler).display !== 'none') {
navbarToggler.click();
}
});
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

433
index.php
View File

@ -1,150 +1,297 @@
<?php
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
session_start();
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
// Check if the user is logged in, otherwise redirect to login page
if (!isset($_SESSION["user_id"])) {
header("location: login.php");
exit;
}
require_once __DIR__ . '/mail/MailService.php';
$message_sent = false;
$error_message = '';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = strip_tags(trim($_POST["name"]));
$email = filter_var(trim($_POST["email"])), FILTER_SANITIZE_EMAIL);
$message = strip_tags(trim($_POST["message"]));
if (empty($name) || empty($message) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error_message = "Please fill out all fields and provide a valid email address.";
} else {
$to = getenv('MAIL_TO') ?: 'admin@example.com'; // Fallback for local testing
$subject = "New Contact Form Submission from " . $name;
$email_body = "Name: {$name}<br>";
$email_body .= "Email: {$email}<br><br>";
$email_body .= "Message:<br>{$message}";
$text_body = "Name: {$name}\n";
$text_body .= "Email: {$email}\n\n";
$text_body .= "Message:\n{$message}";
$result = MailService::sendMail($to, $subject, $email_body, $text_body, ['reply_to' => $email]);
if (!empty($result['success'])) {
$message_sent = true;
} else {
$error_message = "Sorry, there was an error sending your message. Please try again later.";
// error_log("MailService Error: " . ($result['error'] ?? 'Unknown error'));
}
}
}
?>
<!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><?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'Packaging Solutions'); ?></title>
<meta name="description" content="<?php echo htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'Custom packaging for your business.'); ?>">
<!-- Google Fonts -->
<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=Montserrat:wght@400;500;700&family=Lato:wght@400;700&display=swap" rel="stylesheet">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</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>
<body data-bs-spy="scroll" data-bs-target="#mainNav" data-bs-offset="80">
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top" id="mainNav">
<div class="container">
<a class="navbar-brand" href="#"><img src="assets/pasted-20251210-201942-d2c32489.jpg" alt="<?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'PackagingCo'); ?> Logo" style="height: 40px;"></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a class="nav-link" href="#why-us">Why Us</a></li>
<li class="nav-item"><a class="nav-link" href="#offers">Offers</a></li>
<li class="nav-item"><a class="nav-link" href="#products">Products</a></li>
<li class="nav-item"><a class="nav-link" href="#faq">FAQ</a></li>
<li class="nav-item"><a class="nav-link" href="#contact">Contact</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Welcome, <?php echo htmlspecialchars($_SESSION['username']); ?>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- Hero Section -->
<header class="hero-section text-white text-center">
<div class="container d-flex align-items-center flex-column">
<h1 class="hero-heading mb-3">Innovative Packaging, Perfectly Crafted</h1>
<p class="hero-subheading mb-4">From concept to creation, we deliver custom packaging solutions that protect your products and elevate your brand.</p>
<a href="#contact" class="btn btn-accent btn-lg">Request a Free Quote</a>
</div>
</header>
<!-- Why Us Section -->
<section id="why-us" class="page-section">
<div class="container">
<h2 class="text-center mt-0">Why Choose Us?</h2>
<hr class="divider">
<div class="row">
<div class="col-lg-3 col-md-6 text-center">
<div class="mt-5">
<div class="mb-2"><i class="bi-gem fs-1 text-primary"></i></div>
<h3 class="h4 mb-2">Dynamic Design</h3>
<p class="text-muted mb-0">Use our tools to design your vision or work with our team for something unique.</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="mt-5">
<div class="mb-2"><i class="bi-rulers fs-1 text-primary"></i></div>
<h3 class="h4 mb-2">Precision Engineering</h3>
<p class="text-muted mb-0">Every fold, cut, and print is managed with state-of-the-art precision.</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="mt-5">
<div class="mb-2"><i class="bi-truck fs-1 text-primary"></i></div>
<h3 class="h4 mb-2">Reliable Delivery</h3>
<p class="text-muted mb-0">Instant lead times and transparent tracking, from our factory to your door.</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="mt-5">
<div class="mb-2"><i class="bi-headset fs-1 text-primary"></i></div>
<h3 class="h4 mb-2">Dedicated Support</h3>
<p class="text-muted mb-0">Our sales and support teams are here to ensure your success.</p>
</div>
</div>
</div>
</div>
</section>
<!-- Offers Section -->
<section id="offers" class="page-section bg-light">
<div class="container">
<h2 class="text-center">Our Partnership Offers</h2>
<hr class="divider">
<p class="text-center text-muted mb-5">We also build websites for companies, with unique partnership models.</p>
<div class="row justify-content-center">
<div class="col-lg-4 mb-4">
<div class="card h-100 shadow border-0">
<div class="card-body p-4">
<h5 class="card-title text-center fw-bold">Option A: Freemium</h5>
<hr>
<p class="card-text text-center">50% de économies et 50% des bénéfices sur le chiffre d'affaire qui vient de notre réseau.</p>
</div>
</div>
</div>
<div class="col-lg-4 mb-4">
<div class="card h-100 shadow border-0 card-featured">
<div class="card-body p-4">
<h5 class="card-title text-center fw-bold">Option B: Performance</h5>
<hr>
<p class="card-text text-center">Dépenses=X, prix de l'abonnement 0,5% de X + variable sur la performance commerciale 40% sur le bénéfice généré.</p>
</div>
</div>
</div>
<div class="col-lg-4 mb-4">
<div class="card h-100 shadow border-0">
<div class="card-body p-4">
<h5 class="card-title text-center fw-bold">Option C: Subscription</h5>
<hr>
<p class="card-text text-center">1,2% de X + variable sur la performance 30% sur le bénéfice généré.</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Products Section -->
<section id="products" class="page-section">
<div class="container">
<h2 class="text-center">Our Products</h2>
<hr class="divider">
<p class="text-center text-muted">A glimpse into the customizable packaging solutions we offer. The full interactive catalog is coming soon.</p>
<div class="row g-4 mt-4">
<div class="col-md-3"><div class="product-placeholder">Carton</div></div>
<div class="col-md-3"><div class="product-placeholder">Plastique</div></div>
<div class="col-md-3"><div class="product-placeholder">Print sur Carton</div></div>
<div class="col-md-3"><div class="product-placeholder">Étiquette</div></div>
</div>
</div>
</section>
<!-- FAQ Section -->
<section id="faq" class="page-section bg-light">
<div class="container">
<h2 class="text-center">Frequently Asked Questions</h2>
<hr class="divider">
<div class="accordion accordion-flush" id="faqAccordion">
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingOne">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseOne" aria-expanded="false" aria-controls="flush-collapseOne">
What is the minimum order quantity?
</button>
</h2>
<div id="flush-collapseOne" class="accordion-collapse collapse" aria-labelledby="flush-headingOne" data-bs-parent="#faqAccordion">
<div class="accordion-body text-muted">Our minimum order quantity varies depending on the product complexity and material. Please contact us for a specific quote.</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingTwo">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseTwo" aria-expanded="false" aria-controls="flush-collapseTwo">
Can I upload my own artwork?
</button>
</h2>
<div id="flush-collapseTwo" class="accordion-collapse collapse" aria-labelledby="flush-headingTwo" data-bs-parent="#faqAccordion">
<div class="accordion-body text-muted">Yes! Our upcoming online design tool will allow you to upload artwork, position it on a 3D mockup, and see a live preview before you order.</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingThree">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseThree" aria-expanded="false" aria-controls="flush-collapseThree">
What are the lead times?
</button>
</h2>
<div id="flush-collapseThree" class="accordion-collapse collapse" aria-labelledby="flush-headingThree" data-bs-parent="#faqAccordion">
<div class="accordion-body text-muted">Lead times are calculated instantly based on your design, materials, and quantity. You will see an estimated delivery date before you finalize your order.</div>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="page-section">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8 text-center">
<h2 class="mt-0">Let's Get In Touch!</h2>
<hr class="divider">
<p class="text-muted mb-5">Ready to start your next project with us? Send us a messages and we will get back to you as soon as possible!</p>
</div>
</div>
<div class="row gx-5 justify-content-center">
<div class="col-lg-6">
<?php if ($message_sent): ?>
<div class="alert alert-success text-center" role="alert">
Thank you! Your message has been sent successfully.
</div>
<?php endif; ?>
<?php if ($error_message): ?>
<div class="alert alert-danger text-center" role="alert">
<?php echo htmlspecialchars($error_message); ?>
</div>
<?php endif; ?>
<form id="contactForm" method="POST" action="index.php#contact">
<!-- Name input-->
<div class="form-floating mb-3">
<input class="form-control" id="name" name="name" type="text" placeholder="Enter your name..." required />
<label for="name">Full name</label>
</div>
<!-- Email address input-->
<div class="form-floating mb-3">
<input class="form-control" id="email" name="email" type="email" placeholder="name@example.com" required />
<label for="email">Email address</label>
</div>
<!-- Message input-->
<div class="form-floating mb-3">
<textarea class="form-control" id="message" name="message" type="text" placeholder="Enter your message here..." style="height: 10rem" required></textarea>
<label for="message">Message</label>
</div>
<!-- Submit Button-->
<div class="d-grid">
<button class="btn btn-primary btn-xl" id="submitButton" type="submit">Nous contactez</button>
</div>
</form>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="bg-light py-5">
<div class="container">
<div class="small text-center text-muted">Copyright &copy; <?php echo date("Y"); ?> - <?php echo htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'PackagingCo'); ?></div>
</div>
</footer>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<!-- Custom JS-->
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>
</html>

116
login.php Normal file
View File

@ -0,0 +1,116 @@
<?php
session_start();
require_once 'db/config.php';
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'] ?? '';
$password = $_POST['password'] ?? '';
if (empty($username) || empty($password)) {
$error = 'Please enter both username and password.';
} else {
try {
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?");
$stmt->execute([$username]);
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password_hash'])) {
$_SESSION['user_id'] = $user['id'];
$_SESSION['username'] = $user['username'];
$_SESSION['role'] = $user['role'];
header("Location: index.php");
exit;
} else {
$error = 'Invalid username or password.';
}
} catch (PDOException $e) {
$error = "Database error: " . $e->getMessage();
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&family=Lato:wght@400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #ecf0f1;
}
.login-container {
background-color: #ffffff;
padding: 2rem;
border-radius: 0.5rem;
box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1);
width: 100%;
max-width: 400px;
}
.login-container h2 {
text-align: center;
margin-bottom: 1.5rem;
color: #2c3e50;
}
.form-group {
margin-bottom: 1rem;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
}
.form-group input {
width: 100%;
padding: 0.75rem;
border: 1px solid #ced4da;
border-radius: 0.25rem;
}
.btn-submit {
width: 100%;
padding: 0.75rem;
background-color: #18bc9c;
color: white;
border: none;
border-radius: 0.25rem;
cursor: pointer;
font-size: 1rem;
}
.btn-submit:hover {
background-color: #15a589;
}
.error-message {
color: #e74c3c;
margin-top: 1rem;
text-align: center;
}
</style>
</head>
<body>
<div class="login-container">
<h2>Login</h2>
<form action="login.php" method="POST">
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" required>
</div>
<button type="submit" class="btn-submit">Login</button>
<?php if ($error): ?>
<p class="error-message"><?php echo htmlspecialchars($error); ?></p>
<?php endif; ?>
</form>
</div>
</body>
</html>

6
logout.php Normal file
View File

@ -0,0 +1,6 @@
<?php
session_start();
session_unset();
session_destroy();
header("Location: login.php");
exit;