2 if ($Page->api) return;
5 if (isset($_POST['mail'])) {
6 $input = trim($_POST['mail']);
7 $inputq = sprintf('<em>%s</em>', $input);
9 require_once 'login/mailpass.inc.php';
10 if ( $found = mailtoken($input) ) {
11 $message = "Er is een e-mail verstuurd naar $inputq.";
14 http_response_code(404);
15 $message = "E-mailadres $inputq is nergens ingesteld.";
18 catch (Exception $e) {
19 http_response_code(500);
20 $message = "E-mail kon niet verstuurd worden."
21 . " Probeer het later nog eens of neem contact op.";
24 elseif (isset($_POST['login'])) {
25 if ($User = login($_POST['login'], $_POST['pass'])) {
29 http_response_code(403);
30 $message = 'Ongeldige gebruikersnaam of wachtwoord.';
33 elseif (isset($_GET['logout'])) {
34 setcookie('login', '', time(), '/'); # expire immediately
36 $message = "Je bent uitgelogd. Graag tot ziens!";
39 if (!$User or !$User->login) {
40 $Page->title = 'Inloggen';
41 if (isset($_REQUEST['goto'])) {
43 and !preg_match('(^WhatsApp/)', $_SERVER['HTTP_USER_AGENT'])) {
44 http_response_code(403);
46 $target = ltrim($_REQUEST['goto'], '/');
47 $target = new ArchiveArticle(file_exists("$target/index.html") ? "$target/index.html" : "$target.html");
48 $target->index; # run forbidden handler to determine metadata
51 $Page->title .= ' voor ' . $target->title;
53 $Page->image = $target->image;
54 $Page->teaser = $target->teaser;
57 require_once 'login/form.inc.php';
58 $Page->raw = ob_get_clean();
59 $Page->place['warn'] = $message;
63 if (isset($_REQUEST['goto'])) {
64 $target = ltrim($_REQUEST['goto'], '/');
65 abort("/$target", '303 Return');
68 if (isset($Page->raw)) {
71 if (empty($Page->path) and $User->admin) {
72 include_once 'login/admin.html';