Unfinished Search Script !?!
Posted: Wed Oct 22, 2003 5:49 am
Hi there,
Below is a basic search script of mine which i want to make more useful.
I must to ignore html tags and script codes (JS and PHP).
I need to highlight the search term in results...
Is there any idea how to do these?
Thanks,
Have a nice day!
greetings from turkey
?>
Below is a basic search script of mine which i want to make more useful.
I must to ignore html tags and script codes (JS and PHP).
I need to highlight the search term in results...
Is there any idea how to do these?
Thanks,
Have a nice day!
greetings from turkey
Code: Select all
<?
// Opening directory & Reading the files...
$diary_directory = opendir(".");
while($filename = readdir($diary_directory))
{
if(!is_dir($filename))
{
if(/*eregi(".php",$filename) || */eregi(".html",$filename) || eregi(".htm",$filename))
{ $fl[] = $filename; }
}
}
closedir($diary_directory);
// Matching?
$k=0;
for($i=0; $i<count($fl);$i++)
{
$file = file($fl[$i]);
$file = implode("",$file);
if(eregi($kriter,$file))
{
$sonuc[] = $fl[$i];
$k++;
}
}
// Displaying Results...
if($k==0) { echo "Hiç Sonuç yok"; }
else
{
echo $k." Sonuc Bulundu:<br>";
for($p=0;$p < count($sonuc); $p++)
{
echo "<li><a href='$sonuc[$p]'>".$sonuc[$p]."</a><br>";
}
}
?>