From ea38da1ef9ad525c4909d2296c79e66aa0bb96ae Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Thu, 15 Aug 2019 12:00:57 +0100 Subject: [PATCH] Added a check so that it will only use the master scp file if uploads/masterscp.txt is readable --- application/controllers/Lookup.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/application/controllers/Lookup.php b/application/controllers/Lookup.php index b6112fd3..c44c31da 100644 --- a/application/controllers/Lookup.php +++ b/application/controllers/Lookup.php @@ -29,15 +29,18 @@ class Lookup extends CI_Controller { // SCP results from master scp db $file = 'updates/masterscp.txt'; - $lines = file($file, FILE_IGNORE_NEW_LINES); + if (is_readable($file)) { - $input = preg_quote($call, '~'); + $lines = file($file, FILE_IGNORE_NEW_LINES); + $input = preg_quote($call, '~'); - $result = preg_grep('~' . $input . '~', $lines, 0); + $result = preg_grep('~' . $input . '~', $lines, 0); - foreach ($result as &$value) { - echo " ".$value. " "; + foreach ($result as &$value) { + echo " ".$value. " "; + } } + } }