首页 > 互联资讯 > 技术交流  > 

如何用FileSystemObject组件来做一个站内搜索?

searchpage.htm
' 搜索页面.


</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 9.0pt; mso-ascii-font-family: ' '; mso-hansi-font-family: ' '">千花飞舞之站内搜索引擎</SPAN><SPAN lang=EN-US style="FONT-FAMILY: ' '; mso-bidi-font-size: 9.0pt">























高度敏感

搜索">


重写">

搜索返回结果



必须包含:
图片
Zip
格式
javascript








searchresult.asp
' 搜索结果.


</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 9.0pt; mso-ascii-font-family: ' '; mso-hansi-font-family: ' '">千花飞舞站内</SPAN><SPAN lang=EN-US style="FONT-FAMILY: ' '; mso-bidi-font-size: 9.0pt">'<%=Request("SearchText")%>'</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 9.0pt; mso-ascii-font-family: ' '; mso-hansi-font-family: ' '">之搜索结果</SPAN><SPAN lang=EN-US style="FONT-FAMILY: ' '; mso-bidi-font-size: 9.0pt">


'<%=Request("SearchText")%>'
的搜索结果

<%
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 = "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, "", 1) Then strtitle = Mid(strContent, InStr(1, strContent, "<title>", 1) + 7, InStr(1, strContent, "", 1)) Else strtitle = "未命名"
strCount = strCount + 1
Response.Write "
"& strCount &" - "
& strtitle & "

"
strtitleL = InStr(1, strContent, "", 1) - InStr(1, strContent, "", 1) +7<br><br> strDeTag = ""<BR> bolTagFound = False<br><br> Do While InStr(strContent, "<")<BR> bolTagFound = True<BR> strDeTag = strDeTag & " " & Left(strContent, InStr(strContent, "<") - 1)<BR> strContent = MID(strContent, InStr(strContent, ">") + 1)<BR> Loop<br><br> strDeTag = strDeTag & strContent<BR> If Not bolTagFound Then strDeTag = strContent<br><br> If reqLength = "0" Then Response.Write objFile.Path & "</DD></DL>" Else Response.Write <BR>Mid(strDeTag, strtitleL, reqLength) & "...<BR><b><FONT SIZE='2'>URL: " & objFile.Path & " - </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 9.0pt; mso-ascii-font-family: ' '; mso-hansi-font-family: ' '">上次修改时</SPAN><SPAN lang=EN-US style="FONT-FAMILY: ' '; mso-bidi-font-size: 9.0pt"><BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 9.0pt; mso-ascii-font-family: ' '; mso-hansi-font-family: ' '">间</SPAN><SPAN lang=EN-US style="FONT-FAMILY: ' '; mso-bidi-font-size: 9.0pt">: " & objFile.DateLastModified & " - " & FormatNumber(objFile.Size / 1024) <BR>& "Kbytes</FONT></b></DD></DL>"<BR> bolFileFound = True<BR> End If<BR> objTextStream.Close<BR> End If<BR> End If<BR> Next<BR>End Sub<br><br>For Each objSubFolder in objFolder.SubFolders<BR> schSubFol(objSubFolder)<BR>Next<br><br>If Not bolFileFound then Response.Write "</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 9.0pt; mso-ascii-font-family: ' '; mso-hansi-font-family: ' '">抱歉</SPAN><SPAN lang=EN-US style="FONT-FAMILY: ' '; mso-bidi-font-size: 9.0pt">,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 9.0pt; mso-ascii-font-family: ' '; mso-hansi-font-family: ' '">没有找到您要搜索的结果</SPAN><SPAN lang=EN-US style="FONT-FAMILY: ' '; mso-bidi-font-size: 9.0pt">!"<BR>If bolFileFound then Response.Write "<B></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 9.0pt; mso-ascii-font-family: ' '; mso-hansi-font-family: ' '">搜索结束</SPAN><SPAN lang=EN-US style="FONT-FAMILY: ' '; mso-bidi-font-size: 9.0pt"></B>"<br><br>Set objTextStream = Nothing<BR>Set objFolder = Nothing<BR>Set objFSO = Nothing<BR>%><BR><script type="text/javascript">var root_dir="";var ey_u_switch=1;var ey_aid=24689;</script> <script language="javascript" type="text/javascript" src="/public/static/common/js/ey_footer.js?t=v1.6.2"></script> </body></html><o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US> <o:p></o:p></SPAN></P><P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt"><SPAN lang=EN-US style="FONT-FAMILY: ' '; mso-bidi-font-size: 9.0pt"> <o:p></o:p></SPAN></P></p><p align='center'><b>[1]</b></p> </div> <div class="tags"> </div> <div class="copytip"> <p>如何用FileSystemObject组件来做一个站内搜索?由讯客互联<a href="/jiaoliu/" target="_blank">技术交流</a>栏目发布,感谢您对<a href="https://www.xkfenlei.com" target="_blank">讯客互联</a>的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“<a href="https://xkfenlei.com/news/24689.html" title="如何用FileSystemObject组件来做一个站内搜索?" target="_blank">如何用FileSystemObject组件来做一个站内搜索?</a>”</p> </div> </div> <div class="nextpage"> <!-- <p class="prev"><span>上一篇</span><br> <a href="/news/24688.html">如何实现全文检索?</a></p> <p class="next"><span>下一篇</span><br> <a href="/news/24690.html">如何做一个文本搜索?</a></p> --> </div> </div> <div class="related-list"> <h3 class="shugang">推荐文章</h3> <ul> <li><a href="/news/24913.html" title="Vue3实现动态面包屑的代码示例"><i><img src="/0pic/yc_417.jpg" alt="Vue3实现动态面包屑的代码示例"></i> <p>Vue3实现动态面包屑的代码示例</p> </a></li> <li><a href="/news/24546.html" title="ASP.NET MVC实现横向展示购物车"><i><img src="/0pic/yc_241.jpg" alt="ASP.NET MVC实现横向展示购物车"></i> <p>ASP.NET MVC实现横向展示购物车</p> </a></li> <li><a href="/news/1226.html" title="为什么一个编程论坛会起名叫,Stack,"><i><img src="/0pic/yc_350.jpg" alt="为什么一个编程论坛会起名叫,Stack,"></i> <p>为什么一个编程论坛会起名叫,Stack,</p> </a></li> <li><a href="/news/24722.html" title="如何按时间显示最新标志"><i><img src="/0pic/yc_259.jpg" alt="如何按时间显示最新标志"></i> <p>如何按时间显示最新标志</p> </a></li> <li><a href="/news/24619.html" title="如何对文件进行操作?"><i><img src="/0pic/yc_225.jpg" alt="如何对文件进行操作?"></i> <p>如何对文件进行操作?</p> </a></li> <li><a href="/news/175.html" title="tag页面是什么?如何优化tag页面?"><i><img src="/0pic/yc_326.jpg" alt="tag页面是什么?如何优化tag页面?"></i> <p>tag页面是什么?如何优化tag页面?</p> </a></li> <li><a href="/news/1276.html" title="为什么大家都很否定中文编程?"><i><img src="/0pic/yc_331.jpg" alt="为什么大家都很否定中文编程?"></i> <p>为什么大家都很否定中文编程?</p> </a></li> <li><a href="/news/1307.html" title="制造业机械设备生产企业网站模板 - Sa"><i><img src="/0pic/yc_471.jpg" alt="制造业机械设备生产企业网站模板 - Sa"></i> <p>制造业机械设备生产企业网站模板 - Sa</p> </a></li> </ul> </div> </div> </div> <div class="aside l_box"> <div class="side_bar" id="side-hot-view-item"> <div class="side-tit"> <h3 class="function_t">热门文章</h3> </div> <ul> <li class="widlist"> <a href="/news/44653.html" target="_blank" title="常见刮刮乐代码含义(刮刮乐上的代码)"> <i class="gx"> <img src="/0pic/yc_297.jpg" alt="常见刮刮乐代码含义(刮刮乐上的代码)"> </i> </a> <h3> <a href="/news/44653.html" target="_blank" title="常见刮刮乐代码含义(刮刮乐上的代码)">常见刮刮乐代码含义(刮刮乐上的代码)</a> </h3> <div class="sidefoot"> <span>2024-10-06 01:18:01</span> </div> </li> <li class="widlist"> <a href="/news/390.html" target="_blank" title="mysql怎样将两列或是多列合并为一列?"> <i class="gx"> <img src="/0pic/yc_498.jpg" alt="mysql怎样将两列或是多列合并为一列?"> </i> </a> <h3> <a href="/news/390.html" target="_blank" title="mysql怎样将两列或是多列合并为一列?">mysql怎样将两列或是多列合并为一列?</a> </h3> <div class="sidefoot"> <span>2024-09-25 19:26:01</span> </div> </li> <li class="widlist"> <a href="/news/122.html" target="_blank" title="如何修改mysql中列的默认值"> <i class="gx"> <img src="/0pic/yc_418.jpg" alt="如何修改mysql中列的默认值"> </i> </a> <h3> <a href="/news/122.html" target="_blank" title="如何修改mysql中列的默认值">如何修改mysql中列的默认值</a> </h3> <div class="sidefoot"> <span>2024-09-25 17:57:02</span> </div> </li> <li class="widlist"> <a href="/news/513.html" target="_blank" title="使用ORDER BY进行排序语法和实例讲"> <i class="gx"> <img src="/0pic/yc_146.jpg" alt="使用ORDER BY进行排序语法和实例讲"> </i> </a> <h3> <a href="/news/513.html" target="_blank" title="使用ORDER BY进行排序语法和实例讲">使用ORDER BY进行排序语法和实例讲</a> </h3> <div class="sidefoot"> <span>2024-09-25 20:06:02</span> </div> </li> <li class="widlist"> <a href="/news/511.html" target="_blank" title="php设计模式1——单例模式"> <i class="gx"> <img src="/0pic/yc_491.jpg" alt="php设计模式1——单例模式"> </i> </a> <h3> <a href="/news/511.html" target="_blank" title="php设计模式1——单例模式">php设计模式1——单例模式</a> </h3> <div class="sidefoot"> <span>2024-09-25 20:05:02</span> </div> </li> <li class="widlist"> <a href="/news/510.html" target="_blank" title="php使用curl post 发送jso"> <i class="gx"> <img src="/0pic/yc_144.jpg" alt="php使用curl post 发送jso"> </i> </a> <h3> <a href="/news/510.html" target="_blank" title="php使用curl post 发送jso">php使用curl post 发送jso</a> </h3> <div class="sidefoot"> <span>2024-09-25 20:05:02</span> </div> </li> <li class="widlist"> <a href="/news/385.html" target="_blank" title="MySQL数据库快速部署实践-在云端创建"> <i class="gx"> <img src="/0pic/yc_144.jpg" alt="MySQL数据库快速部署实践-在云端创建"> </i> </a> <h3> <a href="/news/385.html" target="_blank" title="MySQL数据库快速部署实践-在云端创建">MySQL数据库快速部署实践-在云端创建</a> </h3> <div class="sidefoot"> <span>2024-09-25 19:25:02</span> </div> </li> <li class="widlist"> <a href="/news/364.html" target="_blank" title="使用的MSSQL的数据库,一直不能解决乱"> <i class="gx"> <img src="/0pic/yc_85.jpg" alt="使用的MSSQL的数据库,一直不能解决乱"> </i> </a> <h3> <a href="/news/364.html" target="_blank" title="使用的MSSQL的数据库,一直不能解决乱">使用的MSSQL的数据库,一直不能解决乱</a> </h3> <div class="sidefoot"> <span>2024-09-25 19:18:01</span> </div> </li> <li class="widlist"> <a href="/news/429.html" target="_blank" title="如果网站不小心封禁百度蜘蛛,会给网站带来"> <i class="gx"> <img src="/0pic/yc_293.jpg" alt="如果网站不小心封禁百度蜘蛛,会给网站带来"> </i> </a> <h3> <a href="/news/429.html" target="_blank" title="如果网站不小心封禁百度蜘蛛,会给网站带来">如果网站不小心封禁百度蜘蛛,会给网站带来</a> </h3> <div class="sidefoot"> <span>2024-09-25 19:38:01</span> </div> </li> <li class="widlist"> <a href="/news/447.html" target="_blank" title="Common Lang3 Bridge "> <i class="gx"> <img src="/0pic/yc_87.jpg" alt="Common Lang3 Bridge "> </i> </a> <h3> <a href="/news/447.html" target="_blank" title="Common Lang3 Bridge ">Common Lang3 Bridge </a> </h3> <div class="sidefoot"> <span>2024-09-25 19:44:02</span> </div> </li> </ul> </div> </div> </div> </div> <!--baidu_push_js--> <script type="text/javascript"> (function() { var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> <!--baidu_push_js--> <footer> <p><a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">皖ICP备09001001号</a></p> </footer> <span id="go-to-top"></span> <script language="javascript" type="text/javascript" src="/template/pc/skin/js/common_zx.js?t=1675041140"></script> <script language="javascript" type="text/javascript" src="/template/pc/skin/js/superslide.js?t=1675040906"></script> <script language="javascript" type="text/javascript" src="/template/pc/skin/js/sticky.js?t=1675040906"></script> <script> $(document).ready(function() { $(".aside").theiaStickySidebar({ additionalMarginTop: 0 }) }); </script> <!-- 应用插件标签 start --> <!-- 应用插件标签 end --> <script type="text/javascript">var root_dir="";var ey_u_switch=1;var ey_aid=24689;</script> <script language="javascript" type="text/javascript" src="/public/static/common/js/ey_footer.js?t=v1.6.2"></script> </body> </html>