This commit is contained in:
Bruno Rybársky 2024-02-04 09:11:01 +01:00
parent 6b08e4e8ad
commit 88b1391b34
4 changed files with 18 additions and 2 deletions

@ -19,6 +19,8 @@ body {
color: var(--primary-text);
margin: 0;
padding: 0;
min-height: 100vh;
min-width: 100vw;
}
nav {

@ -88,7 +88,7 @@ function verifyPassword($userID, $password): bool
function UpdateSession(){
global $mysqli;
$stmt = $mysqli->prepare("SELECT FirstName, LastName, Nickname, Email, MinecraftNick, PrivilegeLevel, LastLoginAt, LoginCount FROM Users WHERE ID = ? AND isActivated = 1");
$stmt = $mysqli->prepare("SELECT FirstName, LastName, Nickname, Email, MinecraftNick, PrivilegeLevel, LastLoginAt, LoginCount, ClassID, FavoriteColor FROM Users WHERE ID = ? AND isActivated = 1");
$stmt->bind_param("i", $_SESSION["ID"]);
$stmt->execute();
@ -100,9 +100,11 @@ function UpdateSession(){
$email = "";
$minecraft_nickname = "";
$privilege_level = 0;
$class_id = 0;
$favorite_color = 0;
$lastLoginAt = null;
$loginCount = 0;
$stmt->bind_result($first_name, $last_name, $nickname, $email, $minecraft_nickname, $privilege_level, $lastLoginAt, $loginCount);
$stmt->bind_result($first_name, $last_name, $nickname, $email, $minecraft_nickname, $privilege_level, $lastLoginAt, $loginCount, $class_id, $favorite_color);
$stmt->fetch();
$stmt->close();
@ -112,6 +114,10 @@ function UpdateSession(){
$_SESSION["email"] = $email;
$_SESSION["minecraft_nickname"] = $minecraft_nickname;
$_SESSION["privilege_level"] = $privilege_level;
$_SESSION["lastLoginAt"] = $lastLoginAt;
$_SESSION["loginCount"] = $loginCount;
$_SESSION["class_id"] = $class_id;
$_SESSION["favorite_color"] = $favorite_color;
}

@ -112,6 +112,10 @@ function getPage($page_name = null): array|false|string
$page_title = $page_name;
}
if(isLoggedIn() && !empty($_SESSION["favorite_color"]) && is_int($_SESSION["favorite_color"]) && $_SESSION["favorite_color"] <= 4294967295){
$dynastyle = dechex($_SESSION["favorite_color"]);
}
$navpages = generateNavigation();
$nav = str_replace("__NAV_PAGES__", $navpages, $nav);
@ -119,5 +123,6 @@ function getPage($page_name = null): array|false|string
$out = $skeleton;
$out = str_replace("__TEMPLATE__NAV__", $nav, $out);
$out = str_replace("__TEMPLATE__PAGE__", $page, $out);
$out = str_replace("__TEMPLATE__DYNASTYLE__", $dynastyle, $out);
return str_replace("__TEMPLATE_PAGE_TITLE__", $page_title, $out);
}

@ -8,6 +8,9 @@
<script src="/assets/script.js"></script>
<script async src="https://umami.brn.systems/script.js" data-website-id="95e93885-5c19-4cab-ba9b-2f746a316a2a"></script>
<title>Adlerka __TEMPLATE_PAGE_TITLE__</title>
<style>
__TEMPLATE__DYNASTYLE__
</style>
</head>
<body>
__TEMPLATE__NAV__