|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
asp是基于web的一种编程技术,可以说是cgi的一种。它可以完成以往cgi程序的所有功能,如计数器、留言簿、公告板、聊天室等等。搜刮引擎<%
Response.Buffer=True
OneFileSearchEngine(ofSearchv1.0)
Copyright?000SixtoLuisSantos<sixtos@prtc.net>
AllRightsReserved
Note:
Thisprogramisfreeware.ThisprogramisNOTinthePublicDomain.
Youcanfreelyusethisprograminyourownsite.
Youcannotre-distributethecode,byanymeans,
withouttheexpresswrittenauthorizationbytheauthor.
Usethisprogramatyourownrisk.
Globals--------------------------------------
----------------------------------------------
ConstValidFiles="htmltxt"
ConstRootFld="./"
DimMatched
DimRegex
DimGetTitle
Dimfs
DimrfLen
dimRootFolder
DimDocCount
DimDocMatchCount
DimMatchedCount
----------------------------------------------
Procedure:SearchFiles()
----------------------------------------------
PublicSubSearchFiles(FolderPath)
DimfsFolder
DimfsFolder2
DimfsFile
DimfsText
DimFileText
DimFileTitle
DimFileTitleMatch
DimMatchCount
DimOutputLine
Getthestartingfolder
SetfsFolder=fs.GetFolder(FolderPath)
Iteratethrueveryfileinthefolder
ForEachfsFileInfsFolder.Files
Comparethecurrentfileextensionwiththelistofvalidtargetfiles
IfInStr(1,ValidFiles,Right(fsFile.Name,3),vbTextCompare)>0Then
DocCount=DocCount+1
Openthefiletoreaditscontent
SetfsText=fsFile.OpenAsTextStream
FileText=fsText.ReadAll
Applytheregexsearchandgetthecountofmatchesfound
MatchCount=Regex.Execute(FileText).Count
MatchedCount=MatchedCount+MatchCount
IfMatchCount>0Then
DocMatchCount=DocMatchCount+1
Applyanotherregextogetthehtmldocumentstitle
SetFileTitleMatch=GetTitle.Execute(FileText)
IfFileTitleMatch.Count>0Then
Stripthetitletags
FileTitle=Trim(replace(Mid(FileTitleMatch.Item(0),8),"</title>","",1,1,1))
Incasethetitleisempty
IfFileTitle=""Then
FileTitle="NoTitle("&fsFile.Name&")"
EndIf
Else
Createanalternateentryname(ifnotitlefound)
FileTitle="NoTitle("&fsFile.Name&")"
EndIf
Createtheentrylinewithproperformatting
Addtheentrynumber
OutputLine="<b>"&DocMatchCount&".</B>"
Addthedocumentnameandlink
OutputLine=OutputLine&"<Ahref="&chr(34)&RootFld&replace(Mid(fsFile.Path,
rfLen),"","/")&chr(34)&"><B>"
OutputLine=OutputLine&FileTitle&"</B></a>"
Addthedocumentinformation
OutputLine=OutputLine&"<fontsize=1><br>Criteriamatched"&MatchCount
&"times-Size:"
OutputLine=OutputLine&FormatNumber(fsFile.Size/1024,2,-1,0,-1)&"Kbytes"
OutputLine=OutputLine&"-LastModified:"&formatdatetime
(fsFile.DateLastModified,vbShortDate)&"</Font><br>"
Displayentry
Response.WriteOutputLine
Response.Flush
EndIf
fsText.Close
EndIf
Next
Iteratethrueachsubfolderandrecursivelycallthisprocedure
ForEachfsFolder2InfsFolder.SubFolders
SearchFilesfsFolder2.Path
Next
SetFileTitleMatch=Nothing
SetfsText=Nothing
SetfsFile=Nothing
SetfsFolder2=Nothing
SetfsFolder=Nothing
EndSub
----------------------------------------------
Procedure:Search()
----------------------------------------------
SubSearch(</p>我想详细了解ASP整站代码与PSP整站代码有什么优缺点,那个更好,更安全,更用容易维护,和管理。。。 |
|