From 82916fbf7ace512df55d759cd779bc7c78134e75 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Tue, 7 Oct 2025 23:52:17 +0000 Subject: [PATCH] version1 --- assets/css/custom.css | 45 ++++ assets/js/main.js | 13 ++ dashboard.php | 19 ++ db/config.php | 16 ++ db/migrations/001_create_users_table.sql | 8 + includes/footer.php | 34 ++++ includes/header.php | 49 +++++ index.php | 249 +++++++++-------------- login.php | 55 +++++ logout.php | 6 + privacy.php | 9 + register.php | 74 +++++++ 12 files changed, 429 insertions(+), 148 deletions(-) create mode 100644 assets/css/custom.css create mode 100644 assets/js/main.js create mode 100644 dashboard.php create mode 100644 db/migrations/001_create_users_table.sql create mode 100644 includes/footer.php create mode 100644 includes/header.php create mode 100644 login.php create mode 100644 logout.php create mode 100644 privacy.php create mode 100644 register.php diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..28ef2cb --- /dev/null +++ b/assets/css/custom.css @@ -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; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..fa36c56 --- /dev/null +++ b/assets/js/main.js @@ -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' + }); + }); + }); +}); diff --git a/dashboard.php b/dashboard.php new file mode 100644 index 0000000..15b0fe6 --- /dev/null +++ b/dashboard.php @@ -0,0 +1,19 @@ + + +
+

Welcome to your Dashboard

+

You are logged in as a .

+

This is a placeholder for your dashboard content.

+ Logout +
+ + diff --git a/db/config.php b/db/config.php index bb98f7d..8dd7cc3 100644 --- a/db/config.php +++ b/db/config.php @@ -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]); + } + } +} diff --git a/db/migrations/001_create_users_table.sql b/db/migrations/001_create_users_table.sql new file mode 100644 index 0000000..9166944 --- /dev/null +++ b/db/migrations/001_create_users_table.sql @@ -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 +); diff --git a/includes/footer.php b/includes/footer.php new file mode 100644 index 0000000..614663b --- /dev/null +++ b/includes/footer.php @@ -0,0 +1,34 @@ + + + + + + + diff --git a/includes/header.php b/includes/header.php new file mode 100644 index 0000000..3bdd8ca --- /dev/null +++ b/includes/header.php @@ -0,0 +1,49 @@ + + + + + + DonateConnect + + + + + + + + + + + + + + diff --git a/index.php b/index.php index 7205f3d..b576d1c 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,103 @@ - -$phpVersion = PHP_VERSION; -$now = date('Y-m-d H:i:s'); -?> - - - - - - New Style - - - - - - - - - - - - - - - - - - - - - -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

+ +
+
+

Connecting Generosity with Need

+

A seamless way for donors to connect with NGOs and make a real impact.

+ Get Started + Learn More
-
- - - + + + +
+
+
+
+

About DonateConnect

+

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.

+
+
+ A group of volunteers sorting donations. +
+
+
+
+ + +
+
+

How It Works

+
+
+ +

1. Register

+

Create an account as a donor or an NGO.

+
+
+ +

2. Send/Receive Requests

+

Donors can send donation requests, and NGOs can view and manage them.

+
+
+ +

3. Make a Difference

+

Your donations directly support communities in need.

+
+
+
+
+ + +
+
+

What People Are Saying

+
+
+
+
+

"DonateConnect made it so easy to find a local charity that needed the exact items I had to give. The process was incredibly smooth."

+
Jane Doe, Donor
+
+
+
+
+
+
+

"As an NGO, managing donations used to be a logistical challenge. This platform has streamlined everything for us."

+
John Smith, NGO Coordinator
+
+
+
+
+
+
+ + +
+
+

Contact Us

+
+
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+
+ + \ No newline at end of file diff --git a/login.php b/login.php new file mode 100644 index 0000000..f507b2a --- /dev/null +++ b/login.php @@ -0,0 +1,55 @@ +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'; +?> + +
+
+
+
+
+

Login

+
+
+ +
+ +
+
+ + +
+
+ + +
+ +
+
+
+
+
+
+ + diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..766a593 --- /dev/null +++ b/logout.php @@ -0,0 +1,6 @@ + + +
+

Privacy Policy

+

This is a placeholder for the privacy policy.

+
+ + diff --git a/register.php b/register.php new file mode 100644 index 0000000..35740f3 --- /dev/null +++ b/register.php @@ -0,0 +1,74 @@ +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'; +?> + +
+
+
+
+
+

Register

+
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+
+
+ +