mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Merge pull request #1472 from pi-hole/tweak/custom_DNS
Tweak/custom dns
This commit is contained in:
@@ -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 .= "#".$port;
|
||||
}
|
||||
}
|
||||
|
||||
array_push($DNSservers,$IP);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -376,16 +378,8 @@ function addStaticDHCPLease($mac, $ip, $hostname) {
|
||||
{
|
||||
$IPs = implode (",", $DNSservers);
|
||||
$return = pihole_execute("-a setdns \"".$IPs."\" ".$extra);
|
||||
if(!empty($return))
|
||||
{
|
||||
$success .= htmlspecialchars(end($return))."<br>";
|
||||
$success .= "The DNS settings have been updated (using ".$DNSservercount." DNS servers)";
|
||||
}
|
||||
else
|
||||
{
|
||||
$success .= "Updating DNS settings failed. Result:";
|
||||
$success .= implode($return);
|
||||
}
|
||||
$success .= htmlspecialchars(end($return))."<br>";
|
||||
$success .= "The DNS settings have been updated (using ".$DNSservercount." DNS servers)";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user