Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
219c23f94f | ||
|
|
34806aba52 | ||
|
|
7181333ac7 | ||
|
|
82916fbf7a |
45
assets/css/custom.css
Normal file
45
assets/css/custom.css
Normal 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
13
assets/js/main.js
Normal 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'
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
24
dashboard.php
Normal file
24
dashboard.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once 'includes/auth.php';
|
||||
check_login();
|
||||
|
||||
if (isset($_SESSION['user_role'])) {
|
||||
$role = $_SESSION['user_role'];
|
||||
if ($role == 'donor') {
|
||||
header("Location: donor_dashboard.php");
|
||||
exit;
|
||||
} elseif ($role == 'ngo') {
|
||||
header("Location: ngo_dashboard.php");
|
||||
exit;
|
||||
} else {
|
||||
// Fallback for other roles, e.g. super_admin
|
||||
// For now, just a simple message.
|
||||
echo "Welcome, you are logged in!";
|
||||
}
|
||||
} else {
|
||||
// Should not happen if check_login() is working correctly
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
8
db/migrations/001_create_users_table.sql
Normal file
8
db/migrations/001_create_users_table.sql
Normal 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
|
||||
);
|
||||
12
db/migrations/002_create_donor_profiles_table.sql
Normal file
12
db/migrations/002_create_donor_profiles_table.sql
Normal file
@ -0,0 +1,12 @@
|
||||
CREATE TABLE IF NOT EXISTS donor_profiles (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id INT NOT NULL,
|
||||
full_name VARCHAR(255) NOT NULL,
|
||||
phone VARCHAR(50),
|
||||
address TEXT,
|
||||
city VARCHAR(100),
|
||||
state VARCHAR(100),
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
);
|
||||
64
donor_dashboard.php
Normal file
64
donor_dashboard.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
require_once 'includes/auth.php';
|
||||
|
||||
// Ensure user is logged in and is a donor
|
||||
if (!is_logged_in() || $_SESSION['user_role'] !== 'donor') {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'db/config.php';
|
||||
$pdo = db();
|
||||
|
||||
$user_id = $_SESSION['user_id'];
|
||||
|
||||
// Fetch donor profile
|
||||
$stmt = $pdo->prepare("SELECT * FROM donor_profiles WHERE user_id = ?");
|
||||
$stmt->execute([$user_id]);
|
||||
$profile = $stmt->fetch();
|
||||
|
||||
$pageTitle = 'Donor Dashboard';
|
||||
include 'includes/header.php';
|
||||
?>
|
||||
|
||||
<div class="container mt-5">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1>Welcome, <?php echo isset($profile['full_name']) ? htmlspecialchars(explode(' ', $profile['full_name'])[0]) : 'Donor'; ?>!</h1>
|
||||
</div>
|
||||
|
||||
<?php if ($profile): ?>
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h4>My Profile</h4>
|
||||
<a href="donor_profile.php" class="btn btn-sm btn-outline-secondary">Edit Profile</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><?php echo htmlspecialchars($profile['full_name']); ?></h5>
|
||||
<p class="card-text">
|
||||
<strong>Email:</strong> <?php echo htmlspecialchars($_SESSION['user_email']); ?><br>
|
||||
<strong>Phone:</strong> <?php echo htmlspecialchars($profile['phone'] ?: 'N/A'); ?><br>
|
||||
<strong>Address:</strong> <?php echo htmlspecialchars($profile['address'] ?: 'N/A'); ?><br>
|
||||
<strong>City:</strong> <?php echo htmlspecialchars($profile['city'] ?: 'N/A'); ?><br>
|
||||
<strong>State:</strong> <?php echo htmlspecialchars($profile['state'] ?: 'N/A'); ?><br>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<h3>Start a New Donation</h3>
|
||||
<p>Ready to make a difference? Click the button below to start a new donation request.</p>
|
||||
<a href="donation_request.php" class="btn btn-primary">New Donation Request</a>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
<div class="alert alert-info" role="alert">
|
||||
<h4 class="alert-heading">Complete Your Profile</h4>
|
||||
<p>Welcome to DonateConnect! To start making donations, please complete your profile with your contact information.</p>
|
||||
<hr>
|
||||
<a href="donor_profile.php" class="btn btn-primary">Create My Profile</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
96
donor_profile.php
Normal file
96
donor_profile.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
require_once 'includes/auth.php';
|
||||
|
||||
// Only donors can access this page
|
||||
if (!is_logged_in() || $_SESSION['user_role'] !== 'donor') {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'db/config.php';
|
||||
$pdo = db();
|
||||
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$profile = null;
|
||||
$message = '';
|
||||
|
||||
// Check if profile exists
|
||||
$stmt = $pdo->prepare("SELECT * FROM donor_profiles WHERE user_id = ?");
|
||||
$stmt->execute([$user_id]);
|
||||
$profile = $stmt->fetch();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$full_name = trim($_POST['full_name'] ?? '');
|
||||
$phone = trim($_POST['phone'] ?? '');
|
||||
$address = trim($_POST['address'] ?? '');
|
||||
$city = trim($_POST['city'] ?? '');
|
||||
$state = trim($_POST['state'] ?? '');
|
||||
|
||||
if (empty($full_name)) {
|
||||
$message = '<div class="alert alert-danger">Full name is required.</div>';
|
||||
} else {
|
||||
if ($profile) {
|
||||
// Update existing profile
|
||||
$stmt = $pdo->prepare("UPDATE donor_profiles SET full_name = ?, phone = ?, address = ?, city = ?, state = ? WHERE user_id = ?");
|
||||
$stmt->execute([$full_name, $phone, $address, $city, $state, $user_id]);
|
||||
$message = '<div class="alert alert-success">Profile updated successfully!</div>';
|
||||
} else {
|
||||
// Create new profile
|
||||
$stmt = $pdo->prepare("INSERT INTO donor_profiles (user_id, full_name, phone, address, city, state) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$user_id, $full_name, $phone, $address, $city, $state]);
|
||||
$message = '<div class="alert alert-success">Profile created successfully!</div>';
|
||||
}
|
||||
// Refresh profile data after insert/update
|
||||
$stmt = $pdo->prepare("SELECT * FROM donor_profiles WHERE user_id = ?");
|
||||
$stmt->execute([$user_id]);
|
||||
$profile = $stmt->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
$pageTitle = 'My Profile';
|
||||
include 'includes/header.php';
|
||||
?>
|
||||
|
||||
<div class="container mt-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>My Profile</h2>
|
||||
<p>Manage your personal information.</p>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php echo $message; ?>
|
||||
<form action="donor_profile.php" method="POST">
|
||||
<div class="mb-3">
|
||||
<label for="full_name" class="form-label">Full Name</label>
|
||||
<input type="text" class="form-control" id="full_name" name="full_name" value="<?php echo htmlspecialchars($profile['full_name'] ?? ''); ?>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="phone" class="form-label">Phone Number</label>
|
||||
<input type="tel" class="form-control" id="phone" name="phone" value="<?php echo htmlspecialchars($profile['phone'] ?? ''); ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="address" class="form-label">Address</label>
|
||||
<textarea class="form-control" id="address" name="address" rows="3"><?php echo htmlspecialchars($profile['address'] ?? ''); ?></textarea>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="city" class="form-label">City</label>
|
||||
<input type="text" class="form-control" id="city" name="city" value="<?php echo htmlspecialchars($profile['city'] ?? ''); ?>">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="state" class="form-label">State</label>
|
||||
<input type="text" class="form-control" id="state" name="state" value="<?php echo htmlspecialchars($profile['state'] ?? ''); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary"><?php echo $profile ? 'Update Profile' : 'Save Profile'; ?></button>
|
||||
<a href="donor_dashboard.php" class="btn btn-secondary">Back to Dashboard</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
17
includes/auth.php
Normal file
17
includes/auth.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
function check_login() {
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
function check_role($role) {
|
||||
if ($_SESSION['user_role'] !== $role) {
|
||||
// Redirect to their own dashboard if they try to access another role's page
|
||||
$dashboard = $_SESSION['user_role'] . '_dashboard.php';
|
||||
header("Location: $dashboard");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
34
includes/footer.php
Normal file
34
includes/footer.php
Normal 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>
|
||||
65
includes/header.php
Normal file
65
includes/header.php
Normal file
@ -0,0 +1,65 @@
|
||||
<!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>
|
||||
<?php if (isset($_SESSION['user_id'])): ?>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
My Account
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
<li><a class="dropdown-item" href="<?php echo $_SESSION['user_role']; ?>_dashboard.php">Dashboard</a></li>
|
||||
<?php if ($_SESSION['user_role'] === 'donor'): ?>
|
||||
<li><a class="dropdown-item" href="donor_profile.php">My Profile</a></li>
|
||||
<?php endif; ?>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<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>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
249
index.php
249
index.php
@ -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'; ?>
|
||||
61
login.php
Normal file
61
login.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?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'];
|
||||
if ($user['role'] == 'donor') {
|
||||
header("Location: donor_dashboard.php");
|
||||
} elseif ($user['role'] == 'ngo') {
|
||||
header("Location: ngo_dashboard.php");
|
||||
} else {
|
||||
header("Location: dashboard.php"); // Fallback for other roles
|
||||
}
|
||||
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
6
logout.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
session_unset();
|
||||
session_destroy();
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
85
ngo_dashboard.php
Normal file
85
ngo_dashboard.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once 'includes/auth.php';
|
||||
check_login();
|
||||
check_role('ngo');
|
||||
|
||||
require_once 'includes/header.php';
|
||||
?>
|
||||
|
||||
<div class="container mt-5">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1>NGO Dashboard</h1>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-4">
|
||||
<div class="card text-white bg-primary">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">New Donation Requests</h5>
|
||||
<p class="card-text fs-4">3</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card text-white bg-success">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Completed Donations</h5>
|
||||
<p class="card-text fs-4">12</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card text-white bg-info">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Active Donors</h5>
|
||||
<p class="card-text fs-4">5</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4>Incoming Donation Requests</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Donor Name</th>
|
||||
<th>Donation Type</th>
|
||||
<th>Date Received</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>John Smith</td>
|
||||
<td>Canned Goods</td>
|
||||
<td>2025-10-07</td>
|
||||
<td><span class="badge bg-warning text-dark">Pending</span></td>
|
||||
<td><a href="#" class="btn btn-sm btn-outline-primary">View Details</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Jane Doe</td>
|
||||
<td>Clothing</td>
|
||||
<td>2025-10-06</td>
|
||||
<td><span class="badge bg-warning text-dark">Pending</span></td>
|
||||
<td><a href="#" class="btn btn-sm btn-outline-primary">View Details</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Peter Jones</td>
|
||||
<td>Books</td>
|
||||
<td>2025-10-05</td>
|
||||
<td><span class="badge bg-success">Completed</span></td>
|
||||
<td><a href="#" class="btn btn-sm btn-outline-secondary disabled">View Details</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once 'includes/footer.php'; ?>
|
||||
9
privacy.php
Normal file
9
privacy.php
Normal 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'; ?>
|
||||
80
register.php
Normal file
80
register.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?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;
|
||||
if ($role == 'donor') {
|
||||
header("Location: donor_dashboard.php");
|
||||
} elseif ($role == 'ngo') {
|
||||
header("Location: ngo_dashboard.php");
|
||||
} else {
|
||||
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'; ?>
|
||||
Loading…
x
Reference in New Issue
Block a user