This commit is contained in:
Flatlogic Bot 2025-10-07 23:52:17 +00:00
parent 2a73dd74aa
commit 82916fbf7a
12 changed files with 429 additions and 148 deletions

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

@ -0,0 +1,45 @@
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
background-color: #ecf0f1;
color: #34495e;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Georgia', serif;
}
.navbar {
background-color: #ffffff;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.hero {
background: linear-gradient(to right, #3498db, #2980b9);
color: white;
padding: 100px 0;
text-align: center;
}
.btn-primary {
background-color: #3498db;
border-color: #3498db;
}
.btn-secondary {
background-color: #2ecc71;
border-color: #2ecc71;
}
section {
padding: 60px 0;
}
.card {
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.form-control {
border-radius: 4px;
}

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

@ -0,0 +1,13 @@
document.addEventListener('DOMContentLoaded', function () {
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
});

19
dashboard.php Normal file
View File

@ -0,0 +1,19 @@
<?php
session_start();
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
require_once 'includes/header.php';
?>
<div class="container mt-5">
<h1>Welcome to your Dashboard</h1>
<p>You are logged in as a <strong><?php echo htmlspecialchars($_SESSION['user_role']); ?></strong>.</p>
<p>This is a placeholder for your dashboard content.</p>
<a href="logout.php">Logout</a>
</div>
<?php require_once 'includes/footer.php'; ?>

View File

@ -12,6 +12,22 @@ function db() {
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]);
run_migrations($pdo);
}
return $pdo;
}
function run_migrations($pdo) {
$pdo->exec("CREATE TABLE IF NOT EXISTS migrations (migration VARCHAR(255) PRIMARY KEY)");
$applied_migrations = $pdo->query("SELECT migration FROM migrations")->fetchAll(PDO::FETCH_COLUMN);
$migration_files = glob(__DIR__ . '/migrations/*.sql');
foreach ($migration_files as $file) {
$migration_name = basename($file);
if (!in_array($migration_name, $applied_migrations)) {
$sql = file_get_contents($file);
$pdo->exec($sql);
$pdo->prepare("INSERT INTO migrations (migration) VALUES (?)")->execute([$migration_name]);
}
}
}

View File

@ -0,0 +1,8 @@
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
role ENUM('donor', 'ngo', 'super_admin') NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

34
includes/footer.php Normal file
View File

@ -0,0 +1,34 @@
<footer class="bg-light text-center text-lg-start">
<div class="container p-4">
<div class="row">
<div class="col-lg-6 col-md-12 mb-4 mb-md-0">
<h5 class="text-uppercase">DonateConnect</h5>
<p>
Connecting donors with NGOs to make a difference, one donation at a time.
</p>
</div>
<div class="col-lg-3 col-md-6 mb-4 mb-md-0">
<h5 class="text-uppercase">Links</h5>
<ul class="list-unstyled mb-0">
<li>
<a href="privacy.php" class="text-dark">Privacy Policy</a>
</li>
<li>
<a href="index.php#contact" class="text-dark">Contact</a>
</li>
</ul>
</div>
</div>
</div>
<div class="text-center p-3" style="background-color: rgba(0, 0, 0, 0.2);">
© 2025 DonateConnect
</div>
</footer>
<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>

49
includes/header.php Normal file
View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DonateConnect</title>
<meta name="description" content="A mobile app that connects donors with nearby NGOs for donating food, clothes, and other essentials.">
<meta name="keywords" content="donation, charity, ngo, non-profit, philanthropy, giving, community, support, volunteer, social good, Built with Flatlogic Generator">
<meta property="og:title" content="DonateConnect">
<meta property="og:description" content="A mobile app that connects donors with nearby NGOs for donating food, clothes, and other essentials.">
<meta property="og:image" content="<?php echo $_SERVER['PROJECT_IMAGE_URL']; ?>">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="<?php echo $_SERVER['PROJECT_IMAGE_URL']; ?>">
<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>
<nav class="navbar navbar-expand-lg navbar-light sticky-top">
<div class="container">
<a class="navbar-brand" href="index.php">DonateConnect</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">
<li class="nav-item">
<a class="nav-link" href="index.php#about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php#how-it-works">How it Works</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php#testimonials">Testimonials</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php#contact">Contact</a>
</li>
<li class="nav-item">
<a class="btn btn-outline-primary ms-2" href="login.php">Login</a>
</li>
<li class="nav-item">
<a class="btn btn-primary ms-2" href="register.php">Register</a>
</li>
</ul>
</div>
</div>
</nav>

249
index.php
View File

@ -1,150 +1,103 @@
<?php
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
<?php require_once 'includes/header.php'; ?>
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!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>
</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>
<!-- Hero Section -->
<header class="hero text-white text-center">
<div class="container">
<h1 class="display-4">Connecting Generosity with Need</h1>
<p class="lead">A seamless way for donors to connect with NGOs and make a real impact.</p>
<a href="register.php" class="btn btn-primary btn-lg">Get Started</a>
<a href="#how-it-works" class="btn btn-secondary btn-lg">Learn More</a>
</div>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer>
</body>
</html>
</header>
<!-- About Section -->
<section id="about">
<div class="container">
<div class="row align-items-center">
<div class="col-md-6">
<h2>About DonateConnect</h2>
<p>We bridge the gap between those willing to give and organizations in need. Our platform simplifies the process of donating goods, ensuring that your contributions reach the right people efficiently.</p>
</div>
<div class="col-md-6">
<img src="https://picsum.photos/seed/donate2/800/600" class="img-fluid rounded" alt="A group of volunteers sorting donations.">
</div>
</div>
</div>
</section>
<!-- How it Works Section -->
<section id="how-it-works" class="bg-light">
<div class="container">
<h2 class="text-center mb-5">How It Works</h2>
<div class="row">
<div class="col-md-4 text-center">
<i data-feather="user-plus" width="48" height="48" class="text-primary"></i>
<h3>1. Register</h3>
<p>Create an account as a donor or an NGO.</p>
</div>
<div class="col-md-4 text-center">
<i data-feather="send" width="48" height="48" class="text-primary"></i>
<h3>2. Send/Receive Requests</h3>
<p>Donors can send donation requests, and NGOs can view and manage them.</p>
</div>
<div class="col-md-4 text-center">
<i data-feather="gift" width="48" height="48" class="text-primary"></i>
<h3>3. Make a Difference</h3>
<p>Your donations directly support communities in need.</p>
</div>
</div>
</div>
</section>
<!-- Testimonials Section -->
<section id="testimonials">
<div class="container">
<h2 class="text-center mb-5">What People Are Saying</h2>
<div class="row">
<div class="col-md-6">
<div class="card mb-4">
<div class="card-body">
<p class="card-text">"DonateConnect made it so easy to find a local charity that needed the exact items I had to give. The process was incredibly smooth."</p>
<footer class="blockquote-footer">Jane Doe, Donor</footer>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card mb-4">
<div class="card-body">
<p class="card-text">"As an NGO, managing donations used to be a logistical challenge. This platform has streamlined everything for us."</p>
<footer class="blockquote-footer">John Smith, NGO Coordinator</footer>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="bg-light">
<div class="container">
<h2 class="text-center mb-5">Contact Us</h2>
<div class="row">
<div class="col-md-8 mx-auto">
<form>
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" required>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email" required>
</div>
<div class="mb-3">
<label for="message" class="form-label">Message</label>
<textarea class="form-control" id="message" rows="5" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Send Message</button>
</form>
</div>
</div>
</div>
</section>
<?php require_once 'includes/footer.php'; ?>

55
login.php Normal file
View File

@ -0,0 +1,55 @@
<?php
session_start();
require_once 'db/config.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$email = $_POST['email'];
$password = $_POST['password'];
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM users WHERE email = ?");
$stmt->execute([$email]);
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password'])) {
$_SESSION['user_id'] = $user['id'];
$_SESSION['user_role'] = $user['role'];
header("Location: dashboard.php");
exit;
} else {
$error = "Invalid credentials";
}
}
require_once 'includes/header.php';
?>
<div class="container mt-5">
<div class="row">
<div class="col-md-6 mx-auto">
<div class="card">
<div class="card-header">
<h3>Login</h3>
</div>
<div class="card-body">
<?php if (isset($error)): ?>
<div class="alert alert-danger"><?php echo $error; ?></div>
<?php endif; ?>
<form action="login.php" method="POST">
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" name="email" class="form-control" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" name="password" class="form-control" required>
</div>
<button type="submit" class="btn btn-primary">Login</button>
</form>
</div>
</div>
</div>
</div>
</div>
<?php require_once 'includes/footer.php'; ?>

6
logout.php Normal file
View File

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

9
privacy.php Normal file
View File

@ -0,0 +1,9 @@
<?php include 'includes/header.php'; ?>
<div class="container mt-5">
<h1>Privacy Policy</h1>
<p>This is a placeholder for the privacy policy.</p>
</div>
<?php include 'includes/footer.php'; ?>

74
register.php Normal file
View File

@ -0,0 +1,74 @@
<?php
session_start();
require_once 'db/config.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$email = $_POST['email'];
$password = $_POST['password'];
$role = $_POST['role'];
// Validation
if (empty($email) || empty($password) || empty($role)) {
$error = "All fields are required";
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error = "Invalid email format";
} else {
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM users WHERE email = ?");
$stmt->execute([$email]);
if ($stmt->fetch()) {
$error = "Email already exists";
} else {
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
$stmt = $pdo->prepare("INSERT INTO users (email, password, role) VALUES (?, ?, ?)");
if ($stmt->execute([$email, $hashed_password, $role])) {
$_SESSION['user_id'] = $pdo->lastInsertId();
$_SESSION['user_role'] = $role;
header("Location: dashboard.php");
exit;
} else {
$error = "Registration failed";
}
}
}
}
require_once 'includes/header.php';
?>
<div class="container mt-5">
<div class="row">
<div class="col-md-6 mx-auto">
<div class="card">
<div class="card-header">
<h3>Register</h3>
</div>
<div class="card-body">
<?php if (isset($error)): ?>
<div class="alert alert-danger"><?php echo $error; ?></div>
<?php endif; ?>
<form action="register.php" method="POST">
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" name="email" class="form-control" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" name="password" class="form-control" required>
</div>
<div class="mb-3">
<label for="role" class="form-label">Register as:</label>
<select name="role" class="form-select">
<option value="donor">Donor</option>
<option value="ngo">NGO</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Register</button>
</form>
</div>
</div>
</div>
</div>
</div>
<?php require_once 'includes/footer.php'; ?>