$lang, 'quality' => $quality); } } usort($preferences, function ($a, $b) { return $a['quality'] < $b['quality'] ? 1 : -1; }); foreach ($preferences as $preference) { $lang = $preference['lang']; $primary = explode('-', $lang, 2)[0]; if (isset($supported[$lang])) { return $lang; } if (isset($supported[$primary])) { return $primary; } } return $fallback; } $pageTitle = 'Racket ChatGPT Agent Sandbox Creator'; $texts = array( 'en' => array( 'email' => 'Email address', 'password' => 'Password', 'login' => 'Login', 'account_title' => 'Want to try it?', 'account_text' => 'If you would like an account to try the sandbox, please request one from Hans Dijkema through the Racket Discourse pages.', 'account_link' => 'Go to Racket Discourse', ), 'nl' => array( 'email' => 'E-mailadres', 'password' => 'Wachtwoord', 'login' => 'Inloggen', 'account_title' => 'Wil je het eens proberen?', 'account_text' => 'Als je een account wilt om de sandbox eens uit te proberen, doe dan een verzoek aan Hans Dijkema via de Racket Discourse-pagina\'s.', 'account_link' => 'Naar Racket Discourse', ), ); $language = detect_login_language($texts, 'en'); $styleVersion = @filemtime(__DIR__ . '/styles.css') ?: time(); if ($auth->currentUser() !== null && $_SERVER['REQUEST_METHOD'] !== 'POST') { header('Location: /'); exit; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { try { $auth->login($_POST['email'] ?? '', $_POST['password'] ?? ''); header('Location: /'); exit; } catch (Throwable $e) { $error = $e->getMessage(); } } header('Content-Type: text/html; charset=utf-8'); ?> <?= h($pageTitle) ?>