Delete radar/update.php

This commit is contained in:
2026-02-21 20:06:09 +01:00
parent b8134495e4
commit dea1ed4031

View File

@@ -1,43 +0,0 @@
<?php
// Alleen POST toestaan
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
exit("Only POST allowed");
}
// Check of data bestaat
if (!isset($_POST['hoek']) || !isset($_POST['afstand'])) {
http_response_code(400);
exit("Missing data");
}
$hoek = intval($_POST['hoek']);
$afstand = intval($_POST['afstand']);
// Basis validatie
if ($hoek < 0 || $hoek > 180) {
http_response_code(400);
exit("Invalid angle");
}
// Bestand met radar data
$file = __DIR__ . "/radar.json";
// Bestaande data laden
$data = [];
if (file_exists($file)) {
$json = file_get_contents($file);
$data = json_decode($json, true);
if (!is_array($data)) $data = [];
}
// Opslaan per hoek
$data[$hoek] = [
"afstand" => $afstand,
"tijd" => time()
];
// Terugschrijven
file_put_contents($file, json_encode($data));
echo "OK";