index.htm
>>>>>>>>>>>>>>.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/css>
.en {
font-family: "MS Shell Dlg,Tahoma"; font-size: 9px
}
FONT    {
font size="9pt"
}
a:link, a:visited { text-decoration: none; color: #415A3D }
a:hover { text-decoration: underline }
body { scrollbar-base-color: #EDF1EE; scrollbar-arrow-color: #F7F9F8; font-size: 12px; background-color: efefef }
table, td { font-family: Tahoma, Verdana; color: #3F5A3B; font-size: 12px }
textarea, input, object { font-family: Tahoma, Verdana; font-size: 12px;  color: #3F5A3B; font-weight: normal; background-color: #EDF1EE }
select { font-family: Arial; font-size: 12px;  color: #3F5A3B; font-weight: normal; background-color: #EDF1EE }
th
{
background-color: #877C59;
color: white;
font-size: 12px;
font-weight:bold;
}
td.TableTitle2
{
background-color: #DFD4B9;
}
td.TableBody1
{
background-color: #E8DFC9;
}
td.TableBody2
{
background-color: #DFD4B9;
}
td.TopDarkNav
{
background-image: url('skin/default/topbg.gif');
}
td.TopLighNav
{
background-image: url('skin/default/bottombg.gif');
}
td.TopLighNav1
{}
td.TopLighNav2
{
background-color:#D3C6A6
}
.tableBorder1
{
width:98%;
border: 1px; 
background-color: #51441E;
}
.tableBorder2
{
width:98%;
border: 1px #D8D4CB solid; 
background-color: #D3B668;
}#TableTitleLink A:link, #TableTitleLink A:visited, #TableTitleLink A:active {
COLOR: #FFFFFF;
TEXT-DECORATION: none;
}
#TableTitleLink A:hover {
COLOR: #FFFFFF;
TEXT-DECORATION: underline;}input, select, textarea{
font-family:Tahoma,Verdana,&#23435;&#20307;; font-size: 12px; line-height: 15px}
}
.normalTextSmall 

    font-size : 12px;
    color : #000000; 
    font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style1 {
font-family: Tahoma, Arial;
font-size: 11px;
color: #5E8657;
}
</style>
<title>全文检索</title>
<base target="_top">
</head>
<body bgcolor="#efefef"  text="#000000" id="all" leftmargin="0" rightMargin=0 topmargin="0" link="#000020" vlink="#000020" alink="#000020">
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr><td>
<table width="100%" height="170" border="0" align="center" cellpadding="0" cellspacing="1">
  <tr><td valign="bottom" background="http://www.gzuu.com/images/logo.jpg">
<table width="100%"  border="0" cellspacing="0">
    <tr>
      <td width="180" height="55"><div align="right"></div></td>
      <td><div align="center"></div>
        <table height="20"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#416A2F" style="FILTER: alpha(opacity=45)" width="552" >
        <tr bgcolor="#FFFFFF" >
<td width="59"><div align="center"><a href="http://www.gzuu.com" target=_blank>&#32852;&#30431;&#39318;&#39029;</a></div></td>
<td width="59"><div align="center"><a href="http://bbs.gzuu.com/">&#35770;&#22363;</a></div></td>
<td width="52"><div align="center">&#20132;&#21451;</div></td>
          <td width="52"><div align="center">&#32593;&#25991;</div></td>
 <td width="56"><div align="center"><a href="http://flash.gzuu.com">FLASH</a></div></td>
<td width="69"><div align="center"><a href="http://down.gzuu.com">&#28304;&#30721;&#19979;&#36733;</a></div></td>
  <td width="55"><div align="center"><a href="http://bbs.gzuu.com/face.php">&#32852;&#30431;&#31168;</a></div></td>
  <td width="52"><div align="center"><a href="gb">&#30041;&#35328;&#31807;</a></div></td>
<td width="86"><div align="center">&#22235;&#32500;&#24037;&#20316;&#23460;</div></td>
        </tr>
      </table></td>
      <td width="10"> </td>
    </tr>
  </table></td>
  </tr></table></td>
</tr>
</table><br>
<br>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="30%">&nbsp;</td>
    <td width="10%">&nbsp;</td>
    <td>站 内 全 文 检 索</td>
    <td width="30%">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="2"><form method="post" action="search.php">
      <input type="text" name="key" size=40 value="">
      <input name="submit" type="submit" value="检索">
    </form></td>
    <td>&nbsp;</td>
  </tr>
</table>
<br>
<br>
<table width="750" border="0" cellspacing="0" cellpadding="0"  align="center">
  <tr>
    <td><table width="748"  border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr>
    <td height="80" background="images/footer.jpg"><center><span class="mediumtxt">
    &lt; <a href="http://www.gzuu.com" class="mediumtxt">&#36149;&#24030;&#22823;&#23398;&#29983;&#32852;&#30431;</a> - <a href="http://work.gzuu.com/" class="mediumtxt" target="_blank">
    &#22235;&#32500;&#24037;&#20316;&#23460;</a> &gt;</span>
<br>
<span style="color: #5E8657; font-size: 11px; font-family: Tahoma, Arial">
    Powered by <a href="http://www.gzuu.com" style="color: #5E8657" target="_blank"><b>
    &#22235;&#32500;&#24037;&#20316;&#23460;</b> </a></span>风逍遥
    </center></td>
  </tr>
</table></td>
  </tr>
</table>
</body>
</html>

解决方案 »

  1.   

    search.php>>>>>>>>>>>>>>>>>>>
    <?php  
    require ("search.inc");
    if (function_exists("set_time_limit") && !get_cfg_var('safe_mode')){
    set_time_limit(600);}
    function get_msg($path) {  
    global $key, $i;  
    $handle = opendir($path);  
    while ($filename = readdir($handle)) {  
    //echo $path."/".$filename."<br>";  
    $newpath = $path."/".$filename;  
    if (is_file($newpath)) {  
    $fp = fopen($newpath, "r");  
    $msg = fread($fp, filesize($newpath));  
    fclose($fp);  
    match_show($key, $msg, $newpath, $filename);  
    }  
    if (is_dir($path."/".$filename) && ($filename != ".") &&  ($filename != "..")) {  
    //echo "<BR><BR><BR>".$newpath."<BR><BR><BR>";  
    get_msg($path."/".$filename);  
    }  
    }  
    closedir($handle);  
    return $i;  
    }  function match_show($key, $msg, $newpath, $filename) { 
      global $ar, $i; 
      $key = chop($key); 
      if($key) { $check_type = preg_match("/\.html?$/", $filename); 
      if($check_type) {$title = getHtmlTitle($msg);}
        $msg = preg_replace("/<style>.+<\/style>/is", "", $msg); 
        $msg = preg_replace("/<[^>]+>/", "", $msg); 
        $value = preg_match("/.*$key.*/i", $msg, $res); 
            if($value) { 
         
    $res[0] = preg_replace("/$key/i", "<FONT COLOR=\"red\">$key</FONT>", $res[0]); 
    $k = $res[0];
    $k = strrchr($k, "<FONT");
          $k = substr($k, 1, 100);  
          $k = "<FONT COLOR=\"red\">$key<$k";
          if($title) {$m = $title;} else {$m = $filename;}
          $i++; 
          $link = $newpath; 
          $ar[] = "$i.◆<a href=\"$link\">$m</a><BR><BR>" .$k."<BR><br>"; 
        } 
      }else { 
        echo "请输入关键词"; 
        exit; 
      } 
    } function getHtmlTitle($msg) {

    /* Locate where <TITLE> is located in html file. */
    $lBound = strpos($msg, '<title>') + 7; //7 is the lengh of <TITLE>. if ($lBound < 1)
    return; /* Locate where </TITLE> is located in html file. */
    $uBound = strpos($msg, '</title>', $lBound); if ($uBound < $lBound)
    return; /* Clean HTML and PHP tags out of $title with the madness below. */
    $title = ereg_replace("[\t\n\r]", '', substr($msg, $lBound, $uBound - $lBound));
    $title = trim(strip_tags($title)); if (strlen($title) < 1) //A blank title is worthless.
    return; return $title;
    }$i = get_msg(".");
    if (empty($page)) $page=1;
    $maxresult=($page*20);
    $resultcount = count($ar);
    if ($resultcount%20==0) $maxpageno=$resultcount/20;
    else $maxpageno=floor($resultcount/20)+1;
    if ($page>$maxpageno) { $page=$maxpageno; $pagemax=$resultcount-1; $pagemin=max(0,$result_count-20);}
    elseif ($page==1) {$pagemin=0; $pagemax=min($result_count-1,20-1); }
    else { $pagemin=min($resultcount-1,20*($page-1)); $pagemax=min($resultcount-1,$pagemin+20-1); }
    $maxresult=min($maxresult,$resultcount);
    echo "<p align=\"center\">";
    echo "检索结果";
    echo "</p><hr>";
    for ($i=max(0,$maxresult-20); $i<$maxresult; $i++) {
    print $ar[$i];
    }
    echo "<hr><p align=\"center\">";
    echo " 已经搜索到了 $resultcount 条信息";
          $nextpage=$page+1;
          $previouspage=$page-1;
    echo " --- [ <a href='search.php?key=$key&page=$nextpage'  target='_self'>搜索下 20 个结果</a> ]";
    echo " [ <a href='search.php?key=$key&page=$previouspage'  target='_self'>返回上 20 个结果</a> ]";
    exit;?>  
      

  2.   

    search.inc
    >>>>>>>>>>>>>>>>>>>>>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <STYLE type=text/css>BODY { 
             font-family : 宋体;
             font-size : 10.5pt;
             font-weight : medium;
             background : #CCCCFF;
             position : absolute
    }
     P {
    FONT-SIZE: 10.5pt
    }
     TABLE {
    FONT-SIZE: 10.5pt
    }
     TD {
    FONT-SIZE: 10.5pt; LETTER-SPACING: 1pt; LINE-HEIGHT: 15pt
    }
      A:LINK { 
             color : #000000;;TEXT-DECORATION: none
            
    }
      A:VISITED { 
             color : #000000;;TEXT-DECORATION: none
            
    }
      A:HOVER { 
             color : blue;TEXT-DECORATION: underline
            
    }<!--
    a {text-decoration: none}
    --></style>
    <title>全文检索</title>
    <base target="_blank">
    </head>
      

  3.   

    用JS做全站搜索???
    如果你的网站是htm组成的倒可以考虑用fso,
    如果是数据库的恐怕要用到后台脚本了
      

  4.   

    网站不全是HTM构成的,但是要搜索的内容都是HTM的,所以可能可以用FSO。
    顺便问一句,什么是FSO?