PHP Code:
$fileArray = file($file);
if (file_exists($file))
You need to do the file_exists check before opening it with file, so put $fileArray = file($file) inside your if statement.
Always best to try and be a bit more descriptive with your errors, so perhaps "Error: file not found" would be better.
Try this instead of the while loop:
PHP Code:
foreach($fileArray as $line) {
if(stristr($SearchString, $line)) {
print htmlentities($line);
}
}
}
Have you not considered using the class I posted in my first reply? Its tested, documented and works. Might save you a lot of time, and the implementation is a piece of cake.
__________________