diff options
| author | ilotterytea <iltsu@alright.party> | 2025-04-23 01:19:10 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-04-23 01:19:10 +0500 |
| commit | d1a804db47fe0437278c1a55e395971026b8c7f9 (patch) | |
| tree | 740de60383d7c16bbb9bd27dd7ce314fe6237b6e /src/partials.php | |
| parent | 999bfa6cad76900d4550e00e8e29f0252fb006b5 (diff) | |
feat: report system
Diffstat (limited to 'src/partials.php')
| -rw-r--r-- | src/partials.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/partials.php b/src/partials.php index 174b1d3..cf28f28 100644 --- a/src/partials.php +++ b/src/partials.php @@ -15,6 +15,8 @@ function html_navigation_bar() <?php if (isset($_SESSION["user_id"])) { $db = new PDO(DB_URL, DB_USER, DB_PASS); + + // getting inbox $stmt = $db->prepare("SELECT COUNT(*) FROM inbox_messages WHERE recipient_id = ? AND has_read = false"); $stmt->execute([$_SESSION["user_id"]]); $unread_count = intval($stmt->fetch()[0]); @@ -24,6 +26,19 @@ function html_navigation_bar() </a> <?php ; $stmt = null; + + // getting reports + $stmt = $db->prepare("SELECT COUNT(*) FROM reports WHERE sender_id = ? AND resolved_by IS NULL"); + $stmt->execute([$_SESSION["user_id"]]); + $unread_count = intval($stmt->fetch()[0]); + echo '' ?> + <a href="/report/list.php" class="button"> + Reports <?php echo $unread_count > 0 ? "($unread_count)" : "" ?> + </a> + <?php ; + $stmt = null; + + $db = null; } ?> |
