diff --git a/dashboard.php b/dashboard.php index 15b0fe6..ab429d0 100644 --- a/dashboard.php +++ b/dashboard.php @@ -1,19 +1,24 @@ - -
-

Welcome to your Dashboard

-

You are logged in as a .

-

This is a placeholder for your dashboard content.

- Logout -
- - +?> \ No newline at end of file diff --git a/donor_dashboard.php b/donor_dashboard.php new file mode 100644 index 0000000..096f1bb --- /dev/null +++ b/donor_dashboard.php @@ -0,0 +1,16 @@ + + +
+

Welcome, Donor!

+

This is your dashboard. Here you can manage your profile and donations.

+ Logout +
+ + diff --git a/includes/auth.php b/includes/auth.php new file mode 100644 index 0000000..6c350b6 --- /dev/null +++ b/includes/auth.php @@ -0,0 +1,17 @@ + diff --git a/includes/header.php b/includes/header.php index 3bdd8ca..ef4f828 100644 --- a/includes/header.php +++ b/includes/header.php @@ -37,12 +37,21 @@ - - + + + + + + + diff --git a/login.php b/login.php index f507b2a..7c5cc8c 100644 --- a/login.php +++ b/login.php @@ -14,7 +14,13 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($user && password_verify($password, $user['password'])) { $_SESSION['user_id'] = $user['id']; $_SESSION['user_role'] = $user['role']; - header("Location: dashboard.php"); + 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"; diff --git a/logout.php b/logout.php index 766a593..f83284d 100644 --- a/logout.php +++ b/logout.php @@ -2,5 +2,5 @@ session_start(); session_unset(); session_destroy(); -header("Location: login.php"); +header("Location: index.php"); exit; diff --git a/ngo_dashboard.php b/ngo_dashboard.php new file mode 100644 index 0000000..8834a4d --- /dev/null +++ b/ngo_dashboard.php @@ -0,0 +1,16 @@ + + +
+

Welcome, NGO!

+

This is your dashboard. Here you can manage your profile and view donation requests.

+ Logout +
+ + diff --git a/register.php b/register.php index 35740f3..9f3a67b 100644 --- a/register.php +++ b/register.php @@ -24,7 +24,13 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($stmt->execute([$email, $hashed_password, $role])) { $_SESSION['user_id'] = $pdo->lastInsertId(); $_SESSION['user_role'] = $role; - header("Location: dashboard.php"); + 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";