From 697543d3cb60f508e6f3da613821bf170ea53895 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Tue, 7 May 2024 21:24:14 +0200 Subject: [PATCH] added logout button --- index.php | 11 +++++++++++ res/index/script.js | 10 ++++++++++ res/index/style.css | 13 +++++++++++++ 3 files changed, 34 insertions(+) diff --git a/index.php b/index.php index 4b07359..e2d3ff5 100644 --- a/index.php +++ b/index.php @@ -26,10 +26,15 @@ session_start(); +
+ +
+ +
@@ -78,6 +83,12 @@ session_start(); } } + if (isset($_POST["logout_button"])) + { + unset($_SESSION["username"]); + echo ""; + } + function login($uname) { if ($uname != null) diff --git a/res/index/script.js b/res/index/script.js index 1b10282..690ec53 100644 --- a/res/index/script.js +++ b/res/index/script.js @@ -73,4 +73,14 @@ function set_login_uname(uname) { document.getElementById("login_indicator").style.visibility = "visible"; document.getElementById("login_indicator").innerText += " " + uname; + + document.getElementById("login_buttons").style.visibility = "hidden"; + document.getElementById("logout_button").style.visibility = "visible"; +} + +function logout() +{ + document.getElementById("login_buttons").style.visibility = "visible"; + document.getElementById("logout_button").style.visibility = "hidden"; + document.getElementById("login_indicator").style.visibility = "hidden"; } \ No newline at end of file diff --git a/res/index/style.css b/res/index/style.css index e6a5d7b..b0134b8 100644 --- a/res/index/style.css +++ b/res/index/style.css @@ -6,6 +6,7 @@ body -o-background-size: cover; background-size: cover; user-select: none; + overflow: hidden; } #textPole @@ -86,11 +87,23 @@ body padding-top: 7vh; } +#login_buttons +{ + margin-top: 5vh; +} + #login_buttons * { width: 17vh; } +#logout_button +{ + visibility: hidden; + position: absolute; + margin-top: -8.05vh; +} + #login_indicator { visibility: hidden;