after the search, The script riches the folder and read each individual file
and if it found h1 it will put each word of it in the array $h1words
the problem is, i want to compare the two arrays $words and $h1words
and if there is one similar character, then it will show the h1
if (isset($_GET["sub"]) && $_GET["sub"]=="Search"){
// Open a known directory, and proceed to read its contents
$dir="c1/cat1/";
$words=explode(" ",$_GET["search"]);
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file=="" or $file=="." or $file==".." or $file=="index.php" or $file=="index.html") {
continue;
}
$filet=$dir.$file;
if (is_readable($filet)){
$filee=fopen($filet,"r");
while(!feof($filee)){
$str=strip_tags(fgets($filee),"<h1>");
$findme="<h1>";
$pos = strpos($str, $findme);
if ($pos!==false){
$h1words=explode(" ",$str);
}else{}
}
echo "<br /><hr /><br />";
fclose($filee);
}
}
closedir($dh);
}
}
}