diff --git a/database/backported/1.5/saveAccount.php b/database/backported/1.5/saveAccount.php new file mode 100644 index 0000000..81bd995 --- /dev/null +++ b/database/backported/1.5/saveAccount.php @@ -0,0 +1,47 @@ +prepare("SELECT * FROM users WHERE token = ? AND username = ?"); +$stmt->bind_param("ss", $token, $username); +$stmt->execute(); +$result = $stmt->get_result(); + +if ($result->num_rows > 0) { + $row = $result->fetch_assoc(); + $savedata = json_decode($row['save_data'], true); + $savedata['bird']['icon'] = $icon; + $savedata['bird']['overlay'] = $overlay; + $savedata['settings']['colors']['icon'] = $birdColor; + $savedata['settings']['colors']['overlay'] = $overlayColor; + $savedata = json_encode($savedata); + $updateStmt = $conn->prepare("UPDATE users SET legacy_high_score = ?, save_data = ? WHERE token = ? AND username = ?"); + $updateStmt->bind_param("isss", + $highScore, + $savedata, + $token, + $username + ); + $updateStmt->execute(); + $updateStmt->close(); + echo encrypt("1"); +} else { + echo encrypt("-1"); +} + +$stmt->close(); +$conn->close(); \ No newline at end of file diff --git a/database/saveAccount.php b/database/saveAccount.php index e71a057..554f500 100644 --- a/database/saveAccount.php +++ b/database/saveAccount.php @@ -12,6 +12,10 @@ if (isAllowedDatabaseVersion(getClientVersion())) { require __DIR__ . '/backported/1.2-beta2/syncAccount.php'; exit; } + if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") { + require __DIR__ . '/backported/1.5/saveAccount.php'; + exit; + } } checkClientDatabaseVersion();