diff --git a/dist/css/custom.css b/dist/css/custom.css index 17126ae5..be1b60d1 100644 --- a/dist/css/custom.css +++ b/dist/css/custom.css @@ -53,3 +53,13 @@ width:100%; height:300px; } + +.dhcp-static-leases { + margin-top: 1em; + margin-bottom: 1em; +} + +.dhcp-static-lease-row { + margin-top: 0.5em; + margin-bottom: 0.5em; +} \ No newline at end of file diff --git a/includes/dhcp.php b/includes/dhcp.php index ec85419f..cc5133c1 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -47,7 +47,16 @@ function DisplayDHCPConfig() $config .= $_POST['RangeLeaseTime']; } - $config .= $_POST['RangeLeaseTimeUnits']; + $config .= $_POST['RangeLeaseTimeUnits'].PHP_EOL; + + for ($i=0; $i < count($_POST["static_leases"]["mac"]); $i++) { + $mac = trim($_POST["static_leases"]["mac"][$i]); + $ip = trim($_POST["static_leases"]["ip"][$i]); + if ($mac != "" && $ip != "") { + $config .= "dhcp-host=$mac,$ip".PHP_EOL; + } + } + file_put_contents("/tmp/dhcpddata", $config); system('sudo cp /tmp/dhcpddata '.RASPI_DNSMASQ_CONFIG, $return); } else { @@ -114,6 +123,9 @@ function DisplayDHCPConfig() $RangeEnd = $arrRange[1]; $RangeMask = $arrRange[2]; $leaseTime = $arrRange[3]; + $dhcpHost = $conf["dhcp-host"]; + $dhcpHost = empty($dhcpHost) ? [] : $dhcpHost; + $dhcpHost = is_array($dhcpHost) ? $dhcpHost : [ $dhcpHost ]; $hselected = ''; $mselected = ''; @@ -144,10 +156,13 @@ function DisplayDHCPConfig()
showMessages(); ?>
+