summaryrefslogtreecommitdiff
path: root/src/partials.php
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-05-07 14:42:30 +0500
committerilotterytea <iltsu@alright.party>2025-05-07 14:42:30 +0500
commitd857bf78c0f8639eae9e21ffe4e04ee68e94d04b (patch)
tree2cecbfa99e3ac428d7e4537a14bda0682dee3e5d /src/partials.php
parentff7178fd42240cb1ad012c6afd11f40020963f53 (diff)
feat: display default avatar if user doesn't have one
Diffstat (limited to 'src/partials.php')
-rw-r--r--src/partials.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/partials.php b/src/partials.php
index 07f2636..38e63bb 100644
--- a/src/partials.php
+++ b/src/partials.php
@@ -72,12 +72,18 @@ function html_navigation_bar()
</div>
<?php
if (isset($_SESSION["user_id"])) {
- echo '' ?>
- <a href="/users.php?id=<?php echo $_SESSION["user_id"] ?>" class="links" style="margin-left:auto;">
- Signed in as <?php echo $_SESSION["user_name"] ?> <img
- src="/static/userdata/avatars/<?php echo $_SESSION["user_id"] ?>" width="24" height="24" />
- </a>
- <?php ;
+ echo '<a href="/users.php?id=' . $_SESSION["user_id"] . '" class="links" style="margin-left:auto;">';
+ echo 'Signed in as ' . $_SESSION["user_name"] . ' ';
+ echo '<img src="/static/';
+ if (
+ is_file($_SERVER['DOCUMENT_ROOT'] . "/static/userdata/avatars/" . $_SESSION["user_id"])
+ ) {
+ echo 'userdata/avatars/' . $_SESSION["user_id"];
+ } else {
+ echo 'img/defaults/profile_picture.png';
+ }
+ echo '" width="24" height="24" />';
+ echo '</a>';
}
?>
</section>