isAuthorized()) { http_response_code(403); } echo 'Some text otherwise PHP crashes. I wish this was a joke.'; } function toggle(Configuration $config, State $state) { if ($config->isAuthorized()) { $state->toggle(); } header('location: ' . $_SERVER['REQUEST_URI']); } function display_state(ReadableState $state) { $open = $state->isOpen(); header('X-Foobar-Open: ' . var_export($open, true)); if ($open) { require '../templates/open.html'; } else { require '../templates/closed.html'; } } if (isset($_POST['auth_check'])) { auth_check($config); } elseif (isset($_POST['toggle'])) { toggle($config, $state); } else { display_state($state); }