diff --git a/includes/dhcp.php b/includes/dhcp.php index 5a63b585..47b8edfa 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -280,10 +280,10 @@ function updateDnsmasqConfig($iface,$status) $config .='log-facility='.RASPI_DHCPCD_LOG.PHP_EOL; $config .='conf-dir=/etc/dnsmasq.d'.PHP_EOL; // handle log option - if ($_POST['log-dhcp'] == "1") { + if (($_POST['log-dhcp'] ?? '') == "1") { $config .= "log-dhcp".PHP_EOL; } - if ($_POST['log-queries'] == "1") { + if (($_POST['log-queries'] ?? '') == "1") { $config .= "log-queries".PHP_EOL; } $config .= PHP_EOL; @@ -317,12 +317,12 @@ function updateDHCPConfig($iface,$status) if ($_POST['Metric'] !== '') { $cfg[] = 'metric '.$_POST['Metric']; } - if ($_POST['Fallback'] == 1) { + if (($_POST['Fallback'] ?? 0) == 1) { $cfg[] = 'profile static_'.$iface; $cfg[] = 'fallback static_'.$iface; } - $cfg[] = $_POST['DefaultRoute'] == '1' ? 'gateway' : 'nogateway'; - if (( substr($iface, 0, 2) === "wl") && $_POST['NoHookWPASupplicant'] == '1') { + $cfg[] = ($_POST['DefaultRoute'] ?? '') == '1' ? 'gateway' : 'nogateway'; + if (substr($iface, 0, 2) === "wl" && ($_POST['NoHookWPASupplicant'] ?? '') == '1') { $cfg[] = 'nohook wpa_supplicant'; } $dhcp_cfg = file_get_contents(RASPI_DHCPCD_CONFIG);