prepare($sql);
$stmt->execute([$userId, $userId, $userId]);
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (!$rows) {
return [];
}
$friendIds = array_column($rows, 'friend_id');
$placeholders = implode(',', array_fill(0, count($friendIds), '?'));
$sql2 = "SELECT UserId, Username, status, InGameId FROM users WHERE UserId IN ($placeholders)";
$stmt2 = $pdo->prepare($sql2);
$stmt2->execute($friendIds);
$userData = [];
while ($row = $stmt2->fetch(PDO::FETCH_ASSOC)) {
$userData[(int)$row['UserId']] = $row;
}
foreach ($rows as &$r) {
$fid = (int)$r['friend_id'];
$u = $userData[$fid] ?? ['Username' => 'Unknown', 'status' => 0, 'InGameId' => null];
$r['username'] = $u['Username'];
$r['status'] = (int)$u['status'];
$r['InGameId'] = $u['InGameId'];
}
usort($rows, function ($a, $b) {
$weight = [1 => 0, 2 => 1, 3 => 2, 0 => 3];
return $weight[$a['status']] <=> $weight[$b['status']];
});
return $rows;
}
function countFriends(PDO $pdo, int $userId): int
{
$c = $pdo->prepare('SELECT COUNT(*) FROM friends WHERE (from_id = ? OR to_id = ?) AND type IN (1, 2)');
$c->execute([$userId, $userId]);
return (int)$c->fetchColumn();
}
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$userId = currentUserId();
$friends = $userId ? fetchFriends($pdo, $userId, 9) : [];
$friendCt = $userId ? countFriends($pdo, $userId) : 0;
?>
No friends yet.
';
break;
case 2:
$statusHtml = '';
break;
case 3:
$statusHtml = '';
break;
default:
$statusHtml = '';
}
?>
-
= $name ?>
= $statusHtml ?>
prepare("SELECT * FROM assets WHERE AssetType = 9 AND isSubPlace = 0 AND isPrivate = 0 AND Name LIKE :keyword LIMIT :startRow,:maxRows");
$Keyword = "%$Keyword%";
$stmt->bindParam(':keyword', $Keyword, PDO::PARAM_STR);
$stmt->bindParam(":startRow", $StartRows, PDO::PARAM_INT);
$stmt->bindParam(":maxRows", $MaxRows, PDO::PARAM_INT);
$stmt->execute();
} else {
switch ($SortFilter)
{
case 0:
$stmt = $pdo->prepare("SELECT * FROM assets WHERE AssetType = 9 AND isSubPlace = 0 AND isPrivate = 0 ORDER BY Visits DESC LIMIT :startRow,:maxRows");
break;
case 1:
default:
$stmt = $pdo->prepare("SELECT * FROM assets WHERE AssetType = 9 AND isSubPlace = 0 AND isPrivate = 0 ORDER BY players DESC LIMIT :startRow,:maxRows");
break;
}
$stmt->bindParam(":startRow", $StartRows, PDO::PARAM_INT);
$stmt->bindParam(":maxRows", $MaxRows, PDO::PARAM_INT);
$stmt->execute();
}
$count = 0;
foreach($stmt as $game) {
if ($count >= 10) break;
if (!$game['isSubPlace']) {
$stmtUser = $pdo->prepare('SELECT * FROM users where UserId = :uid');
$stmtUser->execute(['uid' => $game['CreatorID']]);
$user = $stmtUser->fetch(PDO::FETCH_ASSOC);
echo '-
'.htmlspecialchars($game['Name']).'
'.intval($game['players']).' Online - '.$game['ClientYear'].'
';
$count++;
}
}
?>
$query, 'variables' => ['host' => $blogHost, 'first' => 2]]);
$ch = curl_init($endpoint);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Accept: application/json'], CURLOPT_POST => true, CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException('curl error: ' . curl_error($ch));
}
curl_close($ch);
$data = json_decode($response, true);
if (isset($data['errors'])) {
throw new RuntimeException('hashnode error: ' . $data['errors'][0]['message']);
}
$edges = $data['data']['publication']['posts']['edges'] ?? [];
?>
Link your ROBLOX account with your Facebook account to let your Facebook friends see what you're doing on ROBLOX!
prepare("SELECT feeds.id, feeds.pid, feeds.content, feeds.postedAt, feeds.isGroup, users.username FROM feeds LEFT JOIN users ON feeds.pid = users.UserId ORDER BY feeds.id DESC LIMIT 6");
$stmt->execute();
$feeds = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($feeds as $feed) {
$pid = (int)$feed['pid'];
$username = htmlspecialchars($feed['username'] ?? 'Unknown');
$safeContent = nl2br(htmlspecialchars($feed['content']));
$isGroup = $feed['isGroup'];
$timestamp = date('n/j/Y \a\t g:i A', $feed['postedAt']);
$profileUrl = $isGroup ? "/My/Groups.aspx?gid=" . urlencode($pid) : "/User.aspx?id=" . urlencode($pid);
$thumbSrc = "/Thumbs/Avatar.ashx?userId=$pid";
$feedId = (int)$feed['id'];
echo <<
$username
"$safeContent"
$timestamp
HTML;
}
?>