diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index 18ea0083..81d9c003 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -263,25 +263,27 @@ function addStaticDHCPLease($mac, $ip, $hostname) { { $exploded = explode("#", $_POST["custom".$i."val"], 2); $IP = trim($exploded[0]); - if(count($exploded) > 1) - { - $port = trim($exploded[1]); - } - else - { - $port = "53"; - } + if(!validIP($IP)) { $error .= "IP (".htmlspecialchars($IP).") is invalid!
"; } - elseif(!is_numeric($port)) - { - $error .= "Port (".htmlspecialchars($port).") is invalid!
"; - } else { - array_push($DNSservers,$IP."#".$port); + if(count($exploded) > 1) + { + $port = trim($exploded[1]); + if(!is_numeric($port)) + { + $error .= "Port (".htmlspecialchars($port).") is invalid!
"; + } + else + { + $IP = $IP."#".$port; + } + } + + array_push($DNSservers,$IP); } } }