fixed Request Method

This commit is contained in:
schrom01 2023-02-15 00:28:12 +01:00
parent fbbd126cd6
commit cc4f6d97c0
1 changed files with 3 additions and 1 deletions

View File

@ -25,7 +25,7 @@ function findRowIndex($id, $data) {
} }
$entityBody = '{"lastSave": 0, "timeWatchM": 0, "timeWatchW": 0, "timeWatchD": 0, "countWatchM": 0, "countWatchW": 0, "countWatchD": 0, "id":"test","watches":[{"actions":[]},{"actions":[]},{"actions":[]}]}'; $entityBody = '{"lastSave": 0, "timeWatchM": 0, "timeWatchW": 0, "timeWatchD": 0, "countWatchM": 0, "countWatchW": 0, "countWatchD": 0, "id":"test","watches":[{"actions":[]},{"actions":[]},{"actions":[]}]}';
if ($_SERVER['REQUEST_METHOD'] !== 'POST') { if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$entityBody = file_get_contents('php://input'); $entityBody = file_get_contents('php://input');
$entityBodyObject = json_decode($entityBody); $entityBodyObject = json_decode($entityBody);
@ -46,6 +46,8 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
write_xlsxFile($fileName, $data); write_xlsxFile($fileName, $data);
echo "<br>Data saved.<br>"; echo "<br>Data saved.<br>";
} }
} else {
echo "invalid Request.<br> Type: ".$_SERVER['REQUEST_METHOD'];
} }