From 6b7513bd3ace106f1c6d3200198117adb3e4e7e9 Mon Sep 17 00:00:00 2001 From: devdatt Date: Thu, 19 Feb 2026 15:04:13 +0530 Subject: [PATCH] update --- html/input.php | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/html/input.php b/html/input.php index 2e105f2..238f828 100644 --- a/html/input.php +++ b/html/input.php @@ -355,15 +355,13 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { foreach ($data as $row) { if ($row["id"] == $id) { - $row = [ - "id" => $id, + $new = [ + "id" => time(), "service_name" => $_POST["service_name"], "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"], + "program_id" => $_POST["program_id"], "audio_bitrate" => $_POST["audio_bitrate"], "volume" => $_POST["volume"], "service" => $_POST["service"] @@ -605,17 +603,15 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { function openEditPopup(row) { document.getElementById("popup_title").innerText = "Edit Service"; - service_id.value = row.id; - service_name.value = row.service_name; - in_udp.value = row.input_udp; - out_udp.value = row.output_udp; - video_format.value = row.video_format; - audio_format.value = row.audio_format; - resolution.value = row.resolution; - video_bitrate.value = row.video_bitrate; - audio_bitrate.value = row.audio_bitrate; - volume.value = row.volume; - service.value = row.service; + service_id.value = row.id ?? ""; + service_name.value = row.service_name ?? ""; + in_udp.value = row.input_udp ?? ""; + out_udp.value = row.output_udp ?? ""; + audio_format.value = row.audio_format ?? "mp2"; + program_id.value = row.program_id ?? ""; + audio_bitrate.value = row.audio_bitrate ?? ""; + volume.value = row.volume ?? "0"; + service.value = row.service ?? "enable"; document.getElementById("saveBtn").setAttribute("onclick", "updateService()"); showPopup(); @@ -636,25 +632,22 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { service_name.value = ""; in_udp.value = ""; out_udp.value = ""; - video_format.value = "mpeg2video"; audio_format.value = "mp2"; - resolution.value = "720:576"; - video_bitrate.value = "3000"; - audio_bitrate.value = "96"; + program_id.value = ""; + audio_bitrate.value = ""; volume.value = "0"; service.value = "enable"; } function saveService() { let form = new FormData(); + form.append("action", "add"); form.append("service_name", service_name.value); form.append("input_udp", in_udp.value); form.append("output_udp", out_udp.value); - form.append("video_format", video_format.value); form.append("audio_format", audio_format.value); - form.append("resolution", resolution.value); - form.append("video_bitrate", video_bitrate.value); + form.append("program_id", program_id.value); form.append("audio_bitrate", audio_bitrate.value); form.append("volume", volume.value); form.append("service", service.value); @@ -666,21 +659,21 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { .then(r => r.text()) .then(res => { if (res.includes("OK")) location.reload(); + else alert(res); }); } function updateService() { let form = new FormData(); + form.append("action", "edit"); form.append("id", service_id.value); form.append("service_name", service_name.value); form.append("input_udp", in_udp.value); form.append("output_udp", out_udp.value); - form.append("video_format", video_format.value); form.append("audio_format", audio_format.value); - form.append("resolution", resolution.value); - form.append("video_bitrate", video_bitrate.value); + form.append("program_id", program_id.value); form.append("audio_bitrate", audio_bitrate.value); form.append("volume", volume.value); form.append("service", service.value); @@ -692,6 +685,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") { .then(r => r.text()) .then(res => { if (res.includes("OK")) location.reload(); + else alert(res); }); }