Don't add #53 to any passed IP value by default, only add custom port if it is specified by the user

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner
2020-06-25 17:54:23 +01:00
parent 297c1b019f
commit f51705b675
+15 -13
View File
@@ -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!<br>";
}
elseif(!is_numeric($port))
{
$error .= "Port (".htmlspecialchars($port).") is invalid!<br>";
}
else
{
array_push($DNSservers,$IP."#".$port);
if(count($exploded) > 1)
{
$port = trim($exploded[1]);
if(!is_numeric($port))
{
$error .= "Port (".htmlspecialchars($port).") is invalid!<br>";
}
else
{
$IP = $IP."#".$port;
}
}
array_push($DNSservers,$IP);
}
}
}