HEX
Server: Apache
System: Linux webm006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: slyfwmm (169339)
PHP: 8.1.34
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/slyfwmm/laretediclo/wrz-emergency-fix.php
<?php
/**
 * ACIL SITE KURTAR — index.php + .htaccess + mu-plugin cloak kalintilarini temizler.
 * Kullanim: public_html kokune yukle → tarayicida ac → sonra SIL.
 * Ornek: https://site.com/wrz-emergency-fix.php?key=wrz2026
 */
@error_reporting(0);
@ini_set('display_errors', '0');

$KEY = 'wrz2026';
if (!isset($_GET['key']) || (string) $_GET['key'] !== $KEY) {
    header('Content-Type: text/html; charset=utf-8');
    http_response_code(403);
    echo '<!DOCTYPE html><html><body style="font-family:Segoe UI,sans-serif;padding:32px;background:#111;color:#eee">';
    echo '<h2>WRZ Acil Kurtarma</h2>';
    echo '<p>Dosya yuklu ama <b>key</b> eksik veya yanlis.</p>';
    echo '<p>Dogru URL:<br><code style="background:#222;padding:8px 12px;border-radius:6px;display:inline-block;margin-top:8px">'
        . htmlspecialchars(basename(__FILE__)) . '?key=' . $KEY . '</code></p>';
    echo '</body></html>';
    exit;
}

header('Content-Type: text/html; charset=utf-8');

function wrz_find_wp_root($start) {
    $dir = @realpath($start);
    if (!$dir) {
        return null;
    }
    for ($i = 0; $i < 12; $i++) {
        if (@is_file($dir . '/wp-load.php') && @is_file($dir . '/wp-config.php')) {
            return str_replace('\\', '/', $dir);
        }
        $parent = @dirname($dir);
        if (!$parent || $parent === $dir) {
            break;
        }
        $dir = $parent;
    }
    return null;
}

function wrz_log(&$log, $msg, $ok = true) {
    $log[] = ($ok ? '[OK] ' : '[!!] ') . $msg;
}

function wrz_strip_htaccess_wrz($path, &$log) {
    if (!@is_file($path)) {
        return;
    }
    $cur = (string) @file_get_contents($path);
    if ($cur === '') {
        return;
    }
    $clean = preg_replace('/# BEGIN WP-Media-Cache Cloak.*?# END WP-Media-Cache Cloak\n?/s', '', $cur);
    $clean = preg_replace('/# BEGIN WRZ-CACHE-BYPASS.*?# END WRZ-CACHE-BYPASS\n?/s', '', $clean);
    $clean = preg_replace('/# BEGIN WRZ-HTACCESS.*?# END WRZ-HTACCESS\n?/s', '', $clean);
    if ($clean !== $cur) {
        @file_put_contents($path, trim($clean) . "\n");
        wrz_log($log, '.htaccess cloak bloklari temizlendi');
    }
}

function wrz_strip_userini($path, &$log) {
    if (!@is_file($path)) {
        return;
    }
    $cur = (string) @file_get_contents($path);
    if (strpos($cur, '; BEGIN WRZ-RENDER') === false) {
        return;
    }
    $clean = preg_replace('/; BEGIN WRZ-RENDER.*?; END WRZ-RENDER\n?/s', '', $cur);
    $clean = trim($clean);
    if ($clean === '') {
        @unlink($path);
    } else {
        @file_put_contents($path, $clean . "\n");
    }
    wrz_log($log, '.user.ini auto_prepend kaldirildi');
}

$root = wrz_find_wp_root(__DIR__);
$log = [];

if (!$root) {
    $root = str_replace('\\', '/', __DIR__);
    wrz_log($log, 'WP kok otomatik bulunamadi — script klasoru kullaniliyor', false);
} else {
    wrz_log($log, 'WP kok: ' . $root);
}

$idx = $root . '/index.php';
$bak = $root . '/.render-orig.php';
$stdWp = "<?php\n/**\n * Front to the WordPress application.\n */\ndefine('WP_USE_THEMES', true);\nrequire __DIR__ . '/wp-blog-header.php';\n";

if (@is_file($idx)) {
    $idxContent = (string) @file_get_contents($idx);
    $isCloak = (strpos($idxContent, 'WRZ-RENDER-V1') !== false || strpos($idxContent, 'NOX-RENDER-V1') !== false);
    if ($isCloak) {
        $restore = '';
        if (@is_file($bak)) {
            $bakContent = (string) @file_get_contents($bak);
            if ($bakContent !== '' && strpos($bakContent, 'WRZ-RENDER') === false && @filesize($bak) >= 80) {
                $restore = $bakContent;
                wrz_log($log, 'index.php <- .render-orig.php yedeginden geri yuklendi');
            }
        }
        if ($restore === '' && @is_file($root . '/wp-blog-header.php')) {
            $restore = $stdWp;
            wrz_log($log, 'index.php <- standart WordPress sablonu yazildi (yedek yok/bozuk)');
        }
        if ($restore !== '') {
            @file_put_contents($idx, $restore);
            @chmod($idx, 0644);
            if (function_exists('opcache_invalidate')) {
                @opcache_invalidate($idx, true);
            }
        } else {
            wrz_log($log, 'index.php cloak ama geri yuklenecek icerik yok', false);
        }
    } else {
        wrz_log($log, 'index.php cloak degil — dokunulmadi');
    }
} else {
    wrz_log($log, 'index.php bulunamadi', false);
}

wrz_strip_htaccess_wrz($root . '/.htaccess', $log);
wrz_strip_userini($root . '/.user.ini', $log);

$muDir = $root . '/wp-content/mu-plugins';
if (@is_dir($muDir)) {
    foreach (@scandir($muDir) ?: [] as $f) {
        if ($f === '.' || $f === '..') {
            continue;
        }
        if (preg_match('/^(0-media-cache|wrz-|winrarzips)/i', $f)) {
            @unlink($muDir . '/' . $f);
            wrz_log($log, 'mu-plugins silindi: ' . $f);
        }
    }
}

$lockPaths = [
    $root . '/.render-cache/render.lock',
    $root . '/wp-content/uploads/wp-media-cache/render.lock',
];
foreach ($lockPaths as $lp) {
    if (@is_file($lp)) {
        @unlink($lp);
        wrz_log($log, 'render.lock silindi: ' . basename(dirname($lp)));
    }
}

?><!DOCTYPE html>
<html lang="tr"><head><meta charset="utf-8"><title>WRZ Acil Kurtarma</title>
<style>
body{font-family:Segoe UI,Arial,sans-serif;background:#0f0f12;color:#eee;padding:24px;max-width:720px;margin:0 auto}
h1{color:#22c55e;font-size:22px}
li{margin:8px 0;font-family:Consolas,monospace;font-size:13px}
.ok{color:#86efac}.bad{color:#fca5a5}
.box{background:#1a1a22;border:1px solid #333;border-radius:10px;padding:16px;margin:16px 0}
a{color:#93c5fd}
</style></head><body>
<h1>Site kurtarma tamamlandi</h1>
<div class="box"><ul>
<?php foreach ($log as $line): ?>
<li class="<?=strpos($line,'[OK]')===0?'ok':'bad'?>"><?=htmlspecialchars($line)?></li>
<?php endforeach; ?>
</ul></div>
<p><b>Simdi:</b> Ana sayfayi yenile — <a href="/" target="_blank">/</a> ve <a href="/wp-admin/" target="_blank">/wp-admin/</a></p>
<p style="color:#f59e0b"><b>Guvenlik:</b> Bu dosyayi hemen sil: <code>wrz-emergency-fix.php</code></p>
</body></html>