Finish profiles
This commit is contained in:
52
database/getAccountProfile.php
Normal file
52
database/getAccountProfile.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
require __DIR__ . '/../incl/util.php';
|
||||
setPlainHeader();
|
||||
checkClientDatabaseVersion();
|
||||
|
||||
$post = getPostData();
|
||||
$uesrId = $post['uesrId'] ?? '';
|
||||
|
||||
$conn = newConnection();
|
||||
|
||||
$stmt = $conn->prepare("SELECT * FROM users WHERE id = ?");
|
||||
$stmt->bind_param("i", $uesrId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
$row = $result->fetch_assoc();
|
||||
$savedata = json_decode($row['save_data'], true);
|
||||
$custom = null;
|
||||
if (isset($savedata['bird']['customIcon']['selected'])) {
|
||||
$selected = $savedata['bird']['customIcon']['selected'];
|
||||
foreach ($savedata['bird']['customIcon']['data'] as $entry) {
|
||||
if (isset($entry['uuid']) && $entry['uuid'] === $selected) {
|
||||
$custom = $entry['data'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo encrypt(json_encode([
|
||||
"success" => true,
|
||||
"totalNormalBerries" => $savedata['gameStore']['totalNormalBerries'] ?? 0,
|
||||
"totalPoisonBerries" => $savedata['gameStore']['totalPoisonBerries'] ?? 0,
|
||||
"totalSlowBerries" => $savedata['gameStore']['totalSlowBerries'] ?? 0,
|
||||
"totalUltraBerries" => $savedata['gameStore']['totalUltraBerries'] ?? 0,
|
||||
"totalSpeedyBerries" => $savedata['gameStore']['totalSpeedyBerries'] ?? 0,
|
||||
"totalCoinBerries" => $savedata['gameStore']['totalCoinBerries'] ?? 0,
|
||||
"totalRandomBerries" => $savedata['gameStore']['totalRandomBerries'] ?? 0,
|
||||
"totalAntiBerries" => $savedata['gameStore']['totalAntiBerries'] ?? 0,
|
||||
"coins" => $savedata['bird']['customIcon']['balance'] ?? 0,
|
||||
"name" => $row['username'],
|
||||
"icon" => $savedata['bird']['icon'] ?? 1,
|
||||
"overlay" => $savedata['bird']['overlay'] ?? 0,
|
||||
"customIcon" => $custom,
|
||||
"playerIconColor" => $savedata['settings']['colors']['icon'] ?? [255,255,255],
|
||||
"playerOverlayColor" => $savedata['settings']['colors']['overlay'] ?? [255,255,255]
|
||||
]));
|
||||
} else {
|
||||
echo encrypt(json_encode(["success" => false]));
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
$conn->close();
|
||||
@@ -11,9 +11,10 @@ $stmt = $conn->prepare("
|
||||
SELECT p.id, p.content, p.timestamp, p.likes, u.id as userId
|
||||
FROM userposts p
|
||||
JOIN users u ON p.userId = u.id
|
||||
WHERE u.banned = 0 AND p.deleted_at = 0
|
||||
WHERE u.id = ? AND p.deleted_at = 0
|
||||
ORDER BY p.id DESC
|
||||
");
|
||||
$stmt->bind_param("i", $targetId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user