Heres some code :
<font face="Verdana, Arial, Helvetica, sans-serif" color="#003366" size="1">
<table width="547" border="0" cellspacing="0" cellpadding="0" height="198">
<?
// SITE KEY WORD SEARCHER - Alan Fox May 2002
// LIST OF ALL SEARCHABLE PAGES - UPDATE HERE
// just add new pages as below no othes changes needed
// NOTE : include folders above index eg $files[] = "tetris/tetris.htm"
// NOTE : You will get an onscreen error if page doesnt exist !
// so update this page if you change any page names
// make sure all pages have the following
// <title> Name of file here </title>
// AND
// <meta NAME="description" CONTENT=" Description here, can use <br> for new line. No double quotes only single ">
$files[] = "home.htm";
$files[] = "about_us.htm";
$files[] = "help/all.htm";
$files[] = "array.htm";
$real_search = $search;
$search = substr($search, 1, 8);
$count=0;
echo "Searching for <b>".$real_search."</b>....<br><br>";
echo "<hr>";
foreach ( $files as $file )
{
// open each file
if(! $open_file = file($file))
{
// echo "CANT OPEN<br>";
}
else
{
//echo "OPENED FILE<br>" ;
foreach($open_file as $a)
{
//echo "".$open_file[$a]."<br>";
if ( eregi("<title>(.*)</title>", $a , $out)) {
$name = $out[1];
}
if ( eregi('<meta NAME="description" CONTENT="(.*)">', $a, $out)) {
//$text = $out[1];
}
// if(preg_match("/.$search./",$a) )
if(preg_match("/.$search./",$a) )
{
//arraydesc[$file] = $text;
$arraydesc[$file] .= $a;
$arraytitle[$file] = $name;
$array[$file] += 1;
if($array[$file] == 1)
{$count += 1;}
//$text = $a;
//echo "FOUND alan IN ".$file."<br>";
}
}
?>
<?php
if ($array[$file] > 0)
{
//////////////////////////////////////////////////////////////////////////
// RETURNED PAGES
?>
<tr>
<td width="10%" > </td>
<td ><br>
<div align="left">
<p>
<font color="#FF6600" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b><?=$arraytitle[$file]?></b><br>
<font color="#003366">
<?echo "...".$arraydesc[$file]."..."?> <br>
<a href="http://www.homepage.com/<?=$file?>" target="main"><?=$file?></a><br>
</p></td></tr>
<?php
$text = "";
$name = "";
////////////////////////////////////////////////////////////////////////////
}
}
} //end of loop
if($count == 0)
{
echo "Sorry there were no pages found containing the word ".$real_search."<br>";
}
else
{
echo "<br>".$count." pages found in total matching ".$real_search."<br>";
}
?>
</font>
</table>