Fix login

This commit is contained in:
2025-08-26 10:34:18 -07:00
parent 5b3fabe0aa
commit 65ad36adca

View File

@@ -7,7 +7,6 @@ $conn = newConnection();
$post = getPostData(); $post = getPostData();
$username = $post['username']; $username = $post['username'];
$password = $post['password']; $password = $post['password'];
$currentHighScore = $post['currentHighScore'] ?? 0;
$stmt = $conn->prepare("SELECT * FROM users WHERE username = ?"); $stmt = $conn->prepare("SELECT * FROM users WHERE username = ?");
$stmt->bind_param("s", $username); $stmt->bind_param("s", $username);
@@ -32,13 +31,6 @@ $stmt = $conn->prepare("UPDATE users SET latest_ip = ?, token = ? WHERE id = ?")
$stmt->bind_param("ssi", $ip, $token, $id); $stmt->bind_param("ssi", $ip, $token, $id);
$stmt->execute(); $stmt->execute();
if ($currentHighScore > $user['highScore']) {
$stmt = $conn->prepare("UPDATE users SET highScore = ? WHERE id = ?");
$stmt->bind_param("ii", $currentHighScore, $id);
$stmt->execute();
$user['highScore'] = $currentHighScore;
}
$data = ["session" => $token, "username" => $user['username'], "userid" => $id]; $data = ["session" => $token, "username" => $user['username'], "userid" => $id];
echo encrypt(json_encode(["success" => true, "data" => $data])); echo encrypt(json_encode(["success" => true, "data" => $data]));