<?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";
if (!isset($_GET['open'])) {
echo "Missing 'open' request parameter\n";
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";
?>