prepare('SELECT Membership FROM users WHERE UserId = :userId LIMIT 1'); $stmt->bindParam(':userId', $userId, PDO::PARAM_INT); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); $membership = isset($row['Membership']) ? (int)$row['Membership'] : 0; } else { $membership = 0; } $isAdmin = 0; if (isset($_COOKIE['_ROBLOSECURITY'])) { $userInfo = getuserinfo($_COOKIE['_ROBLOSECURITY']); $currentPage = basename($_SERVER['PHP_SELF']); } $filter_forum_id = isset($_GET['ForumID']) ? (int)$_GET['ForumID'] : null; $posts_per_page = 20; $page = isset($_GET['page']) ? max(1, (int)$_GET['page']) : 1; $offset = ($page - 1) * $posts_per_page; $search_query = isset($_GET['search']) ? trim($_GET['search']) : ''; $count_sql = "SELECT COUNT(*) FROM forums"; $count_conditions = []; $params = []; if ($filter_forum_id !== null) { $count_conditions[] = "ForumId = :forumId"; $params[':forumId'] = $filter_forum_id; } if ($search_query !== '') { $count_conditions[] = "Subject LIKE :search"; $params[':search'] = "%$search_query%"; } if ($count_conditions) { $count_sql .= " WHERE " . implode(" AND ", $count_conditions); } $count_stmt = $pdo->prepare($count_sql); $count_stmt->execute($params); $total_posts = $count_stmt->fetchColumn(); $total_pages = ceil($total_posts / $posts_per_page); $sql = "SELECT f.id AS post_id, f.isPinned, f.Subject, f.UserId, f.Views, f.PostedAt, f.ForumId, u.Username FROM forums AS f LEFT JOIN users AS u ON f.UserId = u.UserId"; $conditions = []; $params = []; if ($filter_forum_id !== null) { $conditions[] = "f.ForumId = :forumId"; $params[':forumId'] = $filter_forum_id; } if ($search_query !== '') { $conditions[] = "f.Subject LIKE :search"; $params[':search'] = "%$search_query%"; } if ($conditions) { $sql .= " WHERE " . implode(" AND ", $conditions); } $sql .= " ORDER BY f.isPinned DESC, f.PostedAt DESC LIMIT :limit OFFSET :offset"; $stmt = $pdo->prepare($sql); foreach ($params as $key => $val) { $stmt->bindValue($key, $val); } $stmt->bindValue(':limit', $posts_per_page, PDO::PARAM_INT); $stmt->bindValue(':offset', $offset, PDO::PARAM_INT); $stmt->execute(); $posts = $stmt->fetchAll(PDO::FETCH_ASSOC); $forumGroups = [ 1 => [ 46 => 'All Things Afterworld', 14 => 'Help (Technical Support and Account Issues)', 21 => 'Suggestions & Ideas', 54 => 'Game Nights & Afterworld events', ], 2 => [ 13 => 'Afterworld Talk', 18 => 'Off Topic', 32 => 'Clans & Guilds', 35 => "Let's Make a Deal", ], 9 => [ 62 => 'Game Marketing', 40 => 'Game Design', 33 => 'Scripters', ], 6 => [ 42 => 'Video Game Central', 52 => 'Video Creation with Afterworld', 26 => 'Ro-Sports', 24 => 'Pop-Culture (Music/Books/Movies/TV)', 23 => 'Role-Playing', ], ]; ?> Afterworld - Forum