diff options
| author | ilotterytea <iltsu@alright.party> | 2025-04-22 22:39:58 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-04-22 22:39:58 +0500 |
| commit | 999bfa6cad76900d4550e00e8e29f0252fb006b5 (patch) | |
| tree | 3c13a1fb18f95fceff320ae1086318ab9c53d913 /src/partials.php | |
| parent | 0e261a67be8f770d7a3d4ca8d9bc12c02dd2b93a (diff) | |
feat: inbox 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 71f4f63..174b1d3 100644 --- a/src/partials.php +++ b/src/partials.php @@ -12,6 +12,21 @@ function html_navigation_bar() <a href="/users.php" class="button">Users</a> <a href="/emotes/upload.php" class="button">Upload</a> <a href="/account" class="button">Account</a> + <?php + if (isset($_SESSION["user_id"])) { + $db = new PDO(DB_URL, DB_USER, DB_PASS); + $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]); + echo '' ?> + <a href="/inbox.php" class="button"> + Inbox <?php echo $unread_count > 0 ? "($unread_count)" : "" ?> + </a> + <?php ; + $stmt = null; + $db = null; + } + ?> </div> <?php if (isset($_SESSION["user_id"])) { |
