From 9f1906c4cbb9878c5888723b7923fa8e4bebb51f Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 27 Apr 2025 21:12:02 +0500 Subject: feat: roles --- public/users.php | 51 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 10 deletions(-) (limited to 'public/users.php') diff --git a/public/users.php b/public/users.php index 4876a0f..4540f5a 100644 --- a/public/users.php +++ b/public/users.php @@ -4,6 +4,7 @@ include_once "../src/user.php"; include_once "../src/partials.php"; include_once "../src/utils.php"; include_once "../src/accounts.php"; +include_once "../src/alert.php"; authorize_user(); session_start(); @@ -124,7 +125,7 @@ if ($row = $stmt->fetch()) { } if ($user == null) { - header("Location: /404.php"); + generate_alert("/404.php", "The user you requested cannot be found", 404); exit; } @@ -211,7 +212,39 @@ $stmt->execute([$user->id()]); $contributions += intval($stmt->fetch()[0]); // getting status -$status = 1; +$status = "... i don't know who am i"; + +$stmt = $db->prepare("SELECT * FROM roles r INNER JOIN role_assigns ra ON ra.user_id = ? WHERE ra.role_id = r.id"); +$stmt->execute([$user->id()]); + +if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + $status = ''; + $status .= $row["name"]; + $status .= ''; +} // getting reactions $stmt = $db->prepare("SELECT rate, COUNT(*) AS c FROM ratings WHERE user_id = ? GROUP BY rate ORDER BY c DESC"); @@ -277,13 +310,7 @@ if ($is_json) { - + @@ -343,7 +370,11 @@ if ($is_json) {
Send a message - Report user + id() ?>">Report user'; + } + ?>
-- cgit v1.2.3
I am
Joined