动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > ASP实例
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ ASP实例 ]的信息

本月文章推荐
.利用ASP制作EXECL报表方法(一).
.用密码保护页面 (III).
.用Access制作一个功能完善的论坛.
.用Web页面执行客户端程序.
.用ASP+SQL Server为网页建一道防.
.用密码保护页面 (I).
.用ASP开发一个在线考试程序(八).
.用ASP实现对Web搜索引擎Index Se.
.ASP+VML+DB实现投票统计项目.
.搜索按钮(客户端表单).
.一个实用的FSO-实时统计在线人数.
.ASP进阶之文章在线管理更新(13).
.利用ASP实现对表的分页浏览(下).
.用XSL.ASP编辑XML文档.
.网络寻呼机数据库版总结.
.精彩OUTLOOK 2000组件放送.
.制作我们自己的Ebay(拍卖系统)(5).
.利用ASP实现三个强大功能之二.
.用ASP+XML打造留言本(3).
.一个用asp+存取数据库的例子.

制作一个个人搜索引擎(源码)

发表日期:2000-10-11 |


<%
Response.Buffer=True

'
' OneFile Search Engine (ofSearch v1.0)
' Copyright ?000 Sixto Luis Santos <sixtos@prtc.net>
' All Rights Reserved
'
' Note:
' This program is freeware. This program is NOT in the Public Domain.
' You can freely use this program in your own site.
'
' You cannot re-distribute the code, by any means,
' without the express written authorization by the author.
'
' Use this program at your own risk.
'


' Globals --------------------------------------
' ----------------------------------------------

Const ValidFiles = "htmltxt"
Const RootFld = "./"

Dim Matched
Dim Regex
Dim GetTitle
Dim fs
Dim rfLen
dim RootFolder
Dim DocCount
Dim DocMatchCount
Dim MatchedCount

' ----------------------------------------------
' Procedure: SearchFiles()
' ----------------------------------------------
Public Sub SearchFiles(FolderPath)
Dim fsFolder
Dim fsFolder2
Dim fsFile
Dim fsText
Dim FileText
Dim FileTitle
Dim FileTitleMatch
Dim MatchCount
Dim OutputLine

' Get the starting folder
Set fsFolder = fs.GetFolder(FolderPath)
' Iterate thru every file in the folder
For Each fsFile In fsFolder.Files
    ' Compare the current file extension with the list of valid target files
    If InStr(1, ValidFiles, Right(fsFile.Name, 3), vbTextCompare) > 0 Then
     DocCount = DocCount + 1
     ' Open the file to read its content
        Set fsText = fsFile.OpenAsTextStream
            FileText = fsText.ReadAll
            ' Apply the regex search and get the count of matches found
            MatchCount = Regex.Execute(FileText).Count
            MatchedCount = MatchedCount + MatchCount
            If  MatchCount > 0 Then
                DocMatchCount = DocMatchCount + 1
                ' Apply another regex to get the html document's title
                Set FileTitleMatch = GetTitle.Execute(FileText)
                If FileTitleMatch.Count > 0 Then
                    ' Strip the title tags
                    FileTitle = Trim(replace(Mid(FileTitleMatch.Item(0),8),"</title>","",1,1,1))
                    ' In case the title is empty
                    If FileTitle = "" Then
                     FileTitle = "No Title (" & fsFile.Name & ")"
                    End If
                Else
                    ' Create an alternate entry name (if no title found)
                    FileTitle = "No Title (" & fsFile.Name & ")"
                End If
                ' Create the entry line with proper formatting
                ' Add the entry number
                OutputLine = "&nbsp;&nbsp;<b>" & DocMatchCount & ".</B>&nbsp;"
                ' Add the document name and link
                OutputLine = OutputLine & "<A href=" & chr(34) & RootFld & replace(Mid(fsFile.Path,
rfLen),"\","/") & chr(34) & "><B>"
                OutputLine = OutputLine & FileTitle & "</B></a>"
                ' Add the document information
                OutputLine = OutputLine & "<font size=1><br>&nbsp;&nbsp;Criteria matched " & MatchCount
& " times - Size: "
                OutputLine = OutputLine & FormatNumber(fsFile.Size / 1024,2 ,-1,0,-1) & "K bytes"
                OutputLine = OutputLine & " - Last Modified: " & formatdatetime
(fsFile.DateLastModified,vbShortDate) & "</Font><br>"
                ' Display entry
                Response.Write OutputLine
                Response.Flush
            End If
        fsText.Close
    End If
Next

' Iterate thru each subfolder and recursively call this procedure
For Each fsFolder2 In fsFolder.SubFolders
    SearchFiles fsFolder2.Path
Next

Set FileTitleMatch = Nothing
Set fsText = Nothing
Set fsFile = Nothing
Set fsFolder2 = Nothing
Set fsFolder = Nothing
End Sub

' ----------------------------------------------
' Procedure: Search()
' ----------------------------------------------
Sub Search(SearchString)
Dim i
Dim fKeys
Dim fItems

Set fs = CreateObject("Scripting.FileSystemObject")
Set GetTitle = New RegExp
Set Regex = New RegExp

With Regex
    .Global = True
    .IgnoreCase = True
    .Pattern = Trim(SearchString)
End With
With GetTitle
    .Global = False
    .IgnoreCase = True
    .Pattern = "<title>(.|\n)*</title>"
End With

RootFolder = Server.MapPath(RootFld)

If Right(RootFld,1) <> "/" Then
RootFld = RootFld & "/"
End If

If Right(RootFolder, 1) <> "\" Then
    RootFolder = RootFolder & "\"
End If
rfLen = Len(RootFolder) + 1

SearchFiles RootFolder

If MatchedCount = 0 Then
   Response.Write "&nbsp;&nbsp;<B>No Matches Found.</b><BR>"
End If

Set Regex = Nothing
Set GetTitle = Nothing
Set fs = Nothing
    
End Sub

%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<TITLE>OneFile Search 1.0</TITLE>
</HEAD>
<body bgcolor="#FFFFFF" link="#660000" vlink="#008000">
<Font Face="Tahoma,Arial" Size="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%" colspan="2"></td>
  </tr>
  <tr>
    <td width="50%" bgcolor="#000000">
     <Form method="Get">
      <table border="0" width="100%">
        <tr>
          <td width="33%" align="right"><font color="#FFFFFF" size="2" face="Tahoma,Arial"><b>Search
for&nbsp;</b></font></td>
          <td width="33%"><input type="text" size="20" value="<%=Request.QueryString("query")%>"
name="query"></td>
          <td width="34%"><input type="submit" name="Search" Value="Search"></td>
        </tr>
      </table>
     </Form>
    </td>
    <td width="50%" bgcolor="#000000"></td>
  </tr>
  <tr>
    <td width="100%" colspan="2" bgcolor="#000000"></td>
  </tr>
  <tr>
    <td width="50%" bgcolor="#808080">
      <table border="0" width="100%">
        <tr>
          <td width="33%" align="right"><font face="Tahoma,Arial" size="1"
color="#FFFFFF"><b>Tip:</b></font></td>
          <td width="67%"><font color="#FFFFFF" face="Tahoma,Arial" size="1">Search by using <a
href="http://msdn.microsoft.com/scripting/default.htm?/scripting/VBScript/doc/jsgrpregexpsyntax.htm">Regula
r Expresions</a>.</font></td>
        </tr>
      </table>
    </td>
    <td width="50%" bgcolor="#808080"></td>
  </tr>
</table>

<%
If Trim(Request.QueryString("query")) <> "" Then
%>
<hr>
<table border="0" width="100%" bgcolor="#808080" cellspacing="0" cellpadding="0">
<tr>
       <td width="100%"><Font Color="#FFFFFF" Size="2">&nbsp;&nbsp;Your search for <B><%
=Request.QueryString("query")%></B> found the following documents:</Font></td>
   </tr>
</table>
<BR><BR>
<%
    Response.Flush
    Search Request.QueryString("query")
    If DocCount > 0 Then
%>
<BR>
<Font Size=1>
&nbsp;&nbsp;(The search criteria "<%=Request.QueryString("query")%>" found <%=MatchedCount%> times in <%
=DocMatchCount%> of <%=DocCount%> documents.)
</font>
<%
   End If
End If
%>
<BR><BR>
<hr><div align="center">
<Font size=1>
OneFile Search Engine v1.0<br>
Copyright?000 <a href="mailto:sixtos@prtc.net">Sixto Luis Santos</a>.
All Rights Reserved
</Font></div>

</Font>
</body>
</html>

<%
Response.End
%>
上一篇:用SQL Server为Web浏览器提供图像3(end) 人气:9825
下一篇:制作一个简单的服务器端控制 人气:10932
浏览全部搜索引擎的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-9-30 来路分析系统 v3.0 简洁版
2008-9-30 来路分析系统 v3.0 国庆版
2008-9-30 IXNA新闻聚合程序 0.5 Build 200
2008-9-30 LinkMan 1.5
2008-9-30 pibazi.net图片上传程序 coolent
2008-9-30 LinkMan 1.5 汉化版
2008-9-29 60度CMS v1.0 Build 080928
2008-9-29 X3BLOG 多用户 v1.1.0.beta1 编译
2008-9-29 X3BLOG 多用户 v1.1.0.beta1 源码
2008-9-29 酷狗音乐(原KuGoo)2008 v5.310 正
2008-9-29 QQTab 1.1
2008-9-29 网络传送带 Net Transport 2.64a
2008-9-29 谷歌金山词霸v1.8
2008-9-29 TweakVI 1.0 Build 1090
2008-9-29 ACDSee Pro 2.5 Build 333 汉化绿
2008-9-29 Winamp v5.541(2189) 周明波简体
2008-9-27 CCleaner 2.12.651
2008-9-27 Mozilla Thunderbird 2.0.0.17 英
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | 广告代码 | js/vbs加密 | md5加密 | 进制转换 | UTF-8 转换工具 | Html转换js | Html转换asp | Html转换php | Html转换perl
实用工具:汉字翻译拼音 | 拼音字典 | 符号对照表 | 个税计算 | 实时汇率查询换算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 | 国家代码与域名缩写 | 文字加密解密 | 健康查询 | 万年历 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報
防水工事·改修工事 フットサル大会 探偵
SEO対策 中国語教室 ホームページ作成