diff --git a/database.sql b/database.sql index 72827a8..a3eb8d5 100644 --- a/database.sql +++ b/database.sql @@ -3,7 +3,7 @@ -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3306 --- Generation Time: Aug 27, 2025 at 10:03 AM +-- Generation Time: Aug 28, 2025 at 08:21 PM -- Server version: 11.8.3-MariaDB-ubu2404 -- PHP Version: 8.1.33 @@ -99,7 +99,8 @@ CREATE TABLE `users` ( `register_time` int(11) DEFAULT NULL, `banned` tinyint(1) NOT NULL DEFAULT 0, `leaderboardsBanned` tinyint(1) NOT NULL DEFAULT 0, - `save_data` longtext NOT NULL DEFAULT '\'{}\'' + `save_data` longtext NOT NULL DEFAULT '\'{}\'', + `legacy_high_score` bigint(20) NOT NULL DEFAULT 0 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED; -- diff --git a/database/backported/12beta2-loginAccount.php b/database/backported/12beta2-loginAccount.php index 18a18fb..1e39160 100644 --- a/database/backported/12beta2-loginAccount.php +++ b/database/backported/12beta2-loginAccount.php @@ -21,8 +21,7 @@ if ($result->num_rows > 0) { $login_time = time(); $uid = $row['id']; $username = $row['username']; - $savedata = json_decode($row['save_data'], true); - $highscore = $savedata['gameStore']['highScore']; + $highscore = $row['legacy_high_score']; $token = $row['token']; $stmt = $conn->prepare("UPDATE users SET latest_ip = ? WHERE id = ?"); diff --git a/database/backported/12beta2-syncAccount.php b/database/backported/12beta2-syncAccount.php new file mode 100644 index 0000000..291070a --- /dev/null +++ b/database/backported/12beta2-syncAccount.php @@ -0,0 +1,29 @@ +prepare("SELECT * FROM users WHERE token = ? AND id = ?"); +$stmt->bind_param("ss", $request_session, $request_uid); +$stmt->execute(); +$result = $stmt->get_result(); + +if ($result->num_rows > 0) { + $updateStmt = $conn->prepare("UPDATE users SET legacy_high_score = ? WHERE token = ? AND id = ?"); + $updateStmt->bind_param("isi", $request_score, $request_session, $request_uid); + $updateStmt->execute(); + echo 1; + $updateStmt->close(); +} else { + echo "-2"; +} + +$stmt->close(); +$conn->close(); +?> \ No newline at end of file diff --git a/database/saveAccount.php b/database/saveAccount.php index 51dd0b5..8813f37 100644 --- a/database/saveAccount.php +++ b/database/saveAccount.php @@ -1,6 +1,10 @@