in findAds: ensure count($exploded) == 8

This commit is contained in:
Promofaux
2016-09-16 23:42:13 +01:00
parent b35b0dd7a6
commit f53a77301f
+11 -6
View File
@@ -267,13 +267,18 @@
function findAds($var) {
$exploded = explode(" ", $var);
$tmp = $exploded[count($exploded)-4];
$tmp2 = $exploded[count($exploded)-5];
$tmp3 = $exploded[count($exploded) -3];
$hostname = trim(file_get_contents("/etc/hostname"), "\x00..\x1F");
if(count($exploded) == 8) {
$tmp = $exploded[count($exploded) - 4];
$tmp2 = $exploded[count($exploded) - 5];
$tmp3 = $exploded[count($exploded) - 3];
$hostname = trim(file_get_contents("/etc/hostname"), "\x00..\x1F");
//filter out bad names and host file reloads:
return (substr($tmp, strlen($tmp) - 12, 12) == "gravity.list" && $tmp2 != "read" && $tmp3 != "pi.hole" && $tmp3 != $hostname);
}
else{
return false;
}
//filter out bad names and host file reloads:
return (substr($tmp, strlen($tmp) - 12, 12) == "gravity.list" && $tmp2 != "read" && $tmp3 != "pi.hole" && $tmp3 != $hostname) ;
}
function findForwards($var) {