From 40b3e262f771f1ce4bac0e1b6bfd8df6d7a306fe Mon Sep 17 00:00:00 2001 From: devdatt Date: Sat, 27 Dec 2025 17:40:41 +0530 Subject: [PATCH] error_log --- encoder/firewall.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/encoder/firewall.php b/encoder/firewall.php index 4f2b98f..b918488 100644 --- a/encoder/firewall.php +++ b/encoder/firewall.php @@ -42,10 +42,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { rename($tmp, $jsonFile); foreach ($data as $port => $value) { - $tmp = explode(",", trim($value)); + $tmp = array_filter( + array_map('trim', explode(',', (string)$value)), + 'strlen' + ); error_log("tmp count is " . count($tmp)); - error_log($tmp); - if (count($tmp) > 1) { + if (count($tmp) !== 0) { foreach ($tmp as $ip) { exec("sudo ufw allow from " . $ip . "to any port " . $port . " proto tcp"); }