10-26-2007, 10:11 AM
|
#2 (permalink)
|
|
Super Moderator
Join Date: Sep 2007
Posts: 165
Thanks: 0
|
While i do not recommend this, as it does not scale well at all, and you would be better off inputting the information to mysql and search using the FULLTEXT boolean/LIKE search tools over this method.. It IS possible however:
PHP Code:
<?php if($_REQUEST['search']) { $sql=mysql_query("select * from myfile"); while ($row=mysql_fetch_array($sql)) {
$file_handle = fopen("$row[path]", "r"); $contents = fread($file_handle, filesize($row[path])); fclose($file_handle); $iPos = stripos($contents, $_REQUEST['search']);
if ($iPos !== false) print $row[path]; //Output filename.txt if search is found. } } ?> <form> <input type=text name=search><input type=submit name=submit value=submit> </form>
note, this is a HORRIBLE way of doing this and i would definitely recommend you look at some generalised PHP tutorials before going further. Spend some time learning the fundamentals and it really does help :)
|
|
|
|