diff --git a/html/network.php b/html/network.php index e5b4dc8..cbedfd7 100755 --- a/html/network.php +++ b/html/network.php @@ -21,14 +21,14 @@ if (file_exists($config_file)) { // Handle form submissions if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['action'])) { - $interface = $_POST['interface']; + $interface = $_POST['interface'] ?? ''; $action = $_POST['action']; if ($action === 'save') { // Save configuration $config = [ 'interface' => $interface, - 'method' => $_POST['method'], + 'method' => $_POST['method'] ?? '', 'ip' => $_POST['ip'] ?? '', 'netmask' => $_POST['netmask'] ?? '', 'gateway' => $_POST['gateway'] ?? '', @@ -43,6 +43,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } elseif ($action === 'deactivate') { // Deactivate interface exec("sudo ip link set $interface down", $output, $return_code); + } elseif ($action === 'save_general') { + // Save general settings + $general_config = [ + 'hostname' => $_POST['hostname'] ?? '', + 'dns_servers' => $_POST['dns_servers'] ?? '', + 'ntp_servers' => $_POST['ntp_servers'] ?? '', + 'proxy' => $_POST['proxy'] ?? '' + ]; + + $network_config['general'] = $general_config; + file_put_contents($config_file, json_encode($network_config, JSON_PRETTY_PRINT)); } } } @@ -103,113 +114,279 @@ foreach ($output as $line) { $interface_data[$current_interface]['status'] = 'up'; } } + +// Get general settings +$general_config = $network_config['general'] ?? [ + 'hostname' => '', + 'dns_servers' => '', + 'ntp_servers' => '', + 'proxy' => '' +]; ?>