attach(true); try { if (!empty($_GET['logout'])) { $broker->logout(); } elseif ($broker->getUserInfo() || ($_SERVER['REQUEST_METHOD'] == 'POST' && $broker->login($_POST['username'], $_POST['password']))) { header("Location: index.php", true, 303); exit; } if ($_SERVER['REQUEST_METHOD'] == 'POST') $errmsg = "Login failed"; } catch (NotAttachedException $e) { header('Location: ' . $_SERVER['REQUEST_URI']); exit; } catch (Jasny\SSO\Exception $e) { $errmsg = $e->getMessage(); } ?>