From 005b8cbc68583520f1cc7e35ccf9ffbf99909afc Mon Sep 17 00:00:00 2001 From: devdatt Date: Thu, 8 Jan 2026 07:41:24 +0530 Subject: [PATCH] update --- html/input.php | 91 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 67 insertions(+), 24 deletions(-) diff --git a/html/input.php b/html/input.php index 72339ef..1c62f1c 100644 --- a/html/input.php +++ b/html/input.php @@ -7,17 +7,17 @@ if (!file_exists($jsonFile)) { } $data = json_decode(file_get_contents($jsonFile), true); -if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["action"]) && $_POST["action"] === "add") { +if ($_SERVER["REQUEST_METHOD"] === "POST" && $_POST["action"] === "add") { $new = [ "id" => time(), - "input_udp" => $_POST["input_udp"] ?? "", - "output_udp" => $_POST["output_udp"] ?? "", - "video_format" => $_POST["video_format"] ?? "", - "audio_format" => $_POST["audio_format"] ?? "", - "resolution" => $_POST["resolution"] ?? "", - "video_bitrate" => $_POST["video_bitrate"] ?? "", - "audio_bitrate" => $_POST["audio_bitrate"] ?? "", - "status" => $_POST["status"] ?? "" + "input_udp" => $_POST["input_udp"], + "output_udp" => $_POST["output_udp"], + "video_format" => $_POST["video_format"], + "audio_format" => $_POST["audio_format"], + "resolution" => $_POST["resolution"], + "video_bitrate" => $_POST["video_bitrate"], + "audio_bitrate" => $_POST["audio_bitrate"], + "status" => $_POST["status"] ]; $data[] = $new; @@ -27,15 +27,29 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["action"]) && $_POST[" exit; } +if ($_SERVER["REQUEST_METHOD"] === "POST" && $_POST["action"] === "delete") { + $id = intval($_POST["id"]); + $newData = []; + + foreach ($data as $row) { + if ($row["id"] != $id) { + $newData[] = $row; + } + } + + file_put_contents($jsonFile, json_encode($newData, JSON_PRETTY_PRINT)); + echo "OK"; + exit; +} ?>
@@ -94,6 +113,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["action"]) && $_POST[" Video Bitrate Audio Bitrate Status + Action @@ -107,41 +127,41 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["action"]) && $_POST[" + - +
-