<?php

    $h=opendir('.');

    while ($file = readdir($h)) {
        echo "$file ..."; flush();

        if (preg_match('/\.html$/',$file)) {

          $x=implode("",file($file));          

          $a=preg_match('/<!--   -->(.*)'.
               '(<!--   -->|<\/BODY>[\r\n]*<\/HTML>)/s',$x,$z);
          //  "</HTML>..</BODY>"  -   
          //  - -    
          // 05_configuration.html ..  :
          // http://www.webclub.ru/materials/php3/05_configuration.html
          //     :-)

          $z[1]=preg_replace("/http:\/\/www.webclub.ru\/materials\/php3\//","./",$z[1]);
          $z[1]=preg_replace("/http:\/\/www.webclub.ru\//","./",$z[1]);
          
          if ($a) $a="true"; else $a="false";
          echo " #####--[ Ok! ]--##### $a";

          $f=fopen($file,"w+");
          fputs($f,"<html><head><link rel=stylesheet href=php.css type='text/css'></head>\n\n\n\n$z[1]\n\n\n<br><br><br>$counter");
          fclose($f);

        }
        echo "\n";

    }
    closedir($h); 



?>