diff options
| author | ilotterytea <iltsu@alright.party> | 2025-05-07 14:42:30 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-05-07 14:42:30 +0500 |
| commit | d857bf78c0f8639eae9e21ffe4e04ee68e94d04b (patch) | |
| tree | 2cecbfa99e3ac428d7e4537a14bda0682dee3e5d /public/account | |
| parent | ff7178fd42240cb1ad012c6afd11f40020963f53 (diff) | |
feat: display default avatar if user doesn't have one
Diffstat (limited to 'public/account')
| -rw-r--r-- | public/account/index.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/public/account/index.php b/public/account/index.php index 8ecce33..5455727 100644 --- a/public/account/index.php +++ b/public/account/index.php @@ -88,13 +88,23 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { <form action="/account" method="POST" enctype="multipart/form-data"> <h2>Profile</h2> <h3>Profile picture</h3> - <img src="/static/userdata/avatars/<?php echo $_SESSION["user_id"] ?>" id="pfp" width="64" - height="64"> + <?php + if (is_file("../static/userdata/avatars/" . $_SESSION["user_id"])) { + echo '<img src="/static/userdata/avatars/' . $_SESSION["user_id"] . '" id="pfp" width="64" height="64">'; + } else { + echo "<p>You don't have profile picture</p>"; + } + ?> <input type="file" name="pfp"> <h3>Profile banner</h3> - <img src="/static/userdata/banners/<?php echo $_SESSION["user_id"] ?>" id="banner" width="192" - height="108"> + <?php + if (is_file("../static/userdata/banners/" . $_SESSION["user_id"])) { + echo '<img src="/static/userdata/banners/' . $_SESSION["user_id"] . '" id="banner" width="192" height="108">'; + } else { + echo "<p>You don't have profile banner</p>"; + } + ?> <input type="file" name="banner"> <h3>Username</h3> |
