diff options
| -rw-r--r-- | public/account/signout.php | 16 | ||||
| -rw-r--r-- | public/static/img/icons/door_out.png | bin | 0 -> 688 bytes | |||
| -rw-r--r-- | public/static/style.css | 4 | ||||
| -rw-r--r-- | src/partials.php | 35 |
4 files changed, 39 insertions, 16 deletions
diff --git a/public/account/signout.php b/public/account/signout.php new file mode 100644 index 0000000..f971d4a --- /dev/null +++ b/public/account/signout.php @@ -0,0 +1,16 @@ +<?php +include_once $_SERVER["DOCUMENT_ROOT"] . '/../src/accounts.php'; +include_once $_SERVER["DOCUMENT_ROOT"] . '/../src/alert.php'; + +if (!isset($_GET["local"])) { + header("Location: /"); + exit; +} + +session_start(); + +setcookie("secret_key", "", time() - 1000, "/"); +session_unset(); +session_destroy(); + +generate_alert("/", "Signed out!", 200);
\ No newline at end of file diff --git a/public/static/img/icons/door_out.png b/public/static/img/icons/door_out.png Binary files differnew file mode 100644 index 0000000..2541d2b --- /dev/null +++ b/public/static/img/icons/door_out.png diff --git a/public/static/style.css b/public/static/style.css index bc8ab61..a53d128 100644 --- a/public/static/style.css +++ b/public/static/style.css @@ -526,6 +526,10 @@ a.box:hover { align-items: center; } +.items-bottom { + align-items: end; +} + .justify-center { justify-content: center; } diff --git a/src/partials.php b/src/partials.php index b7640af..a361f7b 100644 --- a/src/partials.php +++ b/src/partials.php @@ -77,22 +77,25 @@ function html_navigation_bar() } ?> </div> - <?php - if (isset($_SESSION["user_id"])) { - 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>'; - } - ?> + <?php if (isset($_SESSION["user_id"])): ?> + <div class="flex items-bottom small-gap" style="margin-left: auto;"> + <a href="/users.php?id=<?php echo $_SESSION["user_id"] ?>" class="flex items-bottom small-gap"> + Signed in as <?php echo $_SESSION["user_name"] ?> + <?php + 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" />'; + ?> + </a> + <a href="/account/signout.php?local"> + <img src="/static/img/icons/door_out.png" alt="[ Log out ]" title="Log out"> + </a> + </div> + <?php endif; ?> </section> <?php ; } |
