📄 search.asp
字号:
<html><head><title>178商机网--免费发布商业信息|因为专业所以最好</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/main.css" rel="stylesheet">
</head>
<body leftmargin="0" topmargin="0" ><div align=center>
<!--#include file="conn.asp"-->
<!--#include file="head.asp"-->
<!--#include file="admin/char.asp"-->
<%
Const PAGESIZE=20
Const PARTSIZE=10
Const AboutSize=8
sitelan = request("sitelan")
sitetype = request("sitetype")
wanwei = request("wanwei")
op = request("op")
keyword = request("keyword")
keyword = replace(keyword,"'","") '过滤关键字
keyword = replace(keyword,"[","")
keyword = trim(keyword)
if trim(keyword)="" then%>
<script language=javascript>
alert( "错误:请输入关键字!" );
location.href = "javascript:history.back()"
</script>
<%Response.End
end if
%>
<table width="100%" border="0" cellpadding=0 cellspacing=0 bgcolor=#0033CC>
<tr height=22 valign=bottom>
<td width="179" height="25" align=right valign="middle" background=img/net_13.gif bgcolor="#0000CC"> 您搜索的关键字为:<font color=#0066FF> </font></td>
<td height="25" valign="middle" background=img/net_13.gif><font color=#0066FF><b><%=keyword%></b></font></td>
</tr>
</table>
<table border="0" width="100%">
<tr>
<td align="center" width="80%" valign="top">
<table border="0" width="96%">
<tr>
<td align="center" valign="top"><%
dim pagecount,page,Spage,Epage,recordcount,i
page = request.querystring("page")
if page = "" or IsNull(page) then page = 1
if not IsNumeric(page) then page = 1
page = Cint(page)
set rs = server.CreateObject ("Adodb.recordset")
keywordlist = split(keyword,chr(32))
if UCase(op) = "OR" then
op = "OR"
else
op = "AND"
end if
if trim(wanwei) = "" then wanwei = "siteurl,sitename,sitecontent"
wanwei = split(wanwei,chr(44))
likelist = ""
for i = 0 to UBound(keywordlist)
likelist = likelist & " " & op & " " & mklikelist2(wanwei,keywordlist(i),"or")
next
likelist = right(likelist,len(likelist) - len(" " & op & " "))
sql = "select * from site where " & likelist
if trim(sitelan) <> "" and sitelan <> "all" then
sql = sql & " and sitelan = '" & sitelan & "'"
end if
if trim(sitetype) <> "" and sitetype <> "all" then
sql = sql & " and sitetype = '" & sitetype & "'"
end if
sql = sql & " and ifpass=1 order by eoknum desc"
rs.open sql,conn,1,1
recordcount = RS.RecordCount
RS.PageSize = PAGESIZE
pagecount = RS.PageCount
if page < 1 then
page = 1
elseif page > pagecount then
page = pagecount
end if
if RS.EOF then
response.write("<center><font color=red>没有搜索到与关键字相匹配站点! <a href=./>返回首页</a><br><br><br>")
%>
<%else%>
<%
if recordcount > 0 then RS.AbsolutePage = page
for i = 1 to PAGESIZE
if RS.EOF then exit for
%>
<table width="100%" border=0 cellpadding=3 cellspacing=1>
<tr bgcolor=f6f6f6>
<td width=310><img src=img/a.gif> <a class=s href=go.asp?url=<%=rs("siteurl")%>&id=<%=rs("id")%> target=_blank><font color="#0000FF"><%=replace(rs("sitename"),""&keyword&"","<font color=red>"&keyword&"</font>")%></font></a><font color="#0000FF"> </td>
<td width=107><font color=999999></font></td>
<td width=145><font color="#333333"><%=rs("addtime")%></font></td>
<td width=169>
<a href=show.asp?id=<%=rs("id")%> target=_blank><img src=img/b6.gif alt=详细情况 border=0></a>
</td></tr>
<tr><td colspan="4"><ul><font color="#333333"><%=replace(rs("sitecontent"),""&keyword&"","<font color=red>"&keyword&"</font>")%></font></td></tr>
<tr><td height=5 colspan=4 background=img/rb.gif></td></tr>
<tr><td height=5 colspan=4 background=img/rb.gif></td></tr></table>
<%
RS.MoveNext()
next
end if
%>
<%if pagecount > 0 then
response.write("<table width=760 align=center cellspacing=3 cellpadding=3><tr><td align=right>")
response.write("页次:<font color=red><b>" & page & "</font>/" & pagecount & "</b> 每页<b>" & pagesize & "</b> 共<b>" & recordcount & "</b>个商业信息 分页:")
Spage = page mod PARTSIZE
if page > PARTSIZE then
if Spage = 0 then Spage = PARTSIZE
Spage = page - Spage + 1
else
Spage = 1
end if
Epage = Spage + PARTSIZE - 1
if Epage > pagecount then Epage = pagecount
if page > PARTSIZE then
response.write("<a href=""search.asp?keyword=" & keyword & " &page=" & Spage - 1 & """>[<<]</a>")
end if
for i = Spage to Epage
if i = page then
response.write("[<font color=red><b>" & i & "</b></font>]")
else
response.write("[<a href=""search.asp?keyword=" & keyword & "&page=" & i & """>" & i & "</a>]")
end if
next
if Epage < pagecount then
response.write("<a href=""search.asp?keyword=" & keyword & "&page=" & Epage + 1 & """>[>>]</a>")
end if
if Spage <> 1 then response.write("[<a href=""search.asp?keyword=" & keyword & "&page=1"">首页</a>]")
if Epage <> pagecount then response.write("[<a href=""search.asp?keyword=" & keyword & "&page=" & pagecount & """>尾页</a>]")
response.write("</td></tr></table><br>")
end if
rs.close
set rs=nothing
%>
</td>
</tr>
</table>
</td>
<td align="center" width="20%" valign="top">
<table border="0" width="100%">
<tr>
<td align="center" valign="top"><!--#include file="left.asp"--> </td>
</tr>
</table>
</td>
</tr>
</table>
<!--#include file="end.asp"-->
</div></body></html>
<%
function mklikelist2(recnamearr,keyword,op)
dim i,tmparr
tmparr = recnamearr
for i = 0 to UBound(tmparr)
tmparr(i) = "(" & tmparr(i) & " like '%" & keyword & "%')"
next
mklikelist2 = "(" & join(tmparr," " & op & " ") & ")"
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -