diff --git a/database/backported/12beta2-loginAccount.php b/database/backported/12beta2-loginAccount.php new file mode 100644 index 0000000..18a18fb --- /dev/null +++ b/database/backported/12beta2-loginAccount.php @@ -0,0 +1,48 @@ +prepare("SELECT * FROM users WHERE username = ?"); +$stmt->bind_param("s", $request_username); + +$stmt->execute(); + +$result = $stmt->get_result(); + +if ($result->num_rows > 0) { + while($row = $result->fetch_assoc()) { + if (password_verify($request_password, $row["password"])) { + $login_ip = getIPAddress(); + $login_time = time(); + $uid = $row['id']; + $username = $row['username']; + $savedata = json_decode($row['save_data'], true); + $highscore = $savedata['gameStore']['highScore']; + $token = $row['token']; + + $stmt = $conn->prepare("UPDATE users SET latest_ip = ? WHERE id = ?"); + $stmt->bind_param("si", $login_ip, $uid); + $stmt->execute(); + + echo "$token:$uid:$highscore"; + } else { + $stmt->close(); + $conn->close(); + exit("-2"); + } + } +} else { + $stmt->close(); + $conn->close(); + exit("-2"); +} + +$stmt->close(); +$conn->close(); + +?> \ No newline at end of file diff --git a/database/loginAccount.php b/database/loginAccount.php index 9a9fd74..ec88902 100644 --- a/database/loginAccount.php +++ b/database/loginAccount.php @@ -1,6 +1,10 @@