forked from Adleraci/adlerka.top
Test
This commit is contained in:
parent
d5a6f7878c
commit
4472e22426
@ -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 || "";
|
||||
}
|
||||
|
||||
|
@ -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"]
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -1,47 +0,0 @@
|
||||
<!--suppress HtmlUnknownTag, HtmlUnknownTag -->
|
||||
<page minimal_permission_level="2" secret="yes" page_title="Prieskum"></page>
|
||||
<form id="surveyForm">
|
||||
<h3>Spokojnosť so stránkou:</h3>
|
||||
<input type="radio" name="satisfaction" value="5" id="spokojnost_super">
|
||||
<label for="spokojnost_super">Super</label>
|
||||
<input type="radio" name="satisfaction" value="4" id="spokojnost_dobre">
|
||||
<label for="spokojnost_dobre">Dobre</label>
|
||||
<input type="radio" name="satisfaction" value="3" id="spokojnost_da_sa">
|
||||
<label for="spokojnost_da_sa">Dá sa</label>
|
||||
<input type="radio" name="satisfaction" value="2" id="spokojnost_zle">
|
||||
<label for="spokojnost_zle">Zle</label>
|
||||
<input type="radio" name="satisfaction" value="1" id="spokojnost_nanic">
|
||||
<label for="spokojnost_nanic">Nanič</label>
|
||||
<br>
|
||||
<br>
|
||||
<h3>Funkčnosť stránky:</h3>
|
||||
<input type="radio" name="functionality" value="5" id="funkcnost_super">
|
||||
<label for="funkcnost_super">Super</label>
|
||||
<input type="radio" name="functionality" value="4" id="funkcnost_dobre">
|
||||
<label for="funkcnost_dobre">Dobre</label>
|
||||
<input type="radio" name="functionality" value="3" id="funkcnost_da_sa">
|
||||
<label for="funkcnost_da_sa">Dá sa</label>
|
||||
<input type="radio" name="functionality" value="2" id="funkcnost_zle">
|
||||
<label for="funkcnost_zle">Zle</label>
|
||||
<input type="radio" name="functionality" value="1" id="funkcnost_nanic">
|
||||
<label for="funkcnost_nanic">Nanič</label>
|
||||
<br>
|
||||
<br>
|
||||
<h3>Obsah stránky:</h3>
|
||||
<input type="radio" name="content" value="5" id="content_super">
|
||||
<label for="content_super">Super</label>
|
||||
<input type="radio" name="content" value="4" id="content_dobre">
|
||||
<label for="content_dobre">Dobre</label>
|
||||
<input type="radio" name="content" value="3" id="content_da_sa">
|
||||
<label for="content_da_sa">Dá sa</label>
|
||||
<input type="radio" name="content" value="2" id="content_zle">
|
||||
<label for="content_zle">Zle</label>
|
||||
<input type="radio" name="content" value="1" id="content_nanic">
|
||||
<label for="content_nanic">Nanič</label>
|
||||
<br>
|
||||
<br>
|
||||
<textarea name="comment" placeholder="Komentár" cols="80" rows="10" required></textarea>
|
||||
<br>
|
||||
<br>
|
||||
<button type="button" onclick="surveySubmit()">Odoslať</button>
|
||||
</form>
|
@ -10,7 +10,7 @@
|
||||
<link rel="icon" href="/assets/images/favicon.png" type="image/png">
|
||||
__TEMPLATE__DYNAMIC__SCRIPT__
|
||||
__TEMPLATE__DYNAMIC__STYLE__
|
||||
<script async src="https://umami.brn.systems/script.js" data-website-id="95e93885-5c19-4cab-ba9b-2f746a316a2a"></script>
|
||||
<script async data-website-id="962431d7-e53a-48a8-b58d-7771df9de861" src="https://umami.brn.systems/script.js"></script>
|
||||
<script async src="/assets/script.js"></script>
|
||||
<script async src="/assets/3rdparty/sliderm.js"></script>
|
||||
<title>__TEMPLATE_PAGE_TITLE__</title>
|
||||
|
@ -18,9 +18,6 @@
|
||||
<label for="updateNickname">Nickname:</label>
|
||||
<input type="text" id="updateNickname" name="updateNickname" required><br>
|
||||
|
||||
<label for="updateMinecraftNick">Minecraft Nick:</label>
|
||||
<input type="text" id="updateMinecraftNick" name="updateMinecraftNick" required><br>
|
||||
|
||||
<button type="button" onclick="updateUserProfile()">Update Profile</button>
|
||||
</div>
|
||||
<br><br>
|
||||
|
Loading…
Reference in New Issue
Block a user