Sync account 1.2-beta2 endpoint
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
-- https://www.phpmyadmin.net/
|
-- https://www.phpmyadmin.net/
|
||||||
--
|
--
|
||||||
-- Host: 127.0.0.1:3306
|
-- 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
|
-- Server version: 11.8.3-MariaDB-ubu2404
|
||||||
-- PHP Version: 8.1.33
|
-- PHP Version: 8.1.33
|
||||||
|
|
||||||
@@ -99,7 +99,8 @@ CREATE TABLE `users` (
|
|||||||
`register_time` int(11) DEFAULT NULL,
|
`register_time` int(11) DEFAULT NULL,
|
||||||
`banned` tinyint(1) NOT NULL DEFAULT 0,
|
`banned` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
`leaderboardsBanned` 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;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=COMPRESSED;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ if ($result->num_rows > 0) {
|
|||||||
$login_time = time();
|
$login_time = time();
|
||||||
$uid = $row['id'];
|
$uid = $row['id'];
|
||||||
$username = $row['username'];
|
$username = $row['username'];
|
||||||
$savedata = json_decode($row['save_data'], true);
|
$highscore = $row['legacy_high_score'];
|
||||||
$highscore = $savedata['gameStore']['highScore'];
|
|
||||||
$token = $row['token'];
|
$token = $row['token'];
|
||||||
|
|
||||||
$stmt = $conn->prepare("UPDATE users SET latest_ip = ? WHERE id = ?");
|
$stmt = $conn->prepare("UPDATE users SET latest_ip = ? WHERE id = ?");
|
||||||
|
|||||||
29
database/backported/12beta2-syncAccount.php
Normal file
29
database/backported/12beta2-syncAccount.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
$request_uid = $_POST['userID'] ?? 0;
|
||||||
|
$request_session = $_POST['gameSession'] ?? '';
|
||||||
|
$request_score = $_POST['highScore'] ?? 0;
|
||||||
|
|
||||||
|
$conn = newConnection();
|
||||||
|
|
||||||
|
$stmt = $conn->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();
|
||||||
|
?>
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
require __DIR__ . '/../incl/util.php';
|
require __DIR__ . '/../incl/util.php';
|
||||||
setPlainHeader();
|
setPlainHeader();
|
||||||
|
if (getClientVersion() == "1.2-beta2") {
|
||||||
|
require __DIR__ . '/backported/12beta2-syncAccount.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
checkClientDatabaseVersion();
|
checkClientDatabaseVersion();
|
||||||
|
|
||||||
$post = getPostData();
|
$post = getPostData();
|
||||||
|
|||||||
2
database/syncAccount.php
Normal file
2
database/syncAccount.php
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?php
|
||||||
|
require __DIR__ . '/saveAccount.php';
|
||||||
Reference in New Issue
Block a user