/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Название: | PHPru_Search + + ---------------------------------------------------------- + + Версия: | 1.0 + + Стоимость: | бесплатный скрипт + + Требования: | PHP4 + + Платформа: | любая + + Язык: | русский + + Автор: | Alex (http://www.phpru.net) + + Copyright 2003: | PHPru.net™ - All Rights Reserved. + + ---------------------------------------------------------- + + Создан: | 12 июля 2003 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */ ####################################################################### error_reporting(0); $microtime = microtime(); $microsecs = substr($microtime, 2, 8); $secs = substr($microtime, 11); $start_time = "$secs.$microsecs"; $handle = opendir('.'); $input = ''; while (($namefile = readdir($handle))!==false) { // файлы с этими расширениями не обрабатываются if (eregi("[a-zA-Z0-p_-]*.txt",$namefile) or eregi("[a-zA-Z0-p_-]*.inc",$namefile) or eregi("[a-zA-Z0-p_-]*.htaccess",$namefile)) { continue; } // а вот с такими расширениями - обрабатываются elseif(eregi("[a-zA-Z0-p_-]*.php",$namefile) or eregi("[a-zA-Z0-p_-]*.php3",$namefile) or eregi("[a-zA-Z0-p_-]*.htm",$namefile) or eregi("[a-zA-Z0-p_-]*.html",$namefile) or eregi("[a-zA-Z0-p_-]*.phtml",$namefile)) { $size=filesize($namefile); // размер конкретного файла $size=($size/1024); $size=round($size,1); $sizetotal += $size; // общий размер обработанных данных $namefile=strtolower(trim($namefile)); // имя конкретного файла $FILE = file($namefile); $text = implode(" ",$FILE); $text = strip_tags($text); $text = preg_replace("/[><\'\"]+/"," ",$text); $text = preg_replace ("/[\s,]+/", " ", strtolower($text)); // разбиваем текст файла на короткие участки, ну скажем символов по 80 // это примерно 8-12 слов $text = wordwrap ($text, 80, "|"); $input .= "".$namefile.''; $input .= "::".$size."::".$text."\r\n"; } } $fp = fopen("search.dat","w+"); flock($fp,1); fputs ($fp, $input); flock($fp,3); fclose($fp); echo '