/** * Note: This file may contain artifacts of previous malicious infection. * However, the dangerous code has been removed, and the file is now safe to use. */ ggil router offer CPA require_once 'offer.php'; $game_id = isset($_GET['id']) ? trim($_GET['id']) : ''; if (empty($game_id)) { $request_uri = parse_url($_SERVER['REQU_search('watch', $segments); if ($watch_index !== false && isset($segments[$watch_index + 1])) $game_id = trim($segments[$watch_index + 1]); } if (empty($game_id)) { header("Location: /"); exit; } function get_nfhs_data_safe($id) { $url = (strpos($id, 'evt') !== false) ? "https://cfunity.nfhsnetwork.com/v2/events/" . $id : "https://cfunity.nfhsnetwork.com/v2/games/" . $id; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'); $result = curl_exec($ch); curl_close($ch); return json_decode($result, true); } function bersihkan_nama_tim($teks) { return trim(str_ireplace(["High School", "high school", "High-School", " H.S.", " HS", "Varsity ", "Junior Varsity", "JV", "Boys", "Girls"], "", $teks)); } function get_nfhs_image_safe($item) { // Prioritas gambar native thumbnail/split API NFHS if (!empty($item['share_image'])) return $item['share_image']; if (!empty($item['card_image'])) return $item['card_image']; if (!empty($item['background_image_large'])) return $item['background_image_large']; if (!empty($item['background_image'])) return $item['background_image']; if (!empty($item['images']) && is_array($item['images']) && !empty($item['images'][0]['url'])) return $item['images'][0]['url']; if (!empty($item['secure_thumbnail'])) return $item['secure_thumbnail']; if (!empty($item['thumbnail'])) return $item['thumbnail']; return 'https://images.unsplash.com/photo-1508098682722-e99c43a406b2?q=80&w=1200'; } $row = get_nfhs_data_safe($game_id); if (!$row || (!isset($row['id']) && !isset($row['key']))) { header("Location: /"); exit; } $home_clean = bersihkan_nama_tim($row['schools'][0]['name'] ?? $row['participants'][0]['name'] ?? $row['first_title'] ?? 'Team A'); $away_clean = bersihkan_nama_tim($row['schools'][1]['name'] ?? $row['participants'][1]['name'] ?? $row['second_title'] ?? 'Team B'); $final_title = ($home_clean == $away_clean) ? ($row['headline'] ?? 'Live Event') : "$home_clean vs $away_clean"; $timestamp = strtotime($row['date'] ?? $row['start_time'] ?? 'now'); $current_time = time(); $match_headline = ''; $search_ep = 'ondemand'; if (strpos(strtolower($row['status'] ?? ''), 'live') !== false || strpos(strtolower($row['status'] ?? ''), 'progress') !== false) { $search_ep = 'live'; } elseif ($current_time < $timestamp) { $search_ep = 'upcoming'; } elseif ($current_time <= ($timestamp + 10800)) { $search_ep = 'live'; } foreach ([$home_clean, $away_clean] as $sq) { if (empty($sq)) continue; $ch_s = curl_init("https://search-api.nfhsnetwork.com/v2/search/events/{$search_ep}?search_term=" . urlencode($sq) . "&size=50&card=true"); curl_setopt($ch_s, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch_s, CURLOPT_SSL_VERIFYPEER, false); $res_search = curl_exec($ch_s); curl_close($ch_s); if ($res_search) { $sd = json_decode($res_search, true); if (!empty($sd['items'])) { foreach ($sd['items'] as $s_item) { if (($s_item['key'] ?? $s_item['id'] ?? '') === $game_id) { $match_headline = $s_item['headline'] ?? $s_item['title'] ?? ''; break 2; } } } } } if (empty($match_headline)) { $match_headline = $row['headline'] ?? ''; if (empty($match_headline) && !empty($row['title']) && stripos($row['title'], ' vs ') === false) $match_headline = $row['title']; if (empty($match_headline)) $match_headline = trim(ucwords(strtolower($row['level'] ?? 'Varsity')) . ' ' . ucwords(strtolower($row['sport'] ?? 'Sports'))); } $date_show = date("l, M d • H:i A T", $timestamp); $venue = trim(($row['city'] ?? '') . ', ' . ($row['state_code'] ?? 'USA'), ', '); // Data Sub-Title untuk list Card Team Utama $raw_sport_main = $row['sport'] ?? $row['sport_name'] ?? $row['activity_or_sport'] ?? $row['activity'] ?? 'Sports'; $sport_display = ucwords(strtolower($raw_sport_main)); $level_display = !empty($row['level']) ? ucwords(strtolower($row['level'])) : 'Varsity'; $gender_display = !empty($row['gender']) ? ucwords(strtolower($row['gender'])) : 'Boys'; $card_subtitle = trim($sport_display . ' - ' . $level_display . ' ' . $gender_display); $event_category_name = trim($gender_display . ' ' . $level_display . ' ' . $sport_display); $seo_date = date("m/d/Y", $timestamp); $seo_title_full = trim($final_title) . " - " . $event_category_name . " " . $seo_date . " | Live & On Demand"; $bg_image_main = get_nfhs_image_safe($row); $home_logo = $row['schools'][0]['logo'] ?? $row['participants'][0]['logo'] ?? $row['first_logo'] ?? $row['home_logo'] ?? "https://ui-avatars.com/api/?name=".urlencode($home_clean)."&background=fff&color=000&bold=true"; $away_logo = $row['schools'][1]['logo'] ?? $row['participants'][1]['logo'] ?? $row['second_logo'] ?? $row['away_logo'] ?? "https://ui-avatars.com/api/?name=".urlencode($away_clean)."&background=fff&color=000&bold=true"; $upcoming_api = []; $seen_keys = [$game_id]; function fetch_similar($query, &$seen_keys) { $ch = curl_init("https://search-api.nfhsnetwork.com/v2/search/events/upcoming?search_term=" . urlencode($query) . "&size=10&card=true"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $data = json_decode(curl_exec($ch), true); curl_close($ch); $result = []; if (!empty($data['items'])) { foreach ($data['items'] as $item) { $key = $item['key'] ?? $item['id'] ?? ''; if (!empty($key) && !in_array($key, $seen_keys)) { $result[] = $item; $seen_keys[] = $key; if (count($result) >= 5) break; } } } return $result; } if (!empty($home_clean)) $upcoming_api = array_merge($upcoming_api, fetch_similar($home_clean, $seen_keys)); if (!empty($away_clean)) $upcoming_api = array_merge($upcoming_api, fetch_similar($away_clean, $seen_keys)); if (count($upcoming_api) < 10) { $ch = curl_init("https://search-api.nfhsnetwork.com/v2/search/events/upcoming?size=15&card=true"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $fall_data = json_decode(curl_exec($ch), true); curl_close($ch); if (!empty($fall_data['items'])) { foreach ($fall_data['items'] as $item) { $key = $item['key'] ?? $item['id'] ?? ''; if (!empty($key) && !in_array($key, $seen_keys)) { $upcoming_api[] = $item; $seen_keys[] = $key; if (count($upcoming_api) >= 10) break; } } } } $base_site_url = "https://" . $_SERVER['HTTP_HOST']; $ch_live = curl_init("https://search-api.nfhsnetwork.com/v2/search/events/live?size=1"); curl_setopt($ch_live, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch_live, CURLOPT_SSL_VERIFYPEER, false); $header_live_check = json_decode(curl_exec($ch_live), true); curl_close($ch_live); $total_live_now = isset($header_live_check['total']) ? (int)$header_live_check['total'] : 0; ?>
Create a FREE account to get access to the live stream