From b528dabf1f547b683ae7da8b3279ed282730aeb7 Mon Sep 17 00:00:00 2001 From: devdatt Date: Thu, 8 Jan 2026 07:49:13 +0530 Subject: [PATCH] updtae --- html/input.php | 161 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 127 insertions(+), 34 deletions(-) diff --git a/html/input.php b/html/input.php index 54a9aaf..4ac9679 100644 --- a/html/input.php +++ b/html/input.php @@ -7,6 +7,9 @@ if (!file_exists($jsonFile)) { } $data = json_decode(file_get_contents($jsonFile), true); +// ---------------------------------------------------- +// ADD SERVICE +// ---------------------------------------------------- if ($_SERVER["REQUEST_METHOD"] === "POST" && $_POST["action"] === "add") { $new = [ "id" => time(), @@ -22,25 +25,55 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && $_POST["action"] === "add") { $data[] = $new; file_put_contents($jsonFile, json_encode($data, JSON_PRETTY_PRINT)); - echo "OK"; exit; } +// ---------------------------------------------------- +// DELETE SERVICE +// ---------------------------------------------------- if ($_SERVER["REQUEST_METHOD"] === "POST" && $_POST["action"] === "delete") { $id = intval($_POST["id"]); $newData = []; foreach ($data as $row) { - if ($row["id"] != $id) { - $newData[] = $row; - } + if ($row["id"] != $id) $newData[] = $row; } file_put_contents($jsonFile, json_encode($newData, JSON_PRETTY_PRINT)); echo "OK"; exit; } + +// ---------------------------------------------------- +// UPDATE SERVICE +// ---------------------------------------------------- +if ($_SERVER["REQUEST_METHOD"] === "POST" && $_POST["action"] === "edit") { + $id = intval($_POST["id"]); + $newData = []; + + foreach ($data as $row) { + if ($row["id"] == $id) { + $row = [ + "id" => $id, + "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"] + ]; + } + $newData[] = $row; + } + + file_put_contents($jsonFile, json_encode($newData, JSON_PRETTY_PRINT)); + + echo "OK"; + exit; +} ?>

Service List

- + @@ -113,7 +151,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && $_POST["action"] === "delete") { - + @@ -127,7 +165,10 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && $_POST["action"] === "delete") { - + @@ -137,7 +178,9 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && $_POST["action"] === "delete") {
Video Bitrate Audio Bitrate StatusActionActions
+ + +