diff --git a/data.php b/data.php index 9d1e9390..088eac25 100644 --- a/data.php +++ b/data.php @@ -1,21 +1,11 @@ \ No newline at end of file +function checkfile($filename) { + if(is_readable($filename)) + { + return $filename; + } + else + { + // substitute dummy file + return "/dev/null"; + } +} + +?> diff --git a/php/get.php b/php/get.php index eeae056c..fada75b9 100644 --- a/php/get.php +++ b/php/get.php @@ -7,7 +7,9 @@ $type = $_GET['list']; if($type !== "white" && $type !== "black") die("Invalid list parameter"); -$rawList = file_get_contents("/etc/pihole/${type}list.txt"); +require "func.php"; + +$rawList = file_get_contents(checkfile("/etc/pihole/${type}list.txt")); $list = explode("\n", $rawList); // Get rid of empty lines