error_log

This commit is contained in:
devdatt 2025-12-27 17:40:41 +05:30
parent 847da16349
commit 40b3e262f7
1 changed files with 5 additions and 3 deletions

View File

@ -42,10 +42,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
rename($tmp, $jsonFile); rename($tmp, $jsonFile);
foreach ($data as $port => $value) { 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 count is " . count($tmp));
error_log($tmp); if (count($tmp) !== 0) {
if (count($tmp) > 1) {
foreach ($tmp as $ip) { foreach ($tmp as $ip) {
exec("sudo ufw allow from " . $ip . "to any port " . $port . " proto tcp"); exec("sudo ufw allow from " . $ip . "to any port " . $port . " proto tcp");
} }