|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
楼上说交互性不好,太牵强了吧。在微软提供的一套框架中,利用asp做网站,开发效率高,使用人数少,减少不必要的开销。交互性是互动方式,是有开发人员决定的。
该搜刮引擎由一个HTM文件一个ASP文件构成,次要是使用FILESYSTEMOBJECT组件来到达目标,功效壮大,修正界面今后能够间接拿来利用,固然加上一点本人的器材就加倍好了。
searchpage.htm
该HTM文件用来传进前提
<HTML>
<HEAD>
<TITLE>ASP搜刮引擎典范</TITLE>
</HEAD>
<BODY>
<CENTER>
<FORMMETHOD=POSTACTION="search.asp">
<TABLEBGCOLOR="#CC6633"BORDER="0">
<TR>
<TDROWSPAN="3"BGCOLOR="#CC6633"width="21"nowrap></TD>
<TDwidth="363"nowrap><FONTCOLOR="#FFFFFF">
<INPUTTYPE="text"NAME="SearchText"SIZE="22">
<INPUTTYPE="checkbox"NAME="Case">
高度敏感</FONT></TD>
<TDROWSPAN="3"width="10">
<INPUTTYPE="submit"VALUE="断定">
<P>
<INPUTTYPE="reset"VALUE="扫除">
</TD>
<TDROWSPAN="3"BGCOLOR="#CC6633"width="28"></TD>
</TR>
<TR>
<TDwidth="363"nowrap><FONTCOLOR="#FFFFFF">前往了局
<SELECTname="rLength">
<optionvalue="200"selected>长信息</option>
<optionvalue="100">短信息</option>
<optionvalue="0">只前往毗连</option>
</SELECT>
<SELECTNAME="rResults">
<OPTIONVALUE="10"SELECTED>10
<OPTIONVALUE="25">25
<OPTIONVALUE="50">50
</SELECT>
</FONT>
</TD>
</TR>
<TR>
<TDwidth="363"nowrap><FONTCOLOR="#FFFFFF">必需包含:
<INPUTTYPE="checkbox"NAME="iImage">
图片
<INPUTTYPE="checkbox"NAME="iZips">
Zip格局
<INPUTTYPE="checkbox"NAME="iJavaS">JavaScript
</FONT>
</TD>
</TR>
</TABLE>
</FORM>
</CENTER>
<DL>
<DD></DD>
</DL>
</BODY>
</HTML>
------------------------------------------------------------------------
显现了局的ASP程序
search.asp
<HTML>
<HEAD>
<TITLE><%=Request("SearchText")%>的搜刮了局</TITLE>
</HEAD>
<BODY>
<B><%=Request("SearchText")%>的搜刮了局</B><BR>
<%
ConstfsoForReading=1
DimobjFile,objFolder,objSubFolder,objTextStream
DimbolCase,bolFileFound,bolTagFound
DimstrCount,strDeTag,strExt,strFile,strContent,strRoot,strTag,strText,strTitle,strTitleL
DimreqImage,reqJavaS,reqLength,reqNumber,reqZip
strFile=".asp.htm.html.js.txt.CSS"
strRoot="/"
strText=Request("SearchText")
strTag=Chr(37)&Chr(62)
bolFileFound=False
bolTagFound=False
IfRequest("Case")="on"ThenbolCase=0ElsebolCase=1
IfRequest("iImage")="on"ThenreqImage="<IMG"ElsereqImage=""
IfRequest("iZips")="on"ThenreqZips=".zip"ElsereqImage=""
IfRequest("iJavaS")="on"ThenreqJavaS="JavaScript"ElsereqImage=""
IfRequest("rResults")="10"ThenreqNumber=10
IfRequest("rResults")="25"ThenreqNumber=25
IfRequest("rResults")="50"ThenreqNumber=50
reqLength=Request("rLength")
SetobjFSO=Server.CreateObject("Scripting.FileSystemObject")
SetobjFolder=objFSO.GetFolder(Server.MapPath(strRoot))
schSubFol(objFolder)
SubschSubFol(objFolder)
ForEachobjFileinobjFolder.Files
IfstrCount+1>reqNumberorstrText=""ThenExitSub
IfResponse.IsClientConnectedThen
SetobjTextStream=objFSO.OpenTextFile(objFile.Path,fsoForReading)
strContent=objTextStream.ReadAll
IfInStr(1,strContent,strTag,bolCase)Then
Else
IfMid(objFile.Name,Len(objFile.Name)-1,1)="."ThenstrExt=Mid(objFile.Name,Len(objFile.Name)-1,2)
IfMid(objFile.Name,Len(objFile.Name)-2,1)="."ThenstrExt=Mid(objFile.Name,Len(objFile.Name)-2,3)
IfMid(objFile.Name,Len(objFile.Name)-3,1)="."ThenstrExt=Mid(objFile.Name,Len(objFile.Name)-3,4)
IfMid(objFile.Name,Len(objFile.Name)-4,1)="."ThenstrExt=Mid(objFile.Name,Len(objFile.Name)-4,5)
IfInStr(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
IfInStr(1,strContent,"<TITLE>",1)ThenstrTitle=Mid(strContent,InStr(1,strContent,"<TITLE>",1)+7,InStr(1,strContent,"</TITLE>",1))ElsestrTitle="未定名"
strCount=strCount+1
Response.Write"<DL><DT><B><I>"&strCount&"</I></B>-<AHREF="&objFile.Path&">"&strTitle&"</A></A></DT><BR><DD>"
strTitleL=InStr(1,strContent,"</TITLE>",1)-InStr(1,strContent,"<TITLE>",1)+7
strDeTag=""
bolTagFound=False
DoWhileInStr(strContent,"<")
bolTagFound=True
strDeTag=strDeTag&""&Left(strContent,InStr(strContent,"<")-1)
strContent=MID(strContent,InStr(strContent,">")+1)
Loop
strDeTag=strDeTag&strContent
IfNotbolTagFoundThenstrDeTag=strContent
IfreqLength="0"ThenResponse.WriteobjFile.Path&"</DD></DL>"ElseResponse.WriteMid(strDeTag,strTitleL,reqLength)&"...<BR><b><FONTSIZE=2>URL:"&objFile.Path&"-前次修正工夫:"&objFile.DateLastModified&"-"&FormatNumber(objFile.Size/1024)&"Kbytes</FONT></b></DD></DL>"
bolFileFound=True
EndIf
objTextStream.Close
EndIf
EndIf
Next
EndSub
ForEachobjSubFolderinobjFolder.SubFolders
schSubFol(objSubFolder)
Next
IfNotbolFileFoundthenResponse.Write"没有婚配了局"
IfbolFileFoundthenResponse.Write"<B>搜刮停止</B>"
SetobjTextStream=Nothing
SetobjFolder=Nothing
SetobjFSO=Nothing
%>
</BODY></HTML>
缺点:安全性不是太差了,还行,只要你充分利用系统自带的工具;唯一缺点就是执行效率慢,如何进行网站优化以后,效果会比较好。 |
|