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_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->execute();
|
||||
|
||||
$result = $stmt->get_result();
|
||||
$stmt->close();
|
||||
|
||||
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'];
|
||||
$row = $result->fetch_assoc();
|
||||
if (password_verify($request_password, $row['password'])) {
|
||||
$login_ip = getIPAddress();
|
||||
$login_time = time();
|
||||
$uid = $row['id'];
|
||||
|
||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE id = ?");
|
||||
$stmt2->bind_param("i", $uid);
|
||||
$stmt2->execute();
|
||||
$result2 = $stmt2->get_result();
|
||||
$stmt = $conn1->prepare("SELECT token, legacy_high_score, save_data FROM userdata WHERE id = ? LIMIT 1");
|
||||
$stmt->bind_param("i", $uid);
|
||||
$stmt->execute();
|
||||
$result2 = $stmt->get_result();
|
||||
$stmt->close();
|
||||
if ($result2->num_rows != 1) exitWithMessage("-1", false);
|
||||
$row2 = $result2->fetch_assoc();
|
||||
|
||||
if ($result2->num_rows != 1) {
|
||||
echo '-1';
|
||||
exit;
|
||||
}
|
||||
$username = $row['username'];
|
||||
$highscore = $row2['legacy_high_score'];
|
||||
$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'];
|
||||
$highscore = $user2['legacy_high_score'];
|
||||
$token = $user2['token'];
|
||||
$savedata = json_decode($user2['save_data'], true);
|
||||
$icon = $savedata['bird']['icon'] ?? 1;
|
||||
$overlay = $savedata['bird']['overlay'] ?? 0;
|
||||
|
||||
$stmt = $conn0->prepare("UPDATE users SET latest_ip = ? WHERE id = ?");
|
||||
$stmt->bind_param("si", $login_ip, $uid);
|
||||
$stmt->execute();
|
||||
|
||||
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");
|
||||
}
|
||||
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 {
|
||||
$conn0->close();
|
||||
$conn1->close();
|
||||
exitWithMessage("-2", false);
|
||||
}
|
||||
} else {
|
||||
$stmt->close();
|
||||
$conn0->close();
|
||||
$conn1->close();
|
||||
exit("-2");
|
||||
exitWithMessage("-2", false);
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
$conn0->close();
|
||||
$conn1->close();
|
||||
@@ -2,29 +2,28 @@
|
||||
$conn0 = newConnection(0);
|
||||
$conn1 = newConnection(1);
|
||||
|
||||
$request_uid = $_POST['userID'] ?? 0;
|
||||
$request_session = $_POST['gameSession'] ?? '';
|
||||
$request_score = $_POST['highScore'] ?? 0;
|
||||
$user_id = $_POST['userID'] ?? 0;
|
||||
$token = $_POST['gameSession'] ?? '';
|
||||
$high_score = $_POST['highScore'] ?? 0;
|
||||
|
||||
$stmt = $conn0->prepare("SELECT * FROM users WHERE id = ?");
|
||||
$stmt->bind_param("s", $request_uid);
|
||||
$stmt->bind_param("s", $user_id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
if ($result->num_rows != 1) {
|
||||
echo (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") ? "-2" : "-3";
|
||||
$conn0->close();
|
||||
$conn1->close();
|
||||
exit;
|
||||
}
|
||||
$stmt->close();
|
||||
$user_id = $result->fetch_assoc()["id"];
|
||||
|
||||
$request_uid = $result->fetch_assoc()["id"];
|
||||
|
||||
$stmt2 = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
||||
$stmt2->bind_param("si", $request_session, $request_uid);
|
||||
$stmt2->execute();
|
||||
$result2 = $stmt2->get_result();
|
||||
|
||||
$stmt = $conn1->prepare("SELECT * FROM userdata WHERE token = ? AND id = ?");
|
||||
$stmt->bind_param("si", $token, $user_id);
|
||||
$stmt->execute();
|
||||
$result2 = $stmt->get_result();
|
||||
$stmt->close();
|
||||
if ($result2->num_rows != 1) {
|
||||
echo (getClientVersion() == "1.3-beta2" || getClientVersion() == "1.3" || getClientVersion() == "1.33") ? "-2" : "-3";
|
||||
$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->bind_param("isi", $request_score, $request_session, $request_uid);
|
||||
$updateStmt->bind_param("isi", $high_score, $token, $user_id);
|
||||
$updateStmt->execute();
|
||||
$updateStmt->close();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user