📁 Folder Navigator
Position:
Root
Create
Folders
📁 .well-known
Rename
Copy
Delete
📁 apphome
Rename
Copy
Delete
📁 cgi-bin
Rename
Copy
Delete
📁 faith
Rename
Copy
Delete
Files
📄 .htaccess
📄 .user.ini
📄 apphomebackup7-10.zip
📄 index.php
📄 manager.php
📄 php.ini
📝 File Editor
Editing:
manager.php
<?php if (session_status() === PHP_SESSION_NONE) { session_start(); } // Ensure only authenticated admins can access this page // if (!isset($_SESSION['is_admin'])) { die("Access Denied"); } // 1. Define the safe root directory (cannot navigate higher than this) $root_dir = realpath("."); // 2. Get the current directory requested from the URL parameter $sub_dir = isset($_GET['dir']) ? $_GET['dir'] : ''; // 3. Clean and resolve the requested path to prevent directory traversal attacks $current_target_dir = realpath($root_dir . '/' . $sub_dir); // Security Check: If path is invalid or attempts to go outside the root, lock it to root if (!$current_target_dir || strpos($current_target_dir, $root_dir) !== 0) { $current_target_dir = $root_dir; $sub_dir = ''; } // 4. Read all files and folders in the current directory $items = scandir($current_target_dir); $folders = []; $files = []; foreach ($items as $item) { // Skip hidden system files/folders and the current folder shortcut if ($item === '.' || $item === '.git' || $item === '.DS_Store') { continue; } // Handle the "parent directory" shortcut (only show if we aren't already at the root) if ($item === '..') { if ($current_target_dir !== $root_dir) { // Calculate parent sub-directory string $parent_sub = dirname($sub_dir); if ($parent_sub === '.' || $parent_sub === '/') { $parent_sub = ''; } $folders[] = [ 'name' => '.. (Go Back Up)', 'path' => $parent_sub, 'is_back' => true ]; } continue; } // Determine relative path for URL tracking $relative_path = ltrim($sub_dir . '/' . $item, '/'); $full_path = $current_target_dir . '/' . $item; if (is_dir($full_path)) { $folders[] = [ 'name' => $item, 'path' => $relative_path, 'is_back' => false ]; } else { $files[] = [ 'name' => $item, 'path' => $relative_path ]; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Admin Browser File Manager</title> <style> body { font-family: Arial, sans-serif; background: #f4f6f9; color: #333; padding: 20px; } .container { max-width: 900px; margin: 0 auto; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); } h2 { margin-top: 0; padding-bottom: 10px; border-bottom: 2px solid #ddd; display: flex; align-items: center; justify-content: space-between; } .breadcrumb { font-size: 0.6em; color: #7f8c8d; font-weight: normal; margin-top: 5px; } .browser-table { width: 100%; border-collapse: collapse; margin-top: 15px; } .browser-table th, .browser-table td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; } .browser-table th { background-color: #f8f9fa; color: #2c3e50; } .browser-table tr:hover { background-color: #fdfdfd; } a { text-decoration: none; color: #3498db; font-weight: bold; } a:hover { color: #2980b9; } .item-row { display: flex; align-items: center; } .icon { font-size: 1.2em; margin-right: 10px; display: inline-block; width: 20px; text-align: center; } .btn-action { display: inline-block; padding: 4px 10px; border-radius: 4px; font-size: 0.85em; font-weight: normal; text-align: center; } .btn-open { background: #2ecc71; color: #fff !important; } .btn-open:hover { background: #27ae60; } .no-items { color: #7f8c8d; font-style: italic; text-align: center; padding: 30px; } </style> </head> <body> <div class="container"> <h2> <div>📁 Admin Browser</div> <div class="breadcrumb">Current Location: /<?php echo htmlspecialchars($sub_dir); ?></div> </h2> <table class="browser-table"> <thead> <tr> <th>Name</th> <th style="width: 150px; text-align: right;">Action</th> </tr> </thead> <tbody> <?php if (empty($folders) && empty($files)): ?> <tr> <td colspan="2" class="no-items">This directory is empty.</td> </tr> <?php endif; ?> <!-- Display Folders first --> <?php foreach ($folders as $folder): ?> <tr> <td> <div class="item-row"> <span class="icon"><?php echo $folder['is_back'] ? '⬅️' : '📁'; ?></span> <a href="?dir=<?php echo urlencode($folder['path']); ?>"> <?php echo htmlspecialchars($folder['name']); ?> </a> </div> </td> <td style="text-align: right;"> <?php if (!$folder['is_back']): ?> <a href="?dir=<?php echo urlencode($folder['path']); ?>" class="btn-action" style="background:#eee; color:#333;">Open Folder</a> <?php endif; ?> </td> </tr> <?php endforeach; ?> <!-- Display Files next --> <?php foreach ($files as $file): ?> <tr> <td> <div class="item-row"> <span class="icon">📄</span> <span style="color: #2c3e50;"><?php echo htmlspecialchars($file['name']); ?></span> </div> </td> <td style="text-align: right;"> <!-- Only allow opening execution for web files like .php, .html --> <?php if (pathinfo($file['name'], PATHINFO_EXTENSION) === 'php' || pathinfo($file['name'], PATHINFO_EXTENSION) === 'html'): ?> <a href="<?php echo htmlspecialchars($file['path']); ?>" target="_blank" class="btn-action btn-open">View Page</a> <?php else: ?> <span style="color:#aaa; font-size:0.85em;">File</span> <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </body> </html>
💾 Save Changes