Last updated on January 20th, 2023 at 09:50 am

Script to search for files that starts with a string [Whatever you give] inside the query string.
For instance if the below script is saved inside a file say search_files.php then the script will work if you provide

$dir = "logs";
$dh = opendir($dir);
$dh1 = opendir($dir);
while (($file = readdir($dh)) !== false) {
$stng = strpos($file,$name_prom);
if($stng === 0)
        echo "<a HREF=\"$file\">$file</a><br />\n";

In the above script we are searching a directory named logs and as per the query string the name of the file we are searching is “access_log

Leave a Reply

Your email address will not be published. Required fields are marked *