connect_error) { throw new Exception("Database connection failed: " . $conn->connect_error); } // Set charset to ensure proper encoding $conn->set_charset("utf8mb4"); } catch (Exception $e) { // Log the error securely error_log($e->getMessage()); // Display user-friendly message die("We're experiencing technical difficulties. Please try again later."); } // Function to sanitize output function sanitizeOutput($data) { return htmlspecialchars($data ?? '', ENT_QUOTES, 'UTF-8'); } // Function to validate and sanitize input function sanitizeInput($data) { return filter_var(trim($data), FILTER_SANITIZE_STRING); } // Function to display social media link if available function displaySocialLink($value, $baseUrl = '', $icon = '') { if (!empty($value)) { $url = (strpos($value, 'http') === 0) ? $value : $baseUrl . $value; // Validate URL if (!filter_var($url, FILTER_VALIDATE_URL)) { return 'Invalid URL'; } $displayText = parse_url($url, PHP_URL_HOST) ?? $url; return "" . ($icon ? " " : '') . sanitizeOutput($displayText) . ""; } return 'Not provided'; } // Process filters from GET parameters with validation $filters = []; $allowedFilters = ['country', 'city', 'category', 'search', 'sort', 'page']; foreach ($allowedFilters as $filter) { if (isset($_GET[$filter])) { $filters[$filter] = sanitizeInput($_GET[$filter]); } } // Validate sort parameter against allowed values $sortOptions = [ 'price' => 'package_plan ASC', 'newest' => 'created_at DESC', 'name' => 'customer_name ASC', 'popular' => 'id DESC' ]; $sort = isset($filters['sort']) && array_key_exists($filters['sort'], $sortOptions) ? $filters['sort'] : 'price'; // Validate and set pagination parameters $perPage = 12; $page = isset($filters['page']) ? max(1, intval($filters['page'])) : 1; $offset = ($page - 1) * $perPage; // Build SQL query with prepared statements $query = "SELECT SQL_CALC_FOUND_ROWS * FROM reservations WHERE 1=1"; $params = []; $types = ''; if (!empty($filters['search'])) { $query .= " AND (customer_name LIKE ? OR subdomain_title LIKE ? OR subdomain_description LIKE ?)"; $searchTerm = "%{$filters['search']}%"; $params = array_merge($params, [$searchTerm, $searchTerm, $searchTerm]); $types .= 'sss'; } if (!empty($filters['country'])) { $query .= " AND country = ?"; $params[] = $filters['country']; $types .= 's'; } if (!empty($filters['city'])) { $query .= " AND city = ?"; $params[] = $filters['city']; $types .= 's'; } if (!empty($filters['category'])) { $query .= " AND subdomain_type = ?"; $params[] = $filters['category']; $types .= 's'; } // Add sorting $query .= " ORDER BY " . $sortOptions[$sort]; // Add pagination $query .= " LIMIT ? OFFSET ?"; $params = array_merge($params, [$perPage, $offset]); $types .= 'ii'; // Prepare and execute the query try { $stmt = $conn->prepare($query); if (!empty($params)) { $stmt->bind_param($types, ...$params); } $stmt->execute(); $result = $stmt->get_result(); // Get total count for pagination $countResult = $conn->query("SELECT FOUND_ROWS() AS total"); $totalRows = $countResult->fetch_assoc()['total']; $totalPages = ceil($totalRows / $perPage); } catch (Exception $e) { error_log("Query error: " . $e->getMessage()); die("Error retrieving data. Please try again later."); } ?> Explore All Brands - FIFAALL.com
English العربية

Explore All Brands

Discover business brands from Saudi Arabia, the Gulf region, and internationally

Filter Brands

Reset Filters
num_rows > 0): ?>
fetch_assoc()): ?>

,

Website:

Email:

Phone:

No brands found matching your criteria

Try adjusting your search or filters to find what you're looking for.

Clear all filters
1): ?>