Могу дать тебе похожий пример.
Недавно ради прикола сделал.
Смысл нижеприведенного скрипта в том, что он шерстит ВСЕ файлы сайта с целью найти определенную строку в содержимом. Фильтр на имя файла сделаешь?
Если нужен совсем конкретный пример, то раньше субботы не выйдет, Извини.
Если терпит, то в субботу запостю (я правильно написал? думаю нет
)
Собно скрипт:
<?
/////////////////////////////////////////////////////
//
// File searcher by The0ReTiC
// mail me to [email]l0g_err@xakep.ru[/email] in any questions
//
////////////////////////////////////////////////////
function whole_search($text_2_search,$directory_name)
{
$dirt = @opendir($directory_name);
//chdir($directory_name);
while($file_handler = readdir($dirt)) //Reading directory
{
clearstatcache();
if (($file_handler !=\'.\')&&($file_handler != \'..\')):
if(is_dir($directory_name.\'/\'.$file_handler)):
$nd = $directory_name.\'/\'.$file_handler;
echo$nd.\'
\';
whole_search($text_2_search,$nd);
else:
echo\'Parsing file: <b>\'.$file_handler.\'</b> ->> \';
$file_content = file($directory_name.\'/\'.$file_handler);
$founded = 0;
for($step = 0;$step<sizeof($file_content);$step++)
{
if(eregi($text_2_search,$file_content[$step])):
$founded++;
endif;
}
if($founded >0):
echo\'string <b>\'.$text_2_search.\'</b> found in file <i>\'.$file_handler.\'</i> <b>\'.$founded.\'</b> times
\';
else:
echo\'String not found
\';
endif; //$founded;
endif; // Is file
endif; // Is not . OR ..
}
@closedir($directory_name);
}
$my_text = "simple text";
whole_search($my_text,$DOCUMENT_ROOT);
?>