<html>
<head><title>Søk i oppskrifter</title></head>
<body>
<h1>Søk i Kaja og Marius' oppskrifter</h1>
<form>
<input name=streng value="<?=$streng?>"><br>
<input type=submit>
<input type=hidden value=submit name=submit>
</form>
<?
if ($submit=="submit")
  {
    if ($dir = @opendir("data"))
    {
      while (($file = readdir($dir)) !== false)
      {
        if ($file!="." && $file!="..")
        {
          $list_of_all_files[] = "data/".$file;
        }
      }
    }
    closedir($dir);
    if ($dir = @opendir("data3"))
    {
      while (($file = readdir($dir)) !== false)
      {
        if ($file!="." && $file!="..")
        {
          $list_of_all_files[] = "data3/".$file;
        }
      }
    }
    closedir($dir);
    while (list ($key, $file) = each ($list_of_all_files))
    {
       $helefil=file($file);
       $found="";
       foreach($helefil as $key => $val)
       {
         if (stristr($val,$streng)!==FALSE)
         {
            $found=$val;
         }
       }
       if ($found!="")
       {
         $opp=substr($file,5,-1).substr($file,-1,1);
         if (substr($opp,0,1)=="/"){$opp=substr($opp,1,-1);} 
         echo "<a href=\"enopp.php3?opp=$opp\">";
         echo $opp."</a><br>";
         echo eregi_replace("(".$streng.")","<b>\\1</b>",$found)."<hr>";
       }

     }
   }
