diff options
| author | ilotterytea <iltsu@alright.party> | 2025-05-15 00:07:41 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-05-15 00:07:41 +0500 |
| commit | 29337b30b7071cff678a7be54161507f3eb278be (patch) | |
| tree | f396b5ca362b189064fa52ce5baced4c96412d78 /public/account/index.php | |
| parent | 3f5765a05536a5b1e524bb4f4ffd290ff23a24af (diff) | |
feat: pfp, banner, badge deletion buttons
Diffstat (limited to 'public/account/index.php')
| -rw-r--r-- | public/account/index.php | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/public/account/index.php b/public/account/index.php index 6cf3fc7..2b9e790 100644 --- a/public/account/index.php +++ b/public/account/index.php @@ -123,40 +123,67 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { <h2>Profile</h2> <h3>Profile picture</h3> <?php - if (is_dir("../static/userdata/avatars/" . $_SESSION["user_id"])) { + $has_pfp = is_dir("../static/userdata/avatars/" . $_SESSION["user_id"]); + if ($has_pfp) { echo '<img src="/static/userdata/avatars/' . $_SESSION["user_id"] . '/2x.webp" id="pfp" width="64" height="64">'; } else { echo "<p>You don't have profile picture</p>"; } ?> - <input type="file" name="pfp"> + <div> + <input type="file" name="pfp"> + <?php if ($has_pfp): ?> + <a href="/account/delete.php?pfp=true"> + <img src="/static/img/icons/bin.png" alt="Remove profile picture" + title="Remove profile picture"> + </a> + <?php endif; ?> + </div> <h3>Profile banner</h3> <?php - if (is_dir("../static/userdata/banners/" . $_SESSION["user_id"])) { + $has_banner = is_dir("../static/userdata/banners/" . $_SESSION["user_id"]); + if ($has_banner) { echo '<img src="/static/userdata/banners/' . $_SESSION["user_id"] . '/2x.webp" id="banner" width="256">'; } else { echo "<p>You don't have profile banner</p>"; } ?> - <input type="file" name="banner"> + <div> + <input type="file" name="banner"> + <?php if ($has_banner): ?> + <a href="/account/delete.php?banner=true"> + <img src="/static/img/icons/bin.png" alt="Remove banner" title="Remove banner"> + </a> + <?php endif; ?> + </div> <h3>Personal badge</h3> <?php $stmt = $db->prepare("SELECT badge_id FROM user_badges WHERE user_id = ?"); $stmt->execute([$_SESSION["user_id"]]); + $has_badge = false; + if ($row = $stmt->fetch()) { echo '<div class="box row items-center justify-between">'; echo '<img src="/static/userdata/badges/' . $row["badge_id"] . '/1x.webp" id="badge">'; echo '<img src="/static/userdata/badges/' . $row["badge_id"] . '/2x.webp" id="badge">'; echo '<img src="/static/userdata/badges/' . $row["badge_id"] . '/3x.webp" id="badge">'; echo '</div>'; + $has_badge = true; } else { echo "<p>You don't have personal badge</p>"; } ?> - <input type="file" name="badge"> + <div> + <input type="file" name="badge"> + <?php if ($has_badge): ?> + <a href="/account/delete.php?badge=true"> + <img src="/static/img/icons/bin.png" alt="Remove badge" title="Remove badge"> + </a> + <?php endif; ?> + </div> <h3>Username</h3> <input type="text" name="username" id="username" value="<?php echo $_SESSION["user_name"] ?>"> @@ -253,9 +280,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { <button type="submit">Apply</button> </form> - <form action="/account/delete.php"> - <button class="red" type="submit">Delete me</button> - </form> + <a href="/account/delete.php?profile=true" class="red button" style="text-align: center;">Delete + me</a> </section> </section> </div> |
