diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php
index 67da464f..cb9f6b9c 100644
--- a/scripts/pi-hole/php/savesettings.php
+++ b/scripts/pi-hole/php/savesettings.php
@@ -123,7 +123,7 @@ function readStaticLeasesFile()
}
else
{
- $error .= "IP (".$IP.") is invalid!
";
+ $error .= "IP (".htmlspecialchars($IP).") is invalid!
";
}
}
}
@@ -209,7 +209,7 @@ function readStaticLeasesFile()
{
if(!validDomain($domain))
{
- $error .= "Top Domains/Ads entry ".$domain." is invalid!
";
+ $error .= "Top Domains/Ads entry ".htmlspecialchars($domain)." is invalid!
";
}
if(!$first)
{
@@ -228,7 +228,7 @@ function readStaticLeasesFile()
{
if(!validIP($client))
{
- $error .= "Top Clients entry ".$client." is invalid (use only IP addresses)!
";
+ $error .= "Top Clients entry ".htmlspecialchars($client)." is invalid (use only IP addresses)!
";
}
if(!$first)
{
@@ -370,18 +370,18 @@ function readStaticLeasesFile()
if(!validMAC($mac))
{
- $error .= "MAC address (".htmlentities($mac).") is invalid!
";
+ $error .= "MAC address (".htmlspecialchars($mac).") is invalid!
";
}
$mac = strtoupper($mac);
if(!validIP($ip) && strlen($ip) > 0)
{
- $error .= "IP address (".htmlentities($ip).") is invalid!
";
+ $error .= "IP address (".htmlspecialchars($ip).") is invalid!
";
}
if(!validDomain($hostname) && strlen($hostname) > 0)
{
- $error .= "Host name (".htmlentities($hostname).") is invalid!
";
+ $error .= "Host name (".htmlspecialchars($hostname).") is invalid!
";
}
if(strlen($hostname) == 0 && strlen($ip) == 0)
@@ -400,7 +400,7 @@ function readStaticLeasesFile()
foreach($dhcp_static_leases as $lease) {
if($lease["hwaddr"] === $mac)
{
- $error .= "Static release for MAC address (".htmlentities($mac).") already defined!
";
+ $error .= "Static release for MAC address (".htmlspecialchars($mac).") already defined!
";
break;
}
}
@@ -418,14 +418,14 @@ function readStaticLeasesFile()
$mac = $_POST["removestatic"];
if(!validMAC($mac))
{
- $error .= "MAC address (".htmlentities($mac).") is invalid!
";
+ $error .= "MAC address (".htmlspecialchars($mac).") is invalid!
";
}
$mac = strtoupper($mac);
if(!strlen($error))
{
exec("sudo pihole -a removestaticdhcp ".$mac);
- $success .= "The static address with MAC address ".htmlentities($mac)." has been removed";
+ $success .= "The static address with MAC address ".htmlspecialchars($mac)." has been removed";
}
break;
}
@@ -436,21 +436,21 @@ function readStaticLeasesFile()
$from = $_POST["from"];
if (!validIP($from))
{
- $error .= "From IP (".$from.") is invalid!
";
+ $error .= "From IP (".htmlspecialchars($from).") is invalid!
";
}
// Validate to IP
$to = $_POST["to"];
if (!validIP($to))
{
- $error .= "To IP (".$to.") is invalid!
";
+ $error .= "To IP (".htmlspecialchars($to).") is invalid!
";
}
// Validate router IP
$router = $_POST["router"];
if (!validIP($router))
{
- $error .= "Router IP (".$router.") is invalid!
";
+ $error .= "Router IP (".htmlspecialchars($router).") is invalid!
";
}
$domain = $_POST["domain"];
@@ -458,7 +458,7 @@ function readStaticLeasesFile()
// Validate Domain name
if(!validDomain($domain))
{
- $error .= "Domain name ".$domain." is invalid!
";
+ $error .= "Domain name ".htmlspecialchars($domain)." is invalid!
";
}
$leasetime = $_POST["leasetime"];
@@ -466,7 +466,7 @@ function readStaticLeasesFile()
// Validate Lease time length
if(!is_numeric($leasetime) || intval($leasetime) < 0)
{
- $error .= "Lease time ".$leasetime." is invalid!
";
+ $error .= "Lease time ".htmlspecialchars($leasetime)." is invalid!
";
}
if(isset($_POST["useIPv6"]))
@@ -483,7 +483,7 @@ function readStaticLeasesFile()
if(!strlen($error))
{
exec("sudo pihole -a enabledhcp ".$from." ".$to." ".$router." ".$leasetime." ".$domain." ".$ipv6);
- $success .= "The DHCP server has been activated ".$type;
+ $success .= "The DHCP server has been activated ".htmlspecialchars($type);
}
}
else