34 lines
673 B
PHP
Executable file
34 lines
673 B
PHP
Executable file
<?php
|
|
|
|
require_once('config.inc.php');
|
|
$apikeys = $config['update'];
|
|
|
|
header('Content-type: text/plain');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
|
echo "Must use POST request method\n";
|
|
return;
|
|
}
|
|
|
|
if (!isset($_GET['apikey']) || !in_array($_GET['apikey'], $apikeys, true)) {
|
|
echo "Invalid API key\n";
|
|
return;
|
|
}
|
|
|
|
if (!isset($_GET['open'])) {
|
|
echo "Missing 'open' request parameter\n";
|
|
return;
|
|
}
|
|
|
|
if ($_GET['open'] === 'true') {
|
|
file_put_contents('status.txt', 'true,'.time());
|
|
echo "true";
|
|
} else if ($_GET['open'] === 'false') {
|
|
file_put_contents('status.txt', 'false,'.time());
|
|
echo "false";
|
|
} else {
|
|
echo "Invalid 'open' parameter value\n";
|
|
return;
|
|
}
|
|
|
|
?>
|