📄 search.asp
字号:
<!--#include file="setup.asp"-->
<!--#include file="conn.asp"-->
<%
'================================================================================
'Product:K-Search Version 2.1
'本“软件产品”受《中华人民共和国著作权法》和《中华人民共和国计算机软件保护条例》
'和国际条约的保护。如未经授权而擅自复制或传播本程序(或其中任何部分),将受到严厉
'的刑事及民事制裁,并将在法律许可的范围内受到最大可能的起诉!
'Homepage:http://www.lucoo.com/
'--------------------------------------------------------------------------------
'Copyright(c) 2005 lucoo.com All Rights Reserved 绿色互联 版权所有
'================================================================================
Server.ScriptTimeOut=60
Time1=Timer()
function filtration(str)
str=replace(str,chr(34),"")
str=replace(str,chr(35),"")
str=replace(str,chr(37),"")
str=replace(str,chr(38),"")
str=replace(str,chr(39),"")
str=replace(str,chr(40),"")
str=replace(str,chr(41),"")
str=replace(str,chr(42),"")
str=replace(str,chr(43),"")
str=replace(str,chr(45),"")
str=replace(str,chr(46),"")
str=replace(str,chr(58),"")
str=replace(str,chr(59),"")
str=replace(str,chr(60),"")
str=replace(str,chr(61),"")
str=replace(str,chr(62),"")
filtration=str
end Function
dim rs
dim keyword
dim keywordlist
dim path
keyword=Request.QueryString("keyword")
if keyword="" then
conn.close
set conn=Nothing
response.write "<Script>window.alert('请输入关键词!');history.go(-1);</Script>"
response.end
else
keyword=replace(keyword," "," ")
keyword=filtration(keyword)
keyword=ltrim(rtrim(keyword))
keywordlist=split(keyword,chr(32))
path=Request.QueryString("path")
sort_path="/"&Request.QueryString("path")&"/"
for i=0 to ubound(keywordlist)
sql=sql &" web.title like '%" & keywordlist(i) & "%' or "
sql=sql &" web.keyword like '%" & keywordlist(i) & "%' or "
sql=sql &" web.content like '%" & keywordlist(i) & "%' or "
next
sql=Left(sql,(len(sql)-3))
dim search_sql
if path="" or sort_path="/0/" then
search_sql="select id,sort_path,title,keyword,url,content,verify,click,sequence,commend from web where ("&sql&") and verify=0 order by id desc"
else
search_sql="select id,sort_path,title,keyword,url,content,verify,click,sequence,commend from web where sort_path like '%" & sort_path & "%' and ("&sql&") and verify=0 order by id desc"
end if
dim web_count
set rs=server.createobject("adodb.recordset")
rs.open search_sql,conn,1,1
if Request.QueryString("action")="" then
Application("web_count"&keyword)=rs.recordcount
end if
web_count=Application("web_count"&keyword)
%>
<html>
<head>
<title><%=WebSite_Title%> - <%=keyword%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script language=javascript>
function one_search(){
var url="one_search.asp";
document.form_search.action=url;
}
function search(){
var url="search.asp";
document.form_search.action=url;
}
</script>
</head>
<body vlink="#990000" alink="#00CC00" leftmargin="5" topmargin="0" marginwidth="0" marginheight="5">
<!--#include file="top.asp" -->
<table border="0" cellpadding="5" cellspacing="0">
<tr align="center" bgcolor="#f5f5f5">
<td width="55" height="20"><a href="index.asp"><strong>网站搜索</strong></a></td>
<td width="55" bgcolor="#f5f5f5"><a href="dir.asp">分类目录</a></td>
<td width="55" bgcolor="#f5f5f5"><a href="protocol.asp">网站登录</a></td>
<td width="55" bgcolor="#f5f5f5"><a href="admin.asp">网站修改</a></td>
<td width="55" bgcolor="#f5f5f5"><a href="help.asp">搜索帮助</a></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td background="image/search_bg.gif"><table border="0" align="center" cellpadding="0" cellspacing="0">
<form name="form_search" method="get" action="search.asp">
<tr>
<td width="50" height="30">关键词:</td>
<td width="225"><input name="keyword" type="text" id="keyword" value="<%=keyword%>" size="35"></td>
<td width="50"><input type="image" src="image/search.gif" onclick="search()" align="absMiddle" width="45" height="21" hspace="0" border="0"></td>
<td width="50"><input type="image" src="image/one_search.gif" onclick="one_search()" align="absMiddle" width="45" height="21" hspace="0" border="0"></td>
<td width="200"><a href="help.asp" target="_blank">搜索帮助</a> <a href="protocol.asp" target="_blank">网站登录</a>
<a href="admin.asp" target="_blank">网站修改</a></td>
</tr>
</form>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="25" bgcolor="#f5f5f5"><%response.write ""<font color='#FF0000'>"&keyword&"</font>"相关网站 共找到 "&web_count&" 个"%></td>
</tr>
<tr>
<td height="1" bgcolor="#CCCCCC"></td>
</tr>
<tr>
<td height="15"></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> <ol>
<%
if rs.eof and rs.bof then
response.write "<br><table width=""100%"" border=0><tr><td vAlign=top colSpan=2>无找到相关信息,建议您:</td><td vAlign=top rowSpan=2> </td></tr><tr><td width=100> </td><td vAlign=top width=""70%""><ol><li>请您检查输入的文字有无错误,或换另一个关键词查询;<br><br></li><li>请查看<a href=help.asp target=_blank>搜索帮助信息</a>,学习使用本搜索系统;</li></ol></td></tr></table>"
else
dim totalPut
dim CurrentPage
dim TotalPages
dim Page
Const MaxPerPage=20
page=Request.QueryString("page")
if Not isempty(page) then
currentPage=Cint(page)
else
currentPage=1
end if
totalPut=web_count
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"search.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
showContent
showpage totalput,MaxPerPage,"search.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"search.asp"
end if
end if
end if
sub showContent
dim id,title,content,url,sort_path
set id=rs("id")
set title=rs("title")
set content=rs("content")
set url=rs("url")
set sort_path=rs("sort_path")
for i=1 to MaxPerPage step 1
response.write "<li><span style='font-size: 14px'><a href='goto.asp?url="&url&"&id="&id&"' target='_blank'>"&replace(title,keyword,"<font color=#FF0000>"&keyword&"</font>")&"</a></span><br>"
response.write "<span style='line-height: 150%'>"&replace(content,keyword,"<font color=#FF0000>"&keyword&"</font>")&"</span><br>"
response.write "<span style='line-height: 150%'><font color='#006600'>"&url&"</font> - <a href='show.asp?keyword="&keyword&"&url="&url&"' target='_blank'>网站快照</a> "
response.write "- <a href='dir"&sort_path&"' target='_blank'>类似网站</a></span></li><br><br>"
rs.movenext
if rs.eof then exit for
next
rs.close
set rs=Nothing
conn.close
set conn=Nothing
response.write "<br>"
End Sub
Function showpage(totalnumber,maxperpage,filename)
Dim n
If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If
If CurrentPage<2 Then
Else
response.write " <a href='"&filename&"?keyword="&keyword&"&page="&CurrentPage-1&"&action=0'>上一页</a> "
End If
p=(currentpage-1) \ 10
for np=p*10+1 to p*10+10
if ii=currentpage then
response.write cstr(np)
else
response.write "<a href='"&filename&"?keyword="&keyword&"&page="&cstr(np)&"&action=0'>["&cstr(np)&"]</a> "
end if
if np=n then exit for
next
If n-currentpage<1 Then
Else
response.write "<a href='"&filename&"?keyword="&keyword&"&page="&CurrentPage+1&"&action=0'>下一页</a> "
End If
response.write "页次:"&CurrentPage&"/"&n&"页 "
End Function
Time2=Timer()
Response.Write ""&(Time2-Time1)*1000&" 毫秒"
%></ol>
</td>
<td width="10"></td>
<td width="1" bgcolor="#CCCCCC"></td>
<td width="220" valign="top"><script language="javascript" src="right.asp?keyword=<%=keyword%>&web_count="&web_count&"&page=<%=CurrentPage%>"></script></td>
</tr>
</table>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#F0F0F0">
<td width="75" align="center"><strong>相关搜索</strong></td>
<td><script language="javascript" src="keyword_js.asp?keyword=<%=keyword%>&count=9"></script></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0">
<form name="search" method="get" action="search.asp">
<tr>
<td width="225" height="30"><input name="keyword" type="text" id="keyword" value="<%=keyword%>" size="35"></td>
<td width="50"><input type="image" src="image/search.gif" align="absMiddle" width="45" height="21" hspace="0" border="0"></td>
</tr>
</form>
</table>
<!--#include file="bottom.asp" -->
</body>
</html>
<%
end if
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -