From 6753603ecd532766916658e3e566571861589f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sat, 3 Feb 2024 17:15:21 +0100 Subject: [PATCH] test --- lib/account.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/account.php b/lib/account.php index c60d69d..c27aef3 100644 --- a/lib/account.php +++ b/lib/account.php @@ -105,19 +105,17 @@ function doLogin($email, $password): array $lastLoginAt = null; $loginCount = 0; $stmt->bind_result($uid, $first_name, $last_name, $nickname, $password_hash, $minecraft_nickname, $privilege_level, $lastLoginAt, $loginCount); + $stmt->fetch(); - if ($stmt->num_rows() > 0) { - echo "user found"; - $stmt->fetch(); - if (password_verify($password, $password_hash)) { - $found = true; + echo "user found"; + if (password_verify($password, $password_hash)) { + $found = true; - // Update LastLoginAt and LoginCount - $updateLoginStmt = $mysqli->prepare("UPDATE Users SET LastLoginAt = NOW(), LoginCount = LoginCount + 1 WHERE ID = ?"); - $updateLoginStmt->bind_param("i", $uid); - $updateLoginStmt->execute(); - $updateLoginStmt->close(); - } + // Update LastLoginAt and LoginCount + $updateLoginStmt = $mysqli->prepare("UPDATE Users SET LastLoginAt = NOW(), LoginCount = LoginCount + 1 WHERE ID = ?"); + $updateLoginStmt->bind_param("i", $uid); + $updateLoginStmt->execute(); + $updateLoginStmt->close(); } $_SESSION["ID"] = $uid;