This commit is contained in:
devdatt 2025-12-27 16:18:34 +05:30
parent f93490e959
commit 6ba71f78d1
1 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,7 @@ $defaults = [
]; ];
$data = $defaults; $data = $defaults;
if (is_file($jsonFile)) { if (is_file($jsonFile)) {
$stored = json_decode(file_get_contents($jsonFile), true); $stored = json_decode(file_get_contents($jsonFile), true);
if (is_array($stored)) { if (is_array($stored)) {
@ -43,6 +44,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
foreach ($data as $port => $value) { foreach ($data as $port => $value) {
$tmp = explode(",", trim($value)); $tmp = explode(",", trim($value));
if (count($tmp) > 0) { if (count($tmp) > 0) {
error_log(count($tmp));
print_r($tmp);
foreach ($tmp as $ip) { foreach ($tmp as $ip) {
error_log("limit port " . $port); error_log("limit port " . $port);
exec("sudo ufw allow from " . $ip . "to any port " . $port . " proto tcp"); exec("sudo ufw allow from " . $ip . "to any port " . $port . " proto tcp");