Support custom ports in the custom DNS server tab on the settings page

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2018-05-04 19:14:31 +02:00
parent d2a20b1f0c
commit 6d8c3de5ba
2 changed files with 18 additions and 9 deletions

View File

@@ -187,15 +187,28 @@ function readAdlists()
{
if(array_key_exists("custom".$i,$_POST))
{
$IP = $_POST["custom".$i."val"];
if(validIP($IP))
$exploded = explode("#", $_POST["custom".$i."val"], 2);
$IP = $exploded[0];
if(count($exploded) > 1)
{
array_push($DNSservers,$IP);
$port = $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);
}
}
}
$DNSservercount = count($DNSservers);