Improve code as suggested

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2018-04-18 21:49:35 +02:00
parent 6495a20aab
commit 847d6aae53
2 changed files with 9 additions and 21 deletions

View File

@@ -200,20 +200,12 @@ function readAdlists()
}
$DNSservercount = count($DNSservers);
if(isset($_POST["localDNS"]))
if(isset($_POST["localDNS"]) && isset($_POST["localDNSport"]) &&
is_numeric($_POST["localDNSport"]))
{
if(isset($_POST["localDNSport"]) &&
is_numeric($_POST["localDNSport"]))
{
// Save port and modify dnsmasq.d config file
exec("sudo pihole -a localdnsport ".intval($_POST["localDNSport"]));
$DNSservercount++;
}
else if(isset($localdns))
{
// Remove entry without valid port
exec("sudo pihole -a localdnsport 0");
}
// Save port and modify dnsmasq.d config file
exec("sudo pihole -a localdnsport ".intval($_POST["localDNSport"]));
$DNSservercount++;
}
else
{