Worked on the saving api method.

This commit is contained in:
2025-07-02 22:22:25 +10:00
parent b6d51c7cfa
commit 4ce23cc392
4 changed files with 81 additions and 27 deletions

View File

@@ -2,7 +2,11 @@
header("Content-Type: application/json");
include('lib.php');
$ret = array( "err" => "unknown command" );
if ( $_GET["cmd"] == "get" ) {
if ( in_array("cmd", array_keys($_GET)) and $_GET["cmd"] == "get" ) {
$ret = getEvents();
} elseif ( $_POST["cmd"] == "put" ) {
$json = base64_decode($_POST["payload"]);
file_put_contents("dat/events.json", $json);
$ret = getEvents();
}
print(json_encode($ret));