Sign Up

My Notes

Loading notes...

Chat with Friends

A
Alice Johnson
● Online
A
Hey! How are you doing today?
2:30 PM
I'm doing great! Thanks for asking. How about you?
2:32 PM
M
A
Pretty good! Just finished a great massage session. The new therapist is amazing!
2:35 PM
// Forum page for Colorado Discussion // Generated automatically for state: CO // Handle city parameter if present $currentCity = isset($_GET['city']) ? $_GET['city'] : null; $currentState = isset($_GET['state']) ? $_GET['state'] : 'colorado'; $category_slug = 'colorado'; // Database connection require_once '../db.php'; $db = db(); // Fetch forum statistics from database $stats = array(); if ($db) { try { if ($db instanceof PDO) { // Get topics count $stmt = $db->prepare("SELECT COUNT(*) as count FROM forum_topics WHERE category = 'colorado'"); $stmt->execute([$category_slug, $category_slug]); $topicsCount = $stmt->fetch(PDO::FETCH_ASSOC)['count']; // Get posts count (topics + replies) $stmt = $db->prepare(" SELECT (SELECT COUNT(*) FROM forum_topics WHERE category = 'colorado') + (SELECT COUNT(*) FROM forum_replies r JOIN forum_topics t ON r.topic_id = t.id WHERE t.category = 'colorado') as total_posts "); $stmt->execute(); $postsCount = $stmt->fetch(PDO::FETCH_ASSOC)['total_posts']; // Get members count $stmt = $db->prepare("SELECT COUNT(*) as count FROM mp_users"); $stmt->execute(); $membersCount = $stmt->fetch(PDO::FETCH_ASSOC)['count']; // Get latest member $stmt = $db->prepare("SELECT users_username FROM mp_users ORDER BY created_at DESC LIMIT 1"); $stmt->execute(); $latestMember = $stmt->fetch(PDO::FETCH_ASSOC)['users_username'] ?? 'No members yet'; // Get cities count (using category instead of city_name) $stmt = $db->prepare("SELECT COUNT(DISTINCT category) as cities FROM forum_topics WHERE category LIKE 'colorado%'"); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); $citiesCount = $result['cities'] ?? 0; } else { // MySQLi $result = $db->query("SELECT COUNT(*) as count FROM forum_topics WHERE category = 'colorado'"); $topicsCount = $result->fetch_assoc()['count']; $result = $db->query(" SELECT (SELECT COUNT(*) FROM forum_topics WHERE category = 'colorado') + (SELECT COUNT(*) FROM forum_replies r JOIN forum_topics t ON r.topic_id = t.id WHERE t.category = 'colorado') as total_posts "); $postsCount = $result->fetch_assoc()['total_posts']; $result = $db->query("SELECT COUNT(*) as count FROM mp_users"); $membersCount = $result->fetch_assoc()['count']; $result = $db->query("SELECT users_username FROM mp_users ORDER BY created_at DESC LIMIT 1"); $latestMember = $result->fetch_assoc()['users_username'] ?? 'No members yet'; $result = $db->query("SELECT COUNT(DISTINCT category) as cities FROM forum_topics WHERE category LIKE 'colorado%'"); if ($result) { $row = $result->fetch_assoc(); $citiesCount = $row['cities'] ?? 0; } } $stats = array( 'topics' => $topicsCount, 'posts' => $postsCount, 'members' => $membersCount, 'latest_member' => $latestMember, 'cities' => $citiesCount ); } catch (Exception $e) { // Fallback to default values if database query fails $stats = array( 'topics' => 0, 'posts' => 0, 'members' => 0, 'latest_member' => 'No data', 'cities' => 0 ); } } else { $stats = array( 'topics' => 0, 'posts' => 0, 'members' => 0, 'latest_member' => 'No data', 'cities' => 0 ); } // Fetch topics from database $topics = array(); if ($db) { try { if ($db instanceof PDO) { $stmt = $db->prepare(" SELECT t.id, t.title, t.created_at, t.views, t.vote_score, t.status, u.users_username as username, u.avatar, u.user_level, (SELECT COUNT(*) FROM forum_replies WHERE topic_id = t.id) as reply_count FROM forum_topics t LEFT JOIN mp_users u ON t.user_id = u.users_id WHERE t.category = 'colorado' ORDER BY t.created_at DESC LIMIT 20 "); $stmt->execute(); $topics = $stmt->fetchAll(PDO::FETCH_ASSOC); } else { $result = $db->query(" SELECT t.id, t.title, t.created_at, t.views, t.vote_score, t.status, u.users_username as username, u.avatar, u.user_level, (SELECT COUNT(*) FROM forum_replies WHERE topic_id = t.id) as reply_count FROM forum_topics t LEFT JOIN mp_users u ON t.user_id = u.users_id WHERE t.category = 'colorado' ORDER BY t.created_at DESC LIMIT 20 "); while ($row = $result->fetch_assoc()) { $topics[] = $row; } } } catch (Exception $e) { // Fallback to empty array if query fails $topics = array(); } } // Fetch top posters from database $topPosters = array(); if ($db) { try { if ($db instanceof PDO) { $stmt = $db->prepare(" SELECT u.users_username as username, u.user_level, (SELECT COUNT(*) FROM forum_topics WHERE user_id = u.users_id AND category = 'colorado') + (SELECT COUNT(*) FROM forum_replies rt JOIN forum_topics t ON rt.topic_id = t.id WHERE rt.user_id = u.users_id AND t.category = 'colorado') as post_count FROM mp_users u HAVING post_count > 0 ORDER BY post_count DESC LIMIT 5 "); $stmt->execute(); $topPosters = $stmt->fetchAll(PDO::FETCH_ASSOC); } else { $result = $db->query(" SELECT u.users_username as username, u.user_level, (SELECT COUNT(*) FROM forum_topics WHERE user_id = u.users_id AND category = 'colorado') + (SELECT COUNT(*) FROM forum_replies rt JOIN forum_topics t ON rt.topic_id = t.id WHERE rt.user_id = u.users_id AND t.category = 'colorado') as post_count FROM mp_users u HAVING post_count > 0 ORDER BY post_count DESC LIMIT 5 "); while ($row = $result->fetch_assoc()) { $topPosters[] = $row; } } } catch (Exception $e) { // Fallback to empty array if query fails $topPosters = array(); } } 'icon' => 'fas fa-trophy', 'color' => '#fff', 'bg_color' => '#0891b2', ), ), ), 3 => array ( 'id' => 4, 'title' => 'Controversial Discussion in Colorado', 'username' => 'debater', 'created_at' => '2024-12-12 14:20:00', 'views' => 53, 'reply_count' => 16, 'vote_score' => -4, 'status' => 'controversial', 'badges' => array ( 0 => array ( 'name' => 'Member', 'icon' => 'fas fa-user', 'color' => '#fff', 'bg_color' => '#6b7280', ), ), ), 4 => array ( 'id' => 5, 'title' => 'Legendary Post - 1000+ Votes in Colorado', 'username' => 'legend', 'created_at' => '2024-12-10 09:00:00', 'views' => 1034, 'reply_count' => 33, 'vote_score' => 947, 'status' => 'legendary', 'badges' => array ( 0 => array ( 'name' => 'Legend', 'icon' => 'fas fa-crown', 'color' => '#000', 'bg_color' => '#ffd700', ), 1 => array ( 'name' => '1000+ Votes', 'icon' => 'fas fa-star', 'color' => '#fff', 'bg_color' => '#dc2626', ), ), ), ); // Real data for top posters and stats $topPosters = array ( 0 => array ( 'username' => 'admin', 'post_count' => 100, 'badges' => array ( 0 => array ( 'name' => 'God Level', 'icon' => 'fas fa-crown', 'color' => '#000', 'bg_color' => '#ffd700', ), 1 => array ( 'name' => '500+ Posts', 'icon' => 'fas fa-fire', 'color' => '#fff', 'bg_color' => '#dc2626', ), ), ), 1 => array ( 'username' => 'moderator', 'post_count' => 150, 'badges' => array ( 0 => array ( 'name' => 'Gold', 'icon' => 'fas fa-star', 'color' => '#3b82f6', 'bg_color' => '#e0e7ff', ), ), ), ); $forumStats = array ( 'topics' => 76, 'posts' => 239, 'members' => 110, 'latest_member' => 'newuser573', ); // Available cities in Colorado $availableCities = array ( 0 => 'Denver', 1 => 'Colorado Springs', 2 => 'Aurora', 3 => 'Fort Collins', 4 => 'Boulder', ); // Filter topics by city if city parameter is present if ($currentCity) { // Convert city slug back to readable name $cityName = str_replace('-', ' ', ucwords($currentCity)); // Add city-specific topics $cityTopics = [ [ "id" => 100 + array_search($cityName, $availableCities), "title" => "Welcome to " . $cityName . " Discussion", "username" => "admin", "created_at" => "2024-12-15 10:00:00", "views" => rand(20, 50), "reply_count" => rand(2, 8), "vote_score" => rand(8, 20), "status" => "hot", "badges" => [ ["name" => "God Level", "icon" => "fas fa-crown", "color" => "#000", "bg_color" => "#ffd700"], ["name" => "500+ Posts", "icon" => "fas fa-fire", "color" => "#fff", "bg_color" => "#dc2626"] ] ], [ "id" => 200 + array_search($cityName, $availableCities), "title" => "Best Massage Places in " . $cityName, "username" => "moderator", "created_at" => "2024-12-14 15:30:00", "views" => rand(15, 40), "reply_count" => rand(1, 5), "vote_score" => rand(5, 15), "status" => "trending", "badges" => [ ["name" => "Gold", "icon" => "fas fa-star", "color" => "#3b82f6", "bg_color" => "#e0e7ff"] ] ], [ "id" => 300 + array_search($cityName, $availableCities), "title" => $cityName . " Spa Recommendations", "username" => "admin", "created_at" => "2024-12-13 09:15:00", "views" => rand(30, 60), "reply_count" => rand(0, 3), "vote_score" => rand(3, 12), "status" => "rising", "badges" => [ ["name" => "God Level", "icon" => "fas fa-crown", "color" => "#000", "bg_color" => "#ffd700"] ] ] ]; // Replace topics with city-specific ones $topics = $cityTopics; } ?>

Colorado Discussion Forum

Connect with members in Colorado and discuss local topics, providers, and experiences

Create New Topic

Recent Topics

14
Welcome to Colorado Discussion Hot
admin Dec 15, 2024 God Level 500+ Posts 100+ Reviews
45 views 8 replies
7
Best Massage Places in Denver Trending
moderator Dec 14, 2024 Gold 200+ Comments
22 views 5 replies
5
Colorado Spa Recommendations Rising
admin Dec 13, 2024 God Level Forum Master
42 views 1 replies
-4
Controversial Discussion in Colorado Controversial
debater Dec 12, 2024 Member
53 views 16 replies
947
Legendary Post - 1000+ Votes in Colorado Legendary
legend Dec 10, 2024 Legend 1000+ Votes
1034 views 33 replies
Forum Statistics
Topics
Posts
Members