A lot of changes (that shouldn't, hopefully be breaking)
This commit is contained in:
@@ -5,68 +5,61 @@ $conn1 = newConnection(1);
|
|||||||
$request_username = $_POST['username'];
|
$request_username = $_POST['username'];
|
||||||
$request_password = $_POST['password'];
|
$request_password = $_POST['password'];
|
||||||
|
|
||||||
$stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
$stmt = $conn0->prepare("SELECT id, username, password FROM users WHERE username = ?");
|
||||||
$stmt->bind_param("s", $request_username);
|
$stmt->bind_param("s", $request_username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
while($row = $result->fetch_assoc()) {
|
$row = $result->fetch_assoc();
|
||||||
if (password_verify($request_password, $row["password"])) {
|
if (password_verify($request_password, $row['password'])) {
|
||||||
$login_ip = getIPAddress();
|
$login_ip = getIPAddress();
|
||||||
$login_time = time();
|
$login_time = time();
|
||||||
$uid = $row['id'];
|
$uid = $row['id'];
|
||||||
|
|
||||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE id = ?");
|
$stmt = $conn1->prepare("SELECT token, legacy_high_score, save_data FROM userdata WHERE id = ? LIMIT 1");
|
||||||
$stmt2->bind_param("i", $uid);
|
$stmt->bind_param("i", $uid);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
if ($result2->num_rows != 1) exitWithMessage("-1", false);
|
||||||
|
$row2 = $result2->fetch_assoc();
|
||||||
|
|
||||||
if ($result2->num_rows != 1) {
|
$username = $row['username'];
|
||||||
echo '-1';
|
$highscore = $row2['legacy_high_score'];
|
||||||
exit;
|
$token = $row2['token'];
|
||||||
}
|
$savedata = json_decode($row2['save_data'], true);
|
||||||
|
$icon = $savedata['bird']['icon'] ?? 1;
|
||||||
|
$overlay = $savedata['bird']['overlay'] ?? 0;
|
||||||
|
|
||||||
$user2 = $result2->fetch_assoc();
|
$stmt = $conn0->prepare("UPDATE users SET latest_ip = ? WHERE id = ?");
|
||||||
|
$stmt->bind_param("si", $login_ip, $uid);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
$username = $row['username'];
|
if (
|
||||||
$highscore = $user2['legacy_high_score'];
|
getClientVersion() == "1.2-beta2" ||
|
||||||
$token = $user2['token'];
|
getClientVersion() == "1.2" ||
|
||||||
$savedata = json_decode($user2['save_data'], true);
|
getClientVersion() == "1.21" ||
|
||||||
$icon = $savedata['bird']['icon'] ?? 1;
|
getClientVersion() == "1.3-beta1"
|
||||||
$overlay = $savedata['bird']['overlay'] ?? 0;
|
) {
|
||||||
|
echo "$token:$uid:$highscore";
|
||||||
$stmt = $conn0->prepare("UPDATE users SET latest_ip = ? WHERE id = ?");
|
} else if (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") {
|
||||||
$stmt->bind_param("si", $login_ip, $uid);
|
echo "$token:$uid:$highscore:$icon:$overlay";
|
||||||
$stmt->execute();
|
} else if (getClientVersion() == "1.4.0-beta1" || getClientVersion() == "1.4.0" || getClientVersion() == "1.4.1") {
|
||||||
|
echo "1:$token:$username:$uid:$highscore:$icon:$overlay";
|
||||||
if (
|
|
||||||
getClientVersion() == "1.2-beta2" ||
|
|
||||||
getClientVersion() == "1.2" ||
|
|
||||||
getClientVersion() == "1.21" ||
|
|
||||||
getClientVersion() == "1.3-beta1"
|
|
||||||
) {
|
|
||||||
echo "$token:$uid:$highscore";
|
|
||||||
} else if (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") {
|
|
||||||
echo "$token:$uid:$highscore:$icon:$overlay";
|
|
||||||
} else if (getClientVersion() == "1.4.0-beta1" || getClientVersion() == "1.4.0" || getClientVersion() == "1.4.1") {
|
|
||||||
echo "1:$token:$username:$uid:$highscore:$icon:$overlay";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$stmt->close();
|
|
||||||
$conn0->close();
|
|
||||||
$conn1->close();
|
|
||||||
exit("-2");
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$conn0->close();
|
||||||
|
$conn1->close();
|
||||||
|
exitWithMessage("-2", false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$stmt->close();
|
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
$conn1->close();
|
$conn1->close();
|
||||||
exit("-2");
|
exitWithMessage("-2", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->close();
|
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
$conn1->close();
|
$conn1->close();
|
||||||
@@ -2,29 +2,28 @@
|
|||||||
$conn0 = newConnection(0);
|
$conn0 = newConnection(0);
|
||||||
$conn1 = newConnection(1);
|
$conn1 = newConnection(1);
|
||||||
|
|
||||||
$request_uid = $_POST['userID'] ?? 0;
|
$user_id = $_POST['userID'] ?? 0;
|
||||||
$request_session = $_POST['gameSession'] ?? '';
|
$token = $_POST['gameSession'] ?? '';
|
||||||
$request_score = $_POST['highScore'] ?? 0;
|
$high_score = $_POST['highScore'] ?? 0;
|
||||||
|
|
||||||
$stmt = $conn0->prepare("SELECT * FROM users WHERE id = ?");
|
$stmt = $conn0->prepare("SELECT * FROM users WHERE id = ?");
|
||||||
$stmt->bind_param("s", $request_uid);
|
$stmt->bind_param("s", $user_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
if ($result->num_rows != 1) {
|
if ($result->num_rows != 1) {
|
||||||
echo (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") ? "-2" : "-3";
|
echo (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") ? "-2" : "-3";
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
$conn1->close();
|
$conn1->close();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
$stmt->close();
|
||||||
|
$user_id = $result->fetch_assoc()["id"];
|
||||||
|
|
||||||
$request_uid = $result->fetch_assoc()["id"];
|
$stmt = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
||||||
|
$stmt->bind_param("si", $token, $user_id);
|
||||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
$stmt->execute();
|
||||||
$stmt2->bind_param("si", $request_session, $request_uid);
|
$result2 = $stmt->get_result();
|
||||||
$stmt2->execute();
|
$stmt->close();
|
||||||
$result2 = $stmt2->get_result();
|
|
||||||
|
|
||||||
if ($result2->num_rows != 1) {
|
if ($result2->num_rows != 1) {
|
||||||
echo (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") ? "-2" : "-3";
|
echo (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") ? "-2" : "-3";
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
@@ -33,7 +32,7 @@ if ($result2->num_rows != 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$updateStmt = $conn1->prepare("UPDATE userdata SET legacy_high_score = ? WHERE token = ? AND id = ?");
|
$updateStmt = $conn1->prepare("UPDATE userdata SET legacy_high_score = ? WHERE token = ? AND id = ?");
|
||||||
$updateStmt->bind_param("isi", $request_score, $request_session, $request_uid);
|
$updateStmt->bind_param("isi", $high_score, $token, $user_id);
|
||||||
$updateStmt->execute();
|
$updateStmt->execute();
|
||||||
$updateStmt->close();
|
$updateStmt->close();
|
||||||
|
|
||||||
|
|||||||
@@ -4,36 +4,33 @@ $conn1 = newConnection(1);
|
|||||||
|
|
||||||
$stmt = $conn0->prepare("SELECT username, id FROM users WHERE leaderboards_banned = 0");
|
$stmt = $conn0->prepare("SELECT username, id FROM users WHERE leaderboards_banned = 0");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
$topPlayers = [];
|
$topPlayers = [];
|
||||||
|
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
$id = $row["id"];
|
$id = $row["id"];
|
||||||
$stmt2 = $conn1->prepare("SELECT legacy_high_score, save_data FROM userdata WHERE id = ? AND legacy_high_score > 0 ORDER BY legacy_high_score DESC LIMIT 1");
|
$stmt = $conn1->prepare("SELECT legacy_high_score, save_data FROM userdata WHERE id = ? AND legacy_high_score > 0 ORDER BY legacy_high_score DESC LIMIT 1");
|
||||||
$stmt2->bind_param("i", $id);
|
$stmt->bind_param("i", $id);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
if ($result2->num_rows != 1) continue;
|
||||||
|
$row2 = $result2->fetch_assoc();
|
||||||
|
|
||||||
if ($result2->num_rows != 1) {
|
$savedata = json_decode($row2['save_data'], true);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$user2 = $result2->fetch_assoc();
|
|
||||||
|
|
||||||
$savedata = json_decode($user2['save_data'], true);
|
|
||||||
$icon = $savedata['bird']['icon'] ?? 1;
|
$icon = $savedata['bird']['icon'] ?? 1;
|
||||||
$overlay = $savedata['bird']['overlay'] ?? 0;
|
$overlay = $savedata['bird']['overlay'] ?? 0;
|
||||||
if (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") {
|
if (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") {
|
||||||
$topPlayers[] = $row["username"] . ":" . $user2["legacy_high_score"] . ":" . $icon . ":" . $overlay . ":" . $id;
|
$topPlayers[] = $row["username"] . ":" . $row2["legacy_high_score"] . ":" . $icon . ":" . $overlay . ":" . $id;
|
||||||
} else if (getClientVersion() == "0") {
|
} else if (getClientVersion() == "0") {
|
||||||
$topPlayers[] = base64_encode($row["username"]) . ":" . $user2["legacy_high_score"] . ":" . $icon . ":" . $overlay . ":" . $id;
|
$topPlayers[] = base64_encode($row["username"]) . ":" . $row2["legacy_high_score"] . ":" . $icon . ":" . $overlay . ":" . $id;
|
||||||
} else if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
} else if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
||||||
$birdColor = $savedata['settings']['colors']['icon'] ?? [255,255,255];
|
$birdColor = $savedata['settings']['colors']['icon'] ?? [255,255,255];
|
||||||
$overlayColor = $savedata['settings']['colors']['overlay'] ?? [255,255,255];
|
$overlayColor = $savedata['settings']['colors']['overlay'] ?? [255,255,255];
|
||||||
$topPlayers[] = base64_encode($row["username"]) . ":" . $user2["legacy_high_score"] . ":" . $icon . ":" . $overlay . ":" . $id . ":" . $birdColor[0] . ":" . $birdColor[1] . ":" . $birdColor[2] . ":" . $overlayColor[0] . ":" . $overlayColor[1] . ":" . $overlayColor[2];
|
$topPlayers[] = base64_encode($row["username"]) . ":" . $row2["legacy_high_score"] . ":" . $icon . ":" . $overlay . ":" . $id . ":" . $birdColor[0] . ":" . $birdColor[1] . ":" . $birdColor[2] . ":" . $overlayColor[0] . ":" . $overlayColor[1] . ":" . $overlayColor[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ $stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
|||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result->num_rows != 1) {
|
if ($result->num_rows != 1) {
|
||||||
echo (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") ? encrypt("-1") : "-1";
|
echo (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") ? encrypt("-1") : "-1";
|
||||||
@@ -26,10 +27,11 @@ if ($result->num_rows != 1) {
|
|||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
$id = $row["id"];
|
$id = $row["id"];
|
||||||
|
|
||||||
$stmt2 = $conn1->prepare("SELECT save_data, legacy_high_score FROM userdata WHERE id = ? AND token = ? LIMIT 1");
|
$stmt = $conn1->prepare("SELECT save_data, legacy_high_score FROM userdata WHERE id = ? AND token = ? LIMIT 1");
|
||||||
$stmt2->bind_param("is", $id, $token);
|
$stmt->bind_param("is", $id, $token);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result2->num_rows != 1) {
|
if ($result2->num_rows != 1) {
|
||||||
echo (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") ? encrypt("-1") : "-1";
|
echo (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") ? encrypt("-1") : "-1";
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ $request_highScore = $_POST['highScore'] ?? 0;
|
|||||||
$request_icon = $_POST['icon'] ?? 0;
|
$request_icon = $_POST['icon'] ?? 0;
|
||||||
$request_overlay = $_POST['overlay'] ?? 0;
|
$request_overlay = $_POST['overlay'] ?? 0;
|
||||||
|
|
||||||
$stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
$stmt = $conn0->prepare("SELECT id FROM users WHERE username = ?");
|
||||||
$stmt->bind_param("s", $request_userName);
|
$stmt->bind_param("s", $request_userName);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result->num_rows != 1) {
|
if ($result->num_rows != 1) {
|
||||||
echo "-2";
|
echo "-2";
|
||||||
@@ -22,10 +23,11 @@ if ($result->num_rows != 1) {
|
|||||||
|
|
||||||
$request_uid = $result->fetch_assoc()["id"];
|
$request_uid = $result->fetch_assoc()["id"];
|
||||||
|
|
||||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
$stmt = $conn1->prepare("SELECT save_data FROM userdata WHERE token = ? AND id = ?");
|
||||||
$stmt2->bind_param("si", $request_gameSession, $request_uid);
|
$stmt->bind_param("si", $request_gameSession, $request_uid);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result2->num_rows != 1) {
|
if ($result2->num_rows != 1) {
|
||||||
echo (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") ? "-2" : "-3";
|
echo (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") ? "-2" : "-3";
|
||||||
@@ -41,9 +43,9 @@ $savedata['bird']['icon'] = $request_icon;
|
|||||||
$savedata['bird']['overlay'] = $request_overlay;
|
$savedata['bird']['overlay'] = $request_overlay;
|
||||||
$savedata = json_encode($savedata);
|
$savedata = json_encode($savedata);
|
||||||
|
|
||||||
$updateStmt = $conn1->prepare("UPDATE userdata SET legacy_high_score = ?, save_data = ? WHERE token = ? AND id = ?");
|
$stmt = $conn1->prepare("UPDATE userdata SET legacy_high_score = ?, save_data = ? WHERE token = ? AND id = ?");
|
||||||
$updateStmt->bind_param("issi", $request_highScore, $savedata, $request_gameSession, $request_uid);
|
$stmt->bind_param("issi", $request_highScore, $savedata, $request_gameSession, $request_uid);
|
||||||
$updateStmt->execute();
|
$stmt->execute();
|
||||||
$updateStmt->close();
|
$stmt->close();
|
||||||
|
|
||||||
echo "1";
|
echo "1";
|
||||||
@@ -14,18 +14,20 @@ $result = $stmt->get_result();
|
|||||||
$rows = [];
|
$rows = [];
|
||||||
while ($row = $result->fetch_assoc()) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
$userId = $row["userId"];
|
$userId = $row["userId"];
|
||||||
$stmt2 = $conn1->prepare("SELECT save_data FROM userdata WHERE id = ? LIMIT 1");
|
$stmt = $conn1->prepare("SELECT save_data FROM userdata WHERE id = ? LIMIT 1");
|
||||||
$stmt2->bind_param("i", $userId);
|
$stmt->bind_param("i", $userId);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt2->get_result();
|
||||||
|
$stmt->close();
|
||||||
if ($result2->num_rows != 1) continue;
|
if ($result2->num_rows != 1) continue;
|
||||||
$row2 = $result2->fetch_assoc();
|
$row2 = $result2->fetch_assoc();
|
||||||
|
|
||||||
$stmt3 = $conn0->prepare("SELECT username FROM users WHERE id = ? LIMIT 1");
|
$stmt = $conn0->prepare("SELECT username FROM users WHERE id = ? LIMIT 1");
|
||||||
$stmt3->bind_param("i", $userId);
|
$stmt->bind_param("i", $userId);
|
||||||
$stmt3->execute();
|
$stmt->execute();
|
||||||
$result3 = $stmt3->get_result();
|
$result3 = $stmt->get_result();
|
||||||
if ($result3->num_rows != 1) continue;
|
if ($result3->num_rows != 1) continue;
|
||||||
|
$stmt->close();
|
||||||
$row3 = $result3->fetch_assoc();
|
$row3 = $result3->fetch_assoc();
|
||||||
|
|
||||||
$savedata = json_decode($row2['save_data'], true);
|
$savedata = json_decode($row2['save_data'], true);
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ $stmt = $conn->prepare("SELECT id FROM userdata WHERE token = ?");
|
|||||||
$stmt->bind_param("s", $token);
|
$stmt->bind_param("s", $token);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
if (!$row) exitWithMessage("-1");
|
if (!$row) exitWithMessage("-1");
|
||||||
$stmt->close();
|
|
||||||
|
|
||||||
$id = $row["id"];
|
$id = $row["id"];
|
||||||
$content = base64_encode($request_content);
|
$content = base64_encode($request_content);
|
||||||
|
|||||||
@@ -8,59 +8,53 @@ $password = $post['password'];
|
|||||||
$currentHighScore = $post['currentHighScore'] ?? 0;
|
$currentHighScore = $post['currentHighScore'] ?? 0;
|
||||||
$loginType = $post['loginType'] ?? '0';
|
$loginType = $post['loginType'] ?? '0';
|
||||||
|
|
||||||
$stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
$stmt = $conn0->prepare("SELECT id, username, password FROM users WHERE username = ?");
|
||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
if ($result->num_rows != 1) exitWithMessage("-1");
|
||||||
|
$row = $result->fetch_assoc();
|
||||||
|
|
||||||
if ($result->num_rows != 1) {
|
if (!password_verify($password, $row["password"])) exitWithMessage("-1");
|
||||||
exitWithMessage("-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $result->fetch_assoc();
|
$id = $row['id'];
|
||||||
|
$stmt = $conn1->prepare("SELECT token, legacy_high_score FROM userdata WHERE id = ?");
|
||||||
|
$stmt->bind_param("i", $id);
|
||||||
|
$stmt->execute();
|
||||||
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
if ($result2->num_rows != 1) exitWithMessage("-1");
|
||||||
|
$row2 = $result2->fetch_assoc();
|
||||||
|
|
||||||
if (!password_verify($password, $user["password"])) {
|
$token = $row2['token'];
|
||||||
exitWithMessage("-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = $user['id'];
|
|
||||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE id = ?");
|
|
||||||
$stmt2->bind_param("i", $id);
|
|
||||||
$stmt2->execute();
|
|
||||||
$result2 = $stmt2->get_result();
|
|
||||||
|
|
||||||
if ($result2->num_rows != 1) {
|
|
||||||
exitWithMessage("-1");
|
|
||||||
}
|
|
||||||
|
|
||||||
$user2 = $result2->fetch_assoc();
|
|
||||||
|
|
||||||
$token = $user2['token'];
|
|
||||||
$ip = getIPAddress();
|
$ip = getIPAddress();
|
||||||
|
|
||||||
$stmt = $conn0->prepare("UPDATE users SET latest_ip = ? WHERE id = ?");
|
$stmt = $conn0->prepare("UPDATE users SET latest_ip = ? WHERE id = ?");
|
||||||
$stmt->bind_param("si", $ip, $id);
|
$stmt->bind_param("si", $ip, $id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt2 = $conn1->prepare("UPDATE userdata SET token = ? WHERE id = ?");
|
$stmt->close();
|
||||||
$stmt2->bind_param("si", $token, $id);
|
$stmt = $conn1->prepare("UPDATE userdata SET token = ? WHERE id = ?");
|
||||||
$stmt2->execute();
|
$stmt->bind_param("si", $token, $id);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($currentHighScore > $user['legacy_high_score']) {
|
if ($currentHighScore > $row2['legacy_high_score']) {
|
||||||
$stmt = $conn1->prepare("UPDATE userdata SET legacy_high_score = ? WHERE id = ?");
|
$stmt = $conn1->prepare("UPDATE userdata SET legacy_high_score = ? WHERE id = ?");
|
||||||
$stmt->bind_param("ii", $currentHighScore, $id);
|
$stmt->bind_param("ii", $currentHighScore, $id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$user['legacy_high_score'] = $currentHighScore;
|
$stmt->close();
|
||||||
|
$row2['legacy_high_score'] = $currentHighScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
$savedata = json_decode($user['save_data'], true);
|
$savedata = json_decode($row['save_data'], true);
|
||||||
$birdColor = $savedata['settings']['colors']['icon'] ?? [255,255,255];
|
$birdColor = $savedata['settings']['colors']['icon'] ?? [255,255,255];
|
||||||
$overlayColor = $savedata['settings']['colors']['overlay'] ?? [255,255,255];
|
$overlayColor = $savedata['settings']['colors']['overlay'] ?? [255,255,255];
|
||||||
|
|
||||||
if ($loginType === "0") {
|
if ($loginType === "0") {
|
||||||
echo encrypt("1" . ":" . $token . ":" . $user['username'] . ":" . $id . ":" . $user['legacy_high_score'] . ":" . ($savedata['bird']['icon'] ?? 1) . ":" . ($savedata['bird']['overlay'] ?? 0) . ":0:0:0:0:0:" . ":" . $birdColor[0] . ":" . $birdColor[1] . ":" . $birdColor[2] . ":" . $overlayColor[0] . ":" . $overlayColor[1] . ":" . $overlayColor[2]);
|
echo encrypt("1" . ":" . $token . ":" . $row['username'] . ":" . $id . ":" . $row2['legacy_high_score'] . ":" . ($savedata['bird']['icon'] ?? 1) . ":" . ($savedata['bird']['overlay'] ?? 0) . ":0:0:0:0:0:" . ":" . $birdColor[0] . ":" . $birdColor[1] . ":" . $birdColor[2] . ":" . $overlayColor[0] . ":" . $overlayColor[1] . ":" . $overlayColor[2]);
|
||||||
} elseif ($loginType === "1") {
|
} elseif ($loginType === "1") {
|
||||||
echo encrypt("1" . ":" . $token . ":" . $user['username'] . ":" . $id);
|
echo encrypt("1" . ":" . $token . ":" . $row['username'] . ":" . $id);
|
||||||
}
|
}
|
||||||
$stmt->close();
|
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
$conn1->close();
|
$conn1->close();
|
||||||
@@ -19,10 +19,11 @@ $overlayColor = [$overlayR, $overlayG, $overlayB];
|
|||||||
$conn0 = newConnection(0);
|
$conn0 = newConnection(0);
|
||||||
$conn1 = newConnection(1);
|
$conn1 = newConnection(1);
|
||||||
|
|
||||||
$stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
$stmt = $conn0->prepare("SELECT id FROM users WHERE username = ?");
|
||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result->num_rows != 1) {
|
if ($result->num_rows != 1) {
|
||||||
echo encrypt("-1");
|
echo encrypt("-1");
|
||||||
@@ -34,10 +35,11 @@ if ($result->num_rows != 1) {
|
|||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
$id = $row["id"];
|
$id = $row["id"];
|
||||||
|
|
||||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE id = ? AND token = ?");
|
$stmt = $conn1->prepare("SELECT save_data FROM userdata WHERE id = ? AND token = ?");
|
||||||
$stmt2->bind_param("is", $id, $token);
|
$stmt->bind_param("is", $id, $token);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result2->num_rows != 1) {
|
if ($result2->num_rows != 1) {
|
||||||
echo encrypt("-1");
|
echo encrypt("-1");
|
||||||
@@ -53,15 +55,15 @@ $savedata['bird']['overlay'] = $overlay;
|
|||||||
$savedata['settings']['colors']['icon'] = $birdColor;
|
$savedata['settings']['colors']['icon'] = $birdColor;
|
||||||
if (getClientVersion() == "1.5.2") $savedata['settings']['colors']['overlay'] = $overlayColor;
|
if (getClientVersion() == "1.5.2") $savedata['settings']['colors']['overlay'] = $overlayColor;
|
||||||
$savedata = json_encode($savedata);
|
$savedata = json_encode($savedata);
|
||||||
$updateStmt = $conn1->prepare("UPDATE userdata SET legacy_high_score = ?, save_data = ? WHERE id = ? AND token = ?");
|
$stmt = $conn1->prepare("UPDATE userdata SET legacy_high_score = ?, save_data = ? WHERE id = ? AND token = ?");
|
||||||
$updateStmt->bind_param("isis",
|
$stmt->bind_param("isis",
|
||||||
$highScore,
|
$highScore,
|
||||||
$savedata,
|
$savedata,
|
||||||
$id,
|
$id,
|
||||||
$token
|
$token
|
||||||
);
|
);
|
||||||
$updateStmt->execute();
|
$stmt->execute();
|
||||||
$updateStmt->close();
|
$stmt->close();
|
||||||
echo encrypt("1");
|
echo encrypt("1");
|
||||||
|
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
require __DIR__ . '/../incl/util.php';
|
require __DIR__ . '/../incl/util.php';
|
||||||
setPlainHeader();
|
setPlainHeader();
|
||||||
echo '1';
|
echo getClientVersion() == "1.8.2" || getClientVersion() == "1.4.0-beta1" ? "1" : "2";
|
||||||
@@ -11,14 +11,12 @@ if (
|
|||||||
getClientVersion() == "1.33" ||
|
getClientVersion() == "1.33" ||
|
||||||
getClientVersion() == "1.4.0-beta1" ||
|
getClientVersion() == "1.4.0-beta1" ||
|
||||||
getClientVersion() == "1.4.0" ||
|
getClientVersion() == "1.4.0" ||
|
||||||
getClientVersion() == "1.4.1"
|
getClientVersion() == "1.4.1" ||
|
||||||
|
getClientVersion() == "1.5.0" ||
|
||||||
|
getClientVersion() == "1.5.1" ||
|
||||||
|
getClientVersion() == "1.5.2"
|
||||||
) {
|
) {
|
||||||
echo "-1";
|
exitWithMessage("-1", getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2");
|
||||||
exit;
|
|
||||||
}
|
|
||||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
|
||||||
exitWithMessage("-1");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exitWithMessage(json_encode(["success" => false, "message" => "You must use client version 26.1 or higher to register an account in game"]));
|
exitWithMessage(json_encode(["success" => false, "message" => "You must use client version 26.1 or higher to change your password in game"]));
|
||||||
@@ -11,14 +11,12 @@ if (
|
|||||||
getClientVersion() == "1.33" ||
|
getClientVersion() == "1.33" ||
|
||||||
getClientVersion() == "1.4.0-beta1" ||
|
getClientVersion() == "1.4.0-beta1" ||
|
||||||
getClientVersion() == "1.4.0" ||
|
getClientVersion() == "1.4.0" ||
|
||||||
getClientVersion() == "1.4.1"
|
getClientVersion() == "1.4.1" ||
|
||||||
|
getClientVersion() == "1.5.0" ||
|
||||||
|
getClientVersion() == "1.5.1" ||
|
||||||
|
getClientVersion() == "1.5.2"
|
||||||
) {
|
) {
|
||||||
echo "-1";
|
exitWithMessage("-1", getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2");
|
||||||
exit;
|
|
||||||
}
|
|
||||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
|
||||||
exitWithMessage("-1");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exitWithMessage(json_encode(["success" => false, "message" => "You must use client version 26.1 or higher to register an account in game"]));
|
exitWithMessage(json_encode(["success" => false, "message" => "You must use client version 26.1 or higher to change your username in game"]));
|
||||||
@@ -13,14 +13,16 @@ $stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
|||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
if ($result->num_rows != 1) exitWithMessage(json_encode(["success" => false, "message" => 'User info not found']));
|
if ($result->num_rows != 1) exitWithMessage(json_encode(["success" => false, "message" => 'User info not found']));
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
$user_id = $row["id"];
|
$user_id = $row["id"];
|
||||||
|
|
||||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
$stmt = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
||||||
$stmt2->bind_param("si", $token, $user_id);
|
$stmt->bind_param("si", $token, $user_id);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
if ($result2->num_rows != 1) exitWithMessage(json_encode(["success" => false, "message" => 'User info not found']));
|
if ($result2->num_rows != 1) exitWithMessage(json_encode(["success" => false, "message" => 'User info not found']));
|
||||||
$row2 = $result2->fetch_assoc();
|
$row2 = $result2->fetch_assoc();
|
||||||
|
|
||||||
@@ -29,6 +31,7 @@ $time = time();
|
|||||||
$stmt = $conn1->prepare("UPDATE userposts SET deleted_at = ? WHERE id = ? AND userId = ? AND deleted_at = 0");
|
$stmt = $conn1->prepare("UPDATE userposts SET deleted_at = ? WHERE id = ? AND userId = ? AND deleted_at = 0");
|
||||||
$stmt->bind_param("iii", $time, $targetId, $user_id);
|
$stmt->bind_param("iii", $time, $targetId, $user_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
echo encrypt(json_encode(["success" => $stmt->affected_rows > 0]));
|
echo encrypt(json_encode(["success" => $stmt->affected_rows > 0]));
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ $stmt = $conn0->prepare("SELECT id FROM users WHERE username = ? LIMIT 1");
|
|||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
if ($result->num_rows != 1) exit;
|
if ($result->num_rows != 1) exit;
|
||||||
$stmt->close();
|
|
||||||
|
|
||||||
$user_id = $row["id"];
|
$user_id = $row["id"];
|
||||||
|
|
||||||
@@ -24,8 +24,8 @@ $stmt = $conn1->prepare("SELECT 1 FROM userdata WHERE token = ? AND id = ? LIMIT
|
|||||||
$stmt->bind_param("si", $token, $user_id);
|
$stmt->bind_param("si", $token, $user_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt->get_result();
|
$result2 = $stmt->get_result();
|
||||||
if ($result2->num_rows != 1) exit;
|
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
if ($result2->num_rows != 1) exit;
|
||||||
|
|
||||||
$time = time();
|
$time = time();
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ $stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
|||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
if (!$row) exit;
|
if (!$row) exit;
|
||||||
$stmt->close();
|
|
||||||
|
|
||||||
$user_id = $row["id"];
|
$user_id = $row["id"];
|
||||||
|
|
||||||
@@ -27,9 +27,9 @@ $stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
|||||||
$stmt2->bind_param("si", $token, $user_id);
|
$stmt2->bind_param("si", $token, $user_id);
|
||||||
$stmt2->execute();
|
$stmt2->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt2->get_result();
|
||||||
|
$stmt->close();
|
||||||
$row2 = $result2->fetch_assoc();
|
$row2 = $result2->fetch_assoc();
|
||||||
if (!$row2) exit;
|
if (!$row2) exit;
|
||||||
$stmt2->close();
|
|
||||||
|
|
||||||
$content = base64_encode($content);
|
$content = base64_encode($content);
|
||||||
|
|
||||||
|
|||||||
@@ -12,14 +12,16 @@ $stmt = $conn0->prepare("SELECT username, id FROM users WHERE id = ?");
|
|||||||
$stmt->bind_param("i", $uesrId);
|
$stmt->bind_param("i", $uesrId);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
|
|
||||||
$stmt2 = $conn1->prepare("SELECT save_data FROM userdata WHERE id = ?");
|
$stmt = $conn1->prepare("SELECT save_data FROM userdata WHERE id = ?");
|
||||||
$stmt2->bind_param("i", $row['id']);
|
$stmt->bind_param("i", $row['id']);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
$row2 = $result2->fetch_assoc();
|
$row2 = $result2->fetch_assoc();
|
||||||
|
|
||||||
$savedata = json_decode($row2['save_data'], true);
|
$savedata = json_decode($row2['save_data'], true);
|
||||||
@@ -55,6 +57,5 @@ if ($result->num_rows > 0) {
|
|||||||
echo encrypt(json_encode(["success" => false]));
|
echo encrypt(json_encode(["success" => false]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->close();
|
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
$conn1->close();
|
$conn1->close();
|
||||||
@@ -15,6 +15,7 @@ $stmt = $conn->prepare("
|
|||||||
$stmt->bind_param("i", $targetId);
|
$stmt->bind_param("i", $targetId);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
echo encrypt(json_encode(array_map(
|
echo encrypt(json_encode(array_map(
|
||||||
function ($row) {
|
function ($row) {
|
||||||
|
|||||||
@@ -16,25 +16,26 @@ $stmt = $conn1->prepare("
|
|||||||
LIMIT 50
|
LIMIT 50
|
||||||
");
|
");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
$rows = $result->fetch_all(MYSQLI_ASSOC);
|
$stmt->close();
|
||||||
|
|
||||||
$mapped = [];
|
$mapped = [];
|
||||||
$icons = [];
|
$icons = [];
|
||||||
foreach ($rows as $row) {
|
foreach ($result->fetch_all(mode: MYSQLI_ASSOC) as $row) {
|
||||||
$userId = $row["userId"];
|
$userId = $row["userId"];
|
||||||
$stmt2 = $conn1->prepare("SELECT legacy_high_score, save_data FROM userdata WHERE id = ? LIMIT 1");
|
$stmt = $conn1->prepare("SELECT legacy_high_score, save_data FROM userdata WHERE id = ? LIMIT 1");
|
||||||
$stmt2->bind_param("i", $userId);
|
$stmt->bind_param("i", $userId);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
if ($result2->num_rows != 1) continue;
|
if ($result2->num_rows != 1) continue;
|
||||||
$row2 = $result2->fetch_assoc();
|
$row2 = $result2->fetch_assoc();
|
||||||
|
|
||||||
$stmt3 = $conn0->prepare("SELECT username FROM users WHERE id = ? LIMIT 1");
|
$stmt = $conn0->prepare("SELECT username FROM users WHERE id = ? LIMIT 1");
|
||||||
$stmt3->bind_param("i", $userId);
|
$stmt->bind_param("i", $userId);
|
||||||
$stmt3->execute();
|
$stmt->execute();
|
||||||
$result3 = $stmt3->get_result();
|
$result3 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
if ($result3->num_rows != 1) continue;
|
if ($result3->num_rows != 1) continue;
|
||||||
$row3 = $result3->fetch_assoc();
|
$row3 = $result3->fetch_assoc();
|
||||||
|
|
||||||
@@ -47,9 +48,9 @@ foreach ($rows as $row) {
|
|||||||
$stmt->bind_param("s", $customIcon);
|
$stmt->bind_param("s", $customIcon);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
$rowData = $result->fetch_assoc();
|
$rowData = $result->fetch_assoc();
|
||||||
if ($rowData) {
|
if ($rowData) {
|
||||||
$stmt->close();
|
|
||||||
$icons[$customIcon] = $rowData["data"];
|
$icons[$customIcon] = $rowData["data"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,11 +70,7 @@ foreach ($rows as $row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (getClientVersion() == "1.6") {
|
echo encrypt(json_encode(getClientVersion() == "1.6" ? $mapped : ["messages" => array_reverse($mapped), "customIcons" => $icons == [] ? new stdClass() : $icons]));
|
||||||
echo encrypt(json_encode($mapped));
|
|
||||||
} else {
|
|
||||||
echo encrypt(json_encode(["messages" => array_reverse($mapped), "customIcons" => $icons == [] ? new stdClass() : $icons]));
|
|
||||||
}
|
|
||||||
|
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
$conn1->close();
|
$conn1->close();
|
||||||
@@ -69,22 +69,20 @@ $sql = "
|
|||||||
";
|
";
|
||||||
|
|
||||||
$stmt = $conn1->prepare($sql);
|
$stmt = $conn1->prepare($sql);
|
||||||
|
if (!empty($params)) $stmt->bind_param($types, ...$params);
|
||||||
if (!empty($params)) {
|
|
||||||
$stmt->bind_param($types, ...$params);
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
echo encrypt(json_encode(array_map(
|
echo encrypt(json_encode(array_map(
|
||||||
function ($row) {
|
function ($row) {
|
||||||
global $conn0;
|
global $conn0;
|
||||||
|
|
||||||
$stmt2 = $conn0->prepare("SELECT username FROM users WHERE id = ?");
|
$stmt = $conn0->prepare("SELECT username FROM users WHERE id = ?");
|
||||||
$stmt2->bind_param("i", $row['userId']);
|
$stmt->bind_param("i", $row['userId']);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
$row2 = $result2->fetch_assoc();
|
$row2 = $result2->fetch_assoc();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -38,26 +38,22 @@ if ($request_type === "0") {
|
|||||||
|
|
||||||
$stmt = $conn0->prepare("SELECT username, id FROM users WHERE leaderboards_banned = 0");
|
$stmt = $conn0->prepare("SELECT username, id FROM users WHERE leaderboards_banned = 0");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
$rows = $result->fetch_all(MYSQLI_ASSOC);
|
$stmt->close();
|
||||||
|
|
||||||
$mapped = [];
|
$mapped = [];
|
||||||
$icons = [];
|
$icons = [];
|
||||||
foreach ($rows as $row) {
|
foreach ($result->fetch_all(mode: MYSQLI_ASSOC) as $row) {
|
||||||
$id = $row["id"];
|
$id = $row["id"];
|
||||||
$stmt2 = $conn1->prepare("SELECT legacy_high_score, save_data FROM userdata WHERE id = ? LIMIT 1");
|
$stmt = $conn1->prepare("SELECT legacy_high_score, save_data FROM userdata WHERE id = ? LIMIT 1");
|
||||||
$stmt2->bind_param("i", $id);
|
$stmt->bind_param("i", $id);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$ $stmt->close();
|
||||||
|
if ($result2->num_rows != 1) continue;
|
||||||
|
$row2 = $result2->fetch_assoc();
|
||||||
|
|
||||||
if ($result2->num_rows != 1) {
|
$savedata = json_decode($row2['save_data'], true);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$user2 = $result2->fetch_assoc();
|
|
||||||
|
|
||||||
$savedata = json_decode($user2['save_data'], true);
|
|
||||||
if (!$savedata) continue;
|
if (!$savedata) continue;
|
||||||
|
|
||||||
if ($request_type == "4") {
|
if ($request_type == "4") {
|
||||||
@@ -65,7 +61,7 @@ foreach ($rows as $row) {
|
|||||||
$value = 0;
|
$value = 0;
|
||||||
foreach ($berries as $b) $value += (int)($savedata['gameStore'][$b] ?? 0);
|
foreach ($berries as $b) $value += (int)($savedata['gameStore'][$b] ?? 0);
|
||||||
} else {
|
} else {
|
||||||
$value = $request_type != 2 ? $request_type != 3 ? ($savedata['gameStore'][$request_value] ?? 0) : ($user2['legacy_high_score'] ?? 0) : ($savedata['bird']['customIcon']['balance'] ?? 0);
|
$value = $request_type != 2 ? $request_type != 3 ? ($savedata['gameStore'][$request_value] ?? 0) : ($row2['legacy_high_score'] ?? 0) : ($savedata['bird']['customIcon']['balance'] ?? 0);
|
||||||
}
|
}
|
||||||
if ($value <= 0) continue;
|
if ($value <= 0) continue;
|
||||||
|
|
||||||
@@ -76,9 +72,9 @@ foreach ($rows as $row) {
|
|||||||
$stmt->bind_param("s", $customIcon);
|
$stmt->bind_param("s", $customIcon);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
$rowData = $result->fetch_assoc();
|
$rowData = $result->fetch_assoc();
|
||||||
if ($rowData) {
|
if ($rowData) {
|
||||||
$stmt->close();
|
|
||||||
$icons[$customIcon] = $rowData["data"];
|
$icons[$customIcon] = $rowData["data"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
require __DIR__ . '/../../incl/util.php';
|
|
||||||
setJsonHeader();
|
|
||||||
$conn = newConnection();
|
|
||||||
|
|
||||||
$stmt = $conn->prepare("SELECT * FROM launcherversions WHERE hidden = 0 ORDER BY id DESC");
|
|
||||||
$stmt->execute();
|
|
||||||
|
|
||||||
$result_versions = $stmt->get_result();
|
|
||||||
$versions = array_map(fn($row) => ['id' => $row['id'], 'version' => $row['version'], 'releaseDate' => $row['releaseDate'], 'displayName' => empty($row['displayName']) ? $row['version'] : $row['displayName'], 'platforms' => json_decode($row['platforms']), 'downloadUrls' => json_decode($row['downloadUrls']), 'executables' => json_decode($row['executables']), 'category' => $row['category']], $result_versions->fetch_all(MYSQLI_ASSOC));
|
|
||||||
|
|
||||||
echo json_encode($versions);
|
|
||||||
|
|
||||||
$conn->close();
|
|
||||||
@@ -24,6 +24,7 @@ $stmt = $conn0->prepare("SELECT id, username FROM users WHERE username = ?");
|
|||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result->num_rows != 1) {
|
if ($result->num_rows != 1) {
|
||||||
echo encrypt(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
echo encrypt(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
||||||
@@ -35,10 +36,11 @@ if ($result->num_rows != 1) {
|
|||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
$id = $row["id"];
|
$id = $row["id"];
|
||||||
|
|
||||||
$stmt2 = $conn1->prepare("SELECT save_data, token FROM userdata WHERE id = ? AND token = ?");
|
$stmt = $conn1->prepare("SELECT save_data, token FROM userdata WHERE id = ? AND token = ?");
|
||||||
$stmt2->bind_param("is", $id, $token);
|
$stmt->bind_param("is", $id, $token);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result2->num_rows != 1) {
|
if ($result2->num_rows != 1) {
|
||||||
echo encrypt(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
echo encrypt(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
||||||
|
|||||||
@@ -31,44 +31,36 @@ $stmt = $conn0->prepare("SELECT id, username, password FROM users WHERE username
|
|||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result->num_rows != 1) {
|
if ($result->num_rows != 1) exitWithMessage(json_encode(["success" => false, "message" => "Invalid username or password"]));
|
||||||
exitWithMessage(json_encode(["success" => false, "message" => "Invalid username or password"]));
|
$row = $result->fetch_assoc();
|
||||||
}
|
if (!password_verify($password, $row["password"])) exitWithMessage(json_encode(["success" => false, "message" => "Invalid username or password"]));
|
||||||
|
|
||||||
$user = $result->fetch_assoc();
|
$id = $row['id'];
|
||||||
|
|
||||||
if (!password_verify($password, $user["password"])) {
|
$stmt = $conn1->prepare("SELECT token FROM userdata WHERE id = ?");
|
||||||
exitWithMessage(json_encode(["success" => false, "message" => "Invalid username or password"]));
|
$stmt->bind_param("i", $id);
|
||||||
}
|
$stmt->execute();
|
||||||
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
if ($result2->num_rows != 1) exitWithMessage(json_encode(["success" => false, "message" => "Invalid username or password"]));
|
||||||
|
|
||||||
$id = $user['id'];
|
$token = $result2->fetch_assoc()['token'];
|
||||||
|
|
||||||
$stmt2 = $conn1->prepare("SELECT token FROM userdata WHERE id = ?");
|
|
||||||
$stmt2->bind_param("i", $id);
|
|
||||||
$stmt2->execute();
|
|
||||||
$result2 = $stmt2->get_result();
|
|
||||||
|
|
||||||
if ($result2->num_rows != 1) {
|
|
||||||
exitWithMessage(json_encode(["success" => false, "message" => "Invalid username or password"]));
|
|
||||||
}
|
|
||||||
|
|
||||||
$user2 = $result2->fetch_assoc();
|
|
||||||
|
|
||||||
$token = $user2['token'];
|
|
||||||
$ip = getIPAddress();
|
$ip = getIPAddress();
|
||||||
|
|
||||||
$stmt = $conn0->prepare("UPDATE users SET latest_ip = ? WHERE id = ?");
|
$stmt = $conn0->prepare("UPDATE users SET latest_ip = ? WHERE id = ?");
|
||||||
$stmt->bind_param("si", $ip, $id);
|
$stmt->bind_param("si", $ip, $id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt2 = $conn1->prepare("UPDATE userdata SET token = ? WHERE id = ?");
|
$stmt->close();
|
||||||
$stmt2->bind_param("si", $token, $id);
|
$stmt = $conn1->prepare("UPDATE userdata SET token = ? WHERE id = ?");
|
||||||
$stmt2->execute();
|
$stmt->bind_param("si", $token, $id);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
$data = ["session" => $token, "username" => $user['username'], "userid" => $id];
|
$data = ["session" => $token, "username" => $row['username'], "userid" => $id];
|
||||||
|
|
||||||
echo encrypt(json_encode(["success" => true, "data" => $data]));
|
echo encrypt(json_encode(["success" => true, "data" => $data]));
|
||||||
|
|
||||||
$stmt->close();
|
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
$conn1->close();
|
$conn1->close();
|
||||||
@@ -11,14 +11,12 @@ if (
|
|||||||
getClientVersion() == "1.33" ||
|
getClientVersion() == "1.33" ||
|
||||||
getClientVersion() == "1.4.0-beta1" ||
|
getClientVersion() == "1.4.0-beta1" ||
|
||||||
getClientVersion() == "1.4.0" ||
|
getClientVersion() == "1.4.0" ||
|
||||||
getClientVersion() == "1.4.1"
|
getClientVersion() == "1.4.1" ||
|
||||||
|
getClientVersion() == "1.5.0" ||
|
||||||
|
getClientVersion() == "1.5.1" ||
|
||||||
|
getClientVersion() == "1.5.2"
|
||||||
) {
|
) {
|
||||||
echo "-1";
|
exitWithMessage("-1", getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2");
|
||||||
exit;
|
|
||||||
}
|
|
||||||
if (getClientVersion() == "1.5.0" || getClientVersion() == "1.5.1" || getClientVersion() == "1.5.2") {
|
|
||||||
exitWithMessage("-1");
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exitWithMessage(json_encode(["success" => false, "message" => "You must use client version 26.1 or higher to register an account in game"]));
|
exitWithMessage(json_encode(["success" => false, "message" => "You must use client version 26.1 or higher to register an account in game"]));
|
||||||
@@ -53,6 +53,7 @@ $reason = base64_encode($reason);
|
|||||||
$stmt = $conn1->prepare("INSERT INTO chatroom_reports (chatid, userId, reason, timestamp) VALUES (?, ?, ?, ?)");
|
$stmt = $conn1->prepare("INSERT INTO chatroom_reports (chatid, userId, reason, timestamp) VALUES (?, ?, ?, ?)");
|
||||||
$stmt->bind_param("iisi", $id, $user_id, $reason, $time);
|
$stmt->bind_param("iisi", $id, $user_id, $reason, $time);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
$conn1->close();
|
$conn1->close();
|
||||||
@@ -44,6 +44,7 @@ $stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
|||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result->num_rows != 1) {
|
if ($result->num_rows != 1) {
|
||||||
echo encrypt(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
echo encrypt(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
||||||
@@ -59,6 +60,7 @@ $stmt = $conn1->prepare("SELECT id FROM userdata WHERE token = ? AND id = ?");
|
|||||||
$stmt->bind_param("si", $token, $id);
|
$stmt->bind_param("si", $token, $id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
if ($result->num_rows != 1) {
|
if ($result->num_rows != 1) {
|
||||||
echo encrypt(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
echo encrypt(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
||||||
@@ -67,10 +69,10 @@ if ($result->num_rows != 1) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$updateStmt = $conn1->prepare("UPDATE userdata SET save_data = ? WHERE token = ? AND id = ?");
|
$stmt = $conn1->prepare("UPDATE userdata SET save_data = ? WHERE token = ? AND id = ?");
|
||||||
$updateStmt->bind_param("ssi", $savedata, $token, $id);
|
$stmt->bind_param("ssi", $savedata, $token, $id);
|
||||||
$updateStmt->execute();
|
$stmt->execute();
|
||||||
$updateStmt->close();
|
$stmt->close();
|
||||||
echo encrypt(json_encode(["success" => true]));
|
echo encrypt(json_encode(["success" => true]));
|
||||||
|
|
||||||
$conn0->close();
|
$conn0->close();
|
||||||
|
|||||||
@@ -22,19 +22,19 @@ $stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
|||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
if (!$row) exitWithMessage(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
if (!$row) exitWithMessage(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
||||||
$stmt->close();
|
|
||||||
|
|
||||||
$id = $row["id"];
|
$id = $row["id"];
|
||||||
|
|
||||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE id = ? AND token = ?");
|
$stmt = $conn1->prepare("SELECT * FROM userdata WHERE id = ? AND token = ?");
|
||||||
$stmt2->bind_param("is", $id, $token);
|
$stmt->bind_param("is", $id, $token);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
$row2 = $result2->fetch_assoc();
|
$row2 = $result2->fetch_assoc();
|
||||||
if (!$row2) exitWithMessage(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
if (!$row2) exitWithMessage(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
||||||
$stmt2->close();
|
|
||||||
|
|
||||||
$content = base64_encode($request_content);
|
$content = base64_encode($request_content);
|
||||||
$time = time();
|
$time = time();
|
||||||
|
|||||||
@@ -18,14 +18,16 @@ $stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
|||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
if ($result->num_rows != 1) exitWithMessage(json_encode(["success" => false]));
|
if ($result->num_rows != 1) exitWithMessage(json_encode(["success" => false]));
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
$id = $row["id"];
|
$id = $row["id"];
|
||||||
|
|
||||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
$stmt = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
||||||
$stmt2->bind_param("si", $token, $id);
|
$stmt->bind_param("si", $token, $id);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
if ($result2->num_rows != 1) exitWithMessage(json_encode(["success" => false]));
|
if ($result2->num_rows != 1) exitWithMessage(json_encode(["success" => false]));
|
||||||
$row2 = $result2->fetch_assoc();
|
$row2 = $result2->fetch_assoc();
|
||||||
|
|
||||||
|
|||||||
@@ -28,18 +28,18 @@ $stmt = $conn0->prepare("SELECT * FROM users WHERE username = ?");
|
|||||||
$stmt->bind_param("s", $username);
|
$stmt->bind_param("s", $username);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
if (!$row) exitWithMessage(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
if (!$row) exitWithMessage(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
||||||
$stmt->close();
|
|
||||||
$id = $row["id"];
|
$id = $row["id"];
|
||||||
|
|
||||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
$stmt = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
||||||
$stmt2->bind_param("si", $token, $id);
|
$stmt->bind_param("si", $token, $id);
|
||||||
$stmt2->execute();
|
$stmt->execute();
|
||||||
$result2 = $stmt2->get_result();
|
$result2 = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
$row2 = $result2->fetch_assoc();
|
$row2 = $result2->fetch_assoc();
|
||||||
if (!$row2) exitWithMessage(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
if (!$row2) exitWithMessage(json_encode(["success" => false, "message" => "Invalid session token or username, please refresh login"]));
|
||||||
$stmt2->close();
|
|
||||||
|
|
||||||
$time = time();
|
$time = time();
|
||||||
$hash = hash('sha512', base64_decode($filecontent));
|
$hash = hash('sha512', base64_decode($filecontent));
|
||||||
@@ -48,19 +48,18 @@ $stmt = $conn1->prepare("SELECT id FROM marketplaceicons WHERE hash = ?");
|
|||||||
$stmt->bind_param("s", $hash);
|
$stmt->bind_param("s", $hash);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
|
$stmt->close();
|
||||||
if ($result->fetch_assoc()) {
|
if ($result->fetch_assoc()) {
|
||||||
$stmt->close();
|
|
||||||
exitWithMessage(json_encode(["success" => false, "message" => "This icon already exists in the marketplace"]));
|
exitWithMessage(json_encode(["success" => false, "message" => "This icon already exists in the marketplace"]));
|
||||||
}
|
}
|
||||||
$stmt->close();
|
|
||||||
|
|
||||||
$uuid = uuidv4();
|
$uuid = uuidv4();
|
||||||
|
|
||||||
$stmt = $conn1->prepare("INSERT INTO marketplaceicons (uuid, userId, data, hash, price, name, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?)");
|
$stmt = $conn1->prepare("INSERT INTO marketplaceicons (uuid, userId, data, hash, price, name, timestamp) VALUES (?, ?, ?, ?, ?, ?, ?)");
|
||||||
$stmt->bind_param("sissisi", $uuid, $id, $filecontent, $hash, $price, $name, $time);
|
$stmt->bind_param("sissisi", $uuid, $id, $filecontent, $hash, $price, $name, $time);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$insertId = $conn1->insert_id;
|
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
$insertId = $conn1->insert_id;
|
||||||
|
|
||||||
echo encrypt(json_encode(["success" => true, "message" => "Icon uploaded successfully! It will be reviewed and accepted or denied soon"]));
|
echo encrypt(json_encode(["success" => true, "message" => "Icon uploaded successfully! It will be reviewed and accepted or denied soon"]));
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ function setPlainHeader() {
|
|||||||
header("Content-Type: text/plain");
|
header("Content-Type: text/plain");
|
||||||
}
|
}
|
||||||
|
|
||||||
function setJsonHeader() {
|
|
||||||
header("Content-Type: application/json");
|
|
||||||
}
|
|
||||||
|
|
||||||
function getIPAddress() {
|
function getIPAddress() {
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
return $_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user