Hello, I am currently making a database lookup tool that will let a user search for a term (username, name, etc.) and the engine will search mutliple text files for that specific term. Right now I am having an issue, I want the script to read all the files in the location given but it will only read one .txt file in that location. I want it to read multiple. if someone could help that would be awesome!
here is my PHP script for analysis:
here is my PHP script for analysis:
Code
<?php
$file = glob('*.txt');
$query = $_GET['query'];
header('Content-Type: text/plain');
$contents = file_get_contents($file);
$pattern = preg_quote($query, '/');
$pattern = "/^.*$pattern.*\$/m";
if(preg_match_all($pattern, $contents, $matches)){
echo "Found matches:\n";
echo implode("\n", $matches[0]);
}
else{
echo "No matches found";
}

