14 lines
391 B
PHP
14 lines
391 B
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
include('lib/main.php');
|
|
$ret = array( "err" => "unknown command" );
|
|
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));
|
|
?>
|