head title 千花飛舞之站內(nèi)搜索引擎 /title /head body CENTER FORM METHOD=POST ACTION="searchresult.asp" TABLE BGCOLOR="" />

欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來(lái)到入門教程網(wǎng)!

編程問(wèn)答

當(dāng)前位置:主頁(yè) > 網(wǎng)絡(luò)編程 > 編程問(wèn)答 >

如何用FileSystemObject組件來(lái)做一個(gè)站內(nèi)搜索?

來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-11|欄目:編程問(wèn)答|點(diǎn)擊: 次

searchpage.htm
' 搜索頁(yè)面.

<html><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

<head>
        <title>
千花飛舞之站內(nèi)搜索引擎</title>
    </head>
    <body>
        <CENTER>
            <FORM METHOD=POST ACTION="searchresult.asp">

    <TABLE BGCOLOR="#BLUE" BORDER="0">
      <tr>                       
        <td ROWSPAN="3" BGCOLOR="#BLUE" width="21" nowrap></td>
        <td width="363" nowrap> <FONT COLOR="#FFFFFF">
          <INPUT TYPE="text" NAME="SearchText" SIZE="22">
           <INPUT TYPE="checkbox" NAME="Case">
         
高度敏感</FONT> </td>
        <td ROWSPAN="3" width="10">
          <INPUT TYPE="submit" VALUE="
搜索">
                                <P>
          <INPUT TYPE="reset" VALUE="
重寫">
                        </td>
        <td ROWSPAN="3" BGCOLOR="#BLUE" width="28"></td>
                    </tr>
                    <tr>

        <td width="363" nowrap> <FONT COLOR="#FFFFFF">
搜索返回結(jié)果
          <select name="rLength" >
            <option value="200" selected>
詳細(xì)信息</option>
            <option value="100">
簡(jiǎn)短信息</option>
            <option value="0">
只返回連接</option>
          </select>
                                <select NAME="rResults">
                                    <OPTION VALUE="10" selectED>10
                                    <OPTION VALUE="25">25
                                    <OPTION VALUE="50">50
                                </select>
                            </FONT>
                        </td>
                    </tr>
                    <tr>

        <td width="363" nowrap> <FONT COLOR="#FFFFFF">
必須包含:
        <INPUT TYPE="checkbox" NAME="iImage">
圖片
        <INPUT TYPE="checkbox" NAME="iZips">Zip
格式
        <INPUT TYPE="checkbox" NAME="iJavaS"> javascript
                            </FONT>
                        </td>
                    </tr>
                </TABLE>
            </FORM>
            </CENTER>
<DL>
</DL>
</body></html>

searchresult.asp
' 搜索結(jié)果.
<html>
<head>
<title>
千花飛舞站內(nèi)'<%=Request("SearchText")%>'之搜索結(jié)果</title>
</head>
<body>
<B>'<%=Request("SearchText")%>'
的搜索結(jié)果</B><BR>
<%
Const fsoForReading = 1
Dim objFile, objFolder, objSubFolder, objTextStream
Dim bolCase, bolFileFound, bolTagFound
Dim strCount, strDeTag, strExt, strFile, strContent, strRoot, strTag, strText, strtitle, strtitleL
Dim reqImage, reqJavaS, reqLength, reqNumber, reqZip

strFile = ".asp .htm .html .js .txt .css"
strRoot = "/"
strText = Request("SearchText")
strTag = Chr(37) & Chr(62)
bolFileFound = False
bolTagFound = False
If Request("Case") = "on" Then bolCase = 0 Else bolCase = 1
If Request("iImage") = "on" Then reqImage = "<IMG" Else reqImage = ""
If Request("iZips") = "on" Then reqZips = ".zip" Else reqImage = ""
If Request("iJavaS") = "on" Then reqJavaS = "javascript" Else reqImage = ""
If Request("rResults") = "10" Then reqNumber = 10
If Request("rResults") = "25" Then reqNumber = 25
If Request("rResults") = "50" Then reqNumber = 50
reqLength = Request("rLength")

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Server.MapPath(strRoot))

schSubFol(objFolder)

Sub schSubFol(objFolder)
    For Each objFile in objFolder.Files
        If strCount + 1 > reqNumber or strText = "" Then Exit Sub
        If Response.IsClientConnected Then
            Set objTextStream = objFSO.OpenTextFile(objFile.Path,fsoForReading)

            strContent = objTextStream.ReadAll

            If InStr(1, strContent, strTag, bolCase) Then
            Else
                If Mid(objFile.Name, Len(objFile.Name) - 1, 1) = "." Then strExt = Mid(objFile.Name, Len
(objFile.Name) - 1, 2)
                If Mid(objFile.Name, Len(objFile.Name) - 2, 1) = "." Then strExt = Mid(objFile.Name, Len
(objFile.Name) - 2, 3)
                If Mid(objFile.Name, Len(objFile.Name) - 3, 1) = "." Then strExt = Mid(objFile.Name, Len
(objFile.Name) - 3, 4)
                If Mid(objFile.Name, Len(objFile.Name) - 4, 1) = "." Then strExt = Mid(objFile.Name, Len
(objFile.Name) - 4, 5)
                If InStr(1, strContent, strText, bolCase) And _
                    InStr(1, strContent, reqImage, 1) And _
                    InStr(1, strContent, reqZips, 1) And _
                    InStr(1, strContent, reqJavaS, 1) And _
                    Instr(1, strFile, strExt, 1) Then
                    If InStr(1, strContent, "<title>", 1) Then strtitle = Mid(strContent, InStr(1, strContent, "<title>", 1) + 7, InStr(1, strContent, "</title>", 1)) Else strtitle = "
未命名"
                    strCount = strCount + 1
                    Response.Write "<DL><DT><B><I>"& strCount &"</I></B> - <A HREF=" & objFile.Path & ">"
& strtitle & "</A></A></DT><BR><DD>"
                    strtitleL = InStr(1, strContent, "</title>", 1) - InStr(1, strContent, "<title>", 1) +7

                    strDeTag = ""
                    bolTagFound = False

                    Do While InStr(strContent, "<")
                        bolTagFound = True
                        strDeTag = strDeTag & " " & Left(strContent, InStr(strContent, "<") - 1)
                        strContent = MID(strContent, InStr(strContent, ">") + 1)
                    Loop

                    strDeTag = strDeTag & strContent
                    If Not bolTagFound Then strDeTag = strContent

                    If reqLength = "0" Then Response.Write objFile.Path & "</DD></DL>" Else Response.Write
Mid(strDeTag, strtitleL, reqLength) & "...<BR><FONT SIZE='2'>URL: " & objFile.Path & " -
上次修改時(shí)
: " & objFile.DateLastModified & " - " & FormatNumber(objFile.Size / 1024)
& "Kbytes</FONT></DD></DL>"
                    bolFileFound = True
                End If
                objTextStream.Close
            End If
        End If
    Next
End Sub

For Each objSubFolder in objFolder.SubFolders
    schSubFol(objSubFolder)
Next

If Not bolFileFound then Response.Write "
抱歉,沒(méi)有找到您要搜索的結(jié)果!"
If bolFileFound then Response.Write "<B>
搜索結(jié)束</B>"

Set objTextStream = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%>
</body></html>

 

 

[1]

上一篇:如何制作K線圖?

欄    目:編程問(wèn)答

下一篇:如何實(shí)現(xiàn)電子郵件的自動(dòng)發(fā)送?

本文標(biāo)題:如何用FileSystemObject組件來(lái)做一個(gè)站內(nèi)搜索?

本文地址:http://mengdiqiu.com.cn/a1/bianchengwenda/12083.html

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有