diff --git a/assets/script.js b/assets/script.js index b3df92f..7c897c4 100644 --- a/assets/script.js +++ b/assets/script.js @@ -435,14 +435,12 @@ async function updateUserProfile() { const firstName = document.getElementById("updateFirstName").value; const lastName = document.getElementById("updateLastName").value; const nickname = document.getElementById("updateNickname").value; - const minecraftNick = document.getElementById("updateMinecraftNick").value; const data = { action: "update_user_profile", first_name: firstName, last_name: lastName, nickname: nickname, - minecraft_nick: minecraftNick, }; await doAction('/account', data, "Profile update Successful!", "Profile update failed.", false); @@ -467,7 +465,6 @@ async function populateUserInfoFields(userData) { document.getElementById("updateFirstName").value = userData.FirstName || ""; document.getElementById("updateLastName").value = userData.LastName || ""; document.getElementById("updateNickname").value = userData.Nickname || ""; - document.getElementById("updateMinecraftNick").value = userData.MinecraftNick || ""; document.getElementById("updateNewEmail").value = userData.Email || ""; } diff --git a/endpoints/account.php b/endpoints/account.php index ad4075a..f5d8b5e 100644 --- a/endpoints/account.php +++ b/endpoints/account.php @@ -26,7 +26,6 @@ function endpoint($endpoint_data): array $endpoint_data["first_name"], $endpoint_data["last_name"], $endpoint_data["nickname"], - $endpoint_data["minecraft_nick"] ), "update_user_email" => updateUserEmail( $endpoint_data["email"] diff --git a/lib/account.php b/lib/account.php index c239368..c2ac0d8 100644 --- a/lib/account.php +++ b/lib/account.php @@ -117,7 +117,6 @@ function setDefaultSessionData(): void $_SESSION["last_name"] = ""; $_SESSION["nickname"] = ""; $_SESSION["email"] = ""; - $_SESSION["minecraft_nickname"] = ""; $_SESSION["privilege_level"] = $routerConfig["permissions"]["logged_out"]; } /** @@ -150,7 +149,7 @@ function verifyPassword(int $userID, string $password): bool function UpdateSession(): void { global $mysqli; - $stmt = $mysqli->prepare("SELECT FirstName, LastName, Nickname, Email, MinecraftNick, PrivilegeLevel, LastLoginAt, LoginCount, ClassID, FavoriteColor FROM Users WHERE ID = ? AND isActivated = 1"); + $stmt = $mysqli->prepare("SELECT FirstName, LastName, Nickname, Email, PrivilegeLevel, LastLoginAt, LoginCount, ClassID, FavoriteColor FROM Users WHERE ID = ? AND isActivated = 1"); $stmt->bind_param("i", $_SESSION["ID"]); $stmt->execute(); @@ -158,20 +157,18 @@ function UpdateSession(): void $last_name = ""; $nickname = ""; $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, $class_id, $favorite_color); + $stmt->bind_result($first_name, $last_name, $nickname, $email, $privilege_level, $lastLoginAt, $loginCount, $class_id, $favorite_color); $stmt->fetch(); $stmt->close(); $_SESSION["first_name"] = $first_name; $_SESSION["last_name"] = $last_name; $_SESSION["nickname"] = $nickname; $_SESSION["email"] = $email; - $_SESSION["minecraft_nickname"] = $minecraft_nickname; $_SESSION["privilege_level"] = $privilege_level; $_SESSION["lastLoginAt"] = $lastLoginAt; $_SESSION["loginCount"] = $loginCount; @@ -303,27 +300,26 @@ function changePassword(string $oldPassword, string $newPassword): array * @param string $firstName The new first name. * @param string $lastName The new last name. * @param string $nickname The new nickname. - * @param string $minecraft_nickname The new Minecraft nickname. * @return array Status of the profile update ('Success' or 'Fail'). *@global mysqli $mysqli Global database connection object. */ -function updateUserProfile(string $firstName, string $lastName, string $nickname, string $minecraft_nickname): array +function updateUserProfile(string $firstName, string $lastName, string $nickname): array { global $mysqli; $status = ["Status" => "Fail"]; - if (isLoggedIn() && !empty($firstName) && !empty($lastName) && !empty($nickname) && !empty($minecraft_nickname)) { + if (isLoggedIn() && !empty($firstName) && !empty($lastName) && !empty($nickname)) { - $stmt = $mysqli->prepare("UPDATE Users SET FirstName = ?, LastName = ?, Nickname = ?, MinecraftNick = ? WHERE ID = ?"); + $stmt = $mysqli->prepare("UPDATE Users SET FirstName = ?, LastName = ?, Nickname = ? WHERE ID = ?"); /** @noinspection SpellCheckingInspection */ - $stmt->bind_param("ssssi", $firstName, $lastName, $nickname, $minecraft_nickname, $_SESSION["ID"]); + $stmt->bind_param("ssssi", $firstName, $lastName, $nickname, $_SESSION["ID"]); $stmt->execute(); if ($stmt->affected_rows > 0) { $status["Status"] = "Success"; } else { - $status["Status"] = "$firstName $lastName $nickname $minecraft_nickname"; + $status["Status"] = "$firstName $lastName $nickname"; } $stmt->close(); @@ -393,7 +389,7 @@ function getUserInfo(): array if(isLoggedIn()) { global $mysqli; $userID = $_SESSION["ID"]; - $stmt = $mysqli->prepare("SELECT FirstName, LastName, Nickname, Email, MinecraftNick FROM Users WHERE ID = ?"); + $stmt = $mysqli->prepare("SELECT FirstName, LastName, Nickname, Email FROM Users WHERE ID = ?"); $stmt->bind_param("i", $userID); $stmt->execute(); @@ -401,9 +397,8 @@ function getUserInfo(): array $lastName = ""; $nickname = ""; $email = ""; - $minecraft_nickname = ""; - $stmt->bind_result($firstName, $lastName, $nickname, $email, $minecraft_nickname); + $stmt->bind_result($firstName, $lastName, $nickname, $email); $stmt->fetch(); $stmt->close(); UpdateSession(); @@ -414,8 +409,7 @@ function getUserInfo(): array "FirstName" => $firstName, "LastName" => $lastName, "Nickname" => $nickname, - "Email" => $email, - "MinecraftNick" => $minecraft_nickname + "Email" => $email ]; } @@ -473,7 +467,7 @@ function listUsers(): array if (isUserAdmin()) { $users = []; - $result = $mysqli->query("SELECT ID, FirstName, LastName, Nickname, Email, MinecraftNick, PrivilegeLevel, CreatedAt, RegisteredAt, LastLoginAt, LoginCount, CreatedBy FROM Users WHERE isActivated = 1"); + $result = $mysqli->query("SELECT ID, FirstName, LastName, Nickname, Email, PrivilegeLevel, CreatedAt, RegisteredAt, LastLoginAt, LoginCount, CreatedBy FROM Users WHERE isActivated = 1"); // Check if the query executed Successfully if ($result) { diff --git a/lib/page.php b/lib/page.php index 327f035..fde4205 100644 --- a/lib/page.php +++ b/lib/page.php @@ -204,7 +204,6 @@ function getPage(string $site_name_in = null, string $page_name_in = null): stri "UserInfo_LastName" => $_SESSION["last_name"], "UserInfo_Nickname" => $_SESSION["nickname"], "UserInfo_Email" => $_SESSION["email"], - "UserInfo_MinecraftNick" => $_SESSION["minecraft_nickname"], ]; } $dynamic_script = generateScriptData($dynamic_script_data); diff --git a/pages/account/survey.html b/pages/account/survey.html deleted file mode 100644 index e05c481..0000000 --- a/pages/account/survey.html +++ /dev/null @@ -1,47 +0,0 @@ - - -
-

Spokojnosť so stránkou:

- - - - - - - - - - -
-
-

Funkčnosť stránky:

- - - - - - - - - - -
-
-

Obsah stránky:

- - - - - - - - - - -
-
- -
-
- -
diff --git a/templates/skeleton.html b/templates/skeleton.html index 471645e..167fc62 100644 --- a/templates/skeleton.html +++ b/templates/skeleton.html @@ -10,7 +10,7 @@ __TEMPLATE__DYNAMIC__SCRIPT__ __TEMPLATE__DYNAMIC__STYLE__ - + __TEMPLATE_PAGE_TITLE__ diff --git a/templates/userActions.html b/templates/userActions.html index 260f123..564e48e 100644 --- a/templates/userActions.html +++ b/templates/userActions.html @@ -18,9 +18,6 @@
- -
-