This repository has been archived on 2024-02-16. You can view files and clone it, but cannot push or open issues or pull requests.
ITSynOpen/server/update.php

35 lines
673 B
PHP
Raw Permalink Normal View History

<?php
2022-03-27 18:19:55 +02:00
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";
2022-03-27 18:19:55 +02:00
} else {
echo "Invalid 'open' parameter value\n";
return;
2022-03-27 18:19:55 +02:00
}
?>