PHP头条
热点:

站内搜索HTML版


 

  1. <?php    
  2. /****************************************************     
  3. program : Spr2[search_html]     
  4. Author  : uchinaboy      
  5. E-mail  : uchinaboy@163.com     
  6. QQ      : 16863798     
  7. Date    : 2001-8-9    
  8. ****************************************************/    
  9. //require("config.inc.php");    
  10.  
  11. function get_msg($path) {    
  12. global $key$i;    
  13. $handle = opendir($path);    
  14. while ($filename = readdir($handle)) {    
  15. //echo $path."/".$filename."<br>";    
  16. $newpath = $path."/".$filename;    
  17. $check_type = preg_match("/.html?$/"$filename);    
  18. if (is_file($newpath) && $check_type) {    
  19. $fp = fopen($newpath"r");    
  20. $msg = fread($fpfilesize($newpath));    
  21. fclose($fp);    
  22. match_show($key$msg$newpath$filename);    
  23. }    
  24. if (is_dir($path."/".$filename) && ($filename != ".") &&  ($filename != "..")) {    
  25. //echo "<BR><BR><BR>".$newpath."<BR><BR><BR>";    
  26. get_msg($path."/".$filename);    
  27. }    
  28. }    
  29. closedir($handle);    
  30. return $i;    
  31. }    
  32.  
  33. function match_show($key$msg$newpath$filename) {    
  34. global $key$i;    
  35. $key = chop($key);    
  36. if ($key) {    
  37. $msg = preg_replace("/<style>.+</style>/is"""$msg);    
  38. $msg = str_replace(" """$msg);    
  39. $msg = preg_replace("/<[^>]+>/"""$msg);    
  40. $value = preg_match("/.*$key.*/i"$msg$res);    
  41. if ($value) {    
  42. $res[0] = preg_replace("/$key/i""<FONT SIZE="2"  COLOR="red">$key</FONT>"$res[0]);    
  43. $i++;    
  44. $link = $newpath;    
  45. print "<a href="$link">$filename</a><BR>";    
  46. print $res[0].

    www.phpzy.comtrue/phprm/23518.htmlTechArticle站内搜索HTML版 ?php /**************************************************** program:Spr2[search_html] Author:uchinaboy E-mail:uchinaboy@163.com QQ:16863798 Date:2001-8-9 ****************************************************/ //require(con...

相关文章

    暂无相关文章

PHP之友评论

今天推荐