<html>
<head><title>Søk i dagboken</title></head>
<body>
<h1>Søk i Kaja & Marius' dagbok</h1>
<form>
<input name=streng value="<?=$streng?>"><br>
<input type=submit>
<input type=hidden value=submit name=submit>
</form>
<?
  $month['01']="Jan";
  $month['02']="Feb";
  $month['03']="Mar";
  $month['04']="Apr";
  $month['05']="Mai";
  $month['06']="Jun";
  $month['07']="Jul";
  $month['08']="Aug";
  $month['09']="Sep";
  $month['10']="Okt";
  $month['11']="Nov";
  $month['12']="Des";
  if ($submit=="submit") 
  {
    if ($dir = @opendir("dager")) 
    {
      while (($file = readdir($dir)) !== false) 
      {
        if ($file!="." && $file!="..")
        {
          $list_of_all_files[] = $file;
        }        
      }
    }
    closedir($dir);
    sort($list_of_all_files);
    reset($list_of_all_files);
    while (list ($key, $file) = each ($list_of_all_files))
    {
       $helefil=file("dager/".$file);
       $found="";
       foreach($helefil as $key => $val)
       {
         if (stristr($val,$streng)!==FALSE)
         {
            $found=$val;
         }
       }
       if ($found!="")
       {
	 $year=substr($file,7,4);
         $mon=substr($file,12,2);
	 $day=substr($file,15,2);
	 echo "<a href=alle2.php3?year=$year&month=$month[$mon]&day=$day>";
         echo $day."/".$mon." ".$year."</a><br>";
         echo eregi_replace("(".$streng.")","<b>\\1</b>",$found)."<hr>";
       }
    }
  }
?>
<a href="">Tilbake til dagbok-forsiden</a>
