Files
isdefoobaropen/public/toggle.php

32 lines
618 B
PHP

<?php
require_once '../vendor/autoload.php';
$configuration = \FooBar\Configuration::loadConfig();
if (isset($_POST['toggle']) && $configuration->isAuthorized()) {
$file = $configuration->stateFile();
if ($configuration->isOpen()) {
unlink($file);
} else {
touch($file);
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Verander de status van de foobar</title>
</head>
<body>
<h1>De foobar is nu
<?php
echo $configuration->isOpen() ? ' ' : ' niet ';
?>
open.</h1>
<form method="post">
<input type="submit" name="toggle" value="Verander dit">
</form>
</body>
</html>