diff --git a/html/network.php b/html/network.php index e3d05bd..cd000c3 100755 --- a/html/network.php +++ b/html/network.php @@ -38,12 +38,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $network_config[$interface] = $config; file_put_contents($config_file, json_encode($network_config, JSON_PRETTY_PRINT)); - } elseif ($action === 'activate') { - // Activate interface - exec("sudo ip link set $interface up", $output, $return_code); - } elseif ($action === 'deactivate') { - // Deactivate interface - exec("sudo ip link set $interface down", $output, $return_code); + } elseif ($action === 'toggle') { + // Toggle interface state + $current_status = $interface_data[$interface]['status'] ?? 'down'; + if ($current_status === 'up') { + exec("sudo ip link set $interface down", $output, $return_code); + } else { + exec("sudo ip link set $interface up", $output, $return_code); + } } } } @@ -144,15 +146,11 @@ $selected_interface = $_GET['interface'] ?? array_keys($interface_data)[0] ?? nu
MAC Address: