This commit is contained in:
Bruno Rybársky 2024-02-03 17:15:21 +01:00
parent 8073d6c29e
commit 6753603ecd

@ -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;