📄 search.asp
字号:
<!--#include file="Config.asp" -->
<%
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim keyword
dim sql
dim rs
dim founderr
dim errmsg
dim findword
Const MaxPerPage=15
founderr=false
keyword=Trim(Request("keyword"))
if keyword="" then
response.write "请输入查询条件。"
response.end
else
keyword=replace(replace(replace(keyword,"'","‘"),"<","<"),">",">")
if request("action")="title" then
findword="SoftName like '%"&keyword&"%' "
else
findword="Content like '%"&keyword&"%' "
end if
end if
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
set rs=server.createobject("adodb.recordset")
dim CateID,SubCateID
dim CateName,SubCateName
if request("CateID")="" then
CateID=""
CateName="所有类别"
else
CateID="CateID="&cstr(request("CateID"))&" and "
sql="select CateName from "&CategoryName&"_Cate where CateID="&cstr(request("CateID"))
rs.open sql,conn,1,1
CateName=rs("CateName")
rs.close
end if
if request("SubCateID")="" then
SubCateID=""
SubCateName="所有类别"
else
SubCateID=" SubCateID="&cstr(request("SubCateID"))&" and "
sql="select SubCateName from "&CategoryName&"_SubCate where SubCateID="&cstr(request("SubCateID"))
rs.open sql,conn,1,1
SubCateName=rs("SubCateName")
rs.close
end if
%>
<HTML><HEAD><TITLE><%= Title_Name %><%= CategoryName_CHS %> ==>> 物品搜索 </TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name=keywords content="安徽二手市场">
<style type="text/css">
<!--
body {
background-color: #FFFFFF;
}
-->
</style>
<link href="css.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY text=#003300 vLink=#002200 leftMargin=0 topMargin=0>
<!--#include file="top.asp" -->
<!--#include file="navbar.asp" -->
<br>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0" class="index">
<tr>
<td colspan="7" valign="top" bgcolor="#FFFFFF" ><table width="100%" border="0" align="center">
<tr>
<td height="31"><img src="images/dotdb.gif" width="10" height="10" align="absmiddle">
当前位置:<a class=white_bg
href="/">首页</a> >> <a class=white_bg
href="./"><%= CategoryName_CHS %></a> >>
<%
response.write "查询条件 <font color=red>"&keyword&"</font> "
response.write "在"&CateName&"的"&SubCateName&"中"
%> </td>
</tr>
</table>
<%
if request("CateID")="" and request("SubCateID")="" then
sql="select * from "&CategoryName&"_SoftInfo where "&findword&" "
sql=sql&" order by SoftTime desc"
elseif request("SubCateID")="" then
sql="select * from "&CategoryName&"_SoftInfo where "&CateID&" "&findword&" "
sql=sql&" order by SoftTime desc"
else
sql="select * from "&CategoryName&"_SoftInfo where "&CateID&" "&SubCateID&" "&findword&" "
sql=sql&" order by SoftTime desc"
end if
' response.write ""&sql&""
' response.end
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'>没有或没有找到任何介绍链接</p><br><br>"
else
totalPut=rs.recordcount
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
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"Search.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"Search.asp"
end if
end if
rs.close
set rs=nothing
end if
sub showContent
dim i
i=0
dim j
j=(currentpage-1)*MaxPerPage+1
%>
<br>
<br>
<table width="713" border=0 align="center" cellpadding=0 cellspacing=0 class="index">
<tr bgcolor="#F6F6F6">
<td height="27" colspan="2" align="center" class="dixian" >
<div align="left"> 物品名称 </div></td>
<td width=65 height="27" align=center nowrap class="dixian" >发布日期</td>
<td width=50 height="27" align=center nowrap class="dixian" >物品价格</td>
<td width=40 height="27" align=center nowrap class="dixian" >人气</td>
</tr>
<%do while not rs.eof%>
<tr>
<td height="27" colspan="2"><%=j%>.<img src="images/list.gif" width="11" height="11" align="absmiddle"><a href="SoftView.Asp?SoftID=<%=rs("SoftID")%>" class="articlelist">
<%=replace(rs("SoftName"),""&keyword&"","<font color=red>"&keyword&"</font>")&" "&rs("SoftVer")%></a> </td>
<td align=middle width=65 nowrap><%=rs("SoftTime")%></td>
<td align=middle width=50 nowrap><% if rs("softsize")="0" then
Response.Write"价格面议"
else
Response.Write(round(rs("SoftSize")))
end if
%></td>
<td align=middle width=40 nowrap><%=rs("AllHits")%></td>
</tr>
<tr>
<td height="26" colspan="6"> ·<font color="#666666"><%=left(replace(trim(rs("Content")),""&keyword&"","<font color=red>"&keyword&"</font>"),120)%>......</font>[<%=rs("SoftTime")%>]</td>
</tr>
<tr>
<td height="26" nowrap><font color="green">交易地区:</font><%=trim(rs("LicenceType"))%></td>
<td colspan="4" height="26" nowrap>今日浏览次数:<%=trim(rs("DayHits"))%> 本周浏览次数:<%=trim(rs("WeekHits"))%>
本月浏览次数:<%=trim(rs("MonthHits"))%></td>
</tr>
<tr>
<td colspan="6" height="2" ></td>
</tr>
<%
j=j+1
i=i+1
rs.movenext
if i>=MaxPerPage then exit do
loop
%>
</table>
<div align="center">
<% 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
response.write "<table width='98%' border='0' align='center'><form method=Post action="&filename&"?CateID="&request("CateID")&"&SubCateID="&request("SubCateID")&"&action="&request("action")&"&keyword="&keyword&"><tr><td align='center'> "
response.write "<font color='red'>"&SubCateName&"</font>"
if CurrentPage<2 then
response.write ""&totalnumber&"个 首页 上一页 "
else
response.write ""&totalnumber&"个 <a href="&filename&"?page=1&CateID="&request("CateID")&"&SubCateID="&request("SubCateID")&"&action="&request("action")&"&keyword="&keyword&">首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"&CateID="&request("CateID")&"&SubCateID="&request("SubCateID")&"&action="&request("action")&"&keyword="&keyword&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&CateID="&request("CateID")&"&SubCateID="&request("SubCateID")&"&action="&request("action")&"&keyword="&keyword&">"
response.write "下一页</a> <a href="&filename&"?page="&n&"&CateID="&request("CateID")&"&SubCateID="&request("SubCateID")&"&action="&request("action")&"&keyword="&keyword&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
response.write " <b>"&maxperpage&"</b>条信息/页 "
%>
转到:
<select name='page' size='1' onChange='javascript:submit()'>
<%for i = 1 to n%>
<option value='<%=i%>' <%if CurrentPage=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
<%next%>
</select>
<%response.write "</td></tr></form></table>"%>
<%
end function
%>
<br>
<br>
</div></td>
</tr>
</table>
<br>
<!--#include file="end.asp" -->
</BODY></HTML>
<%
set rs=nothing
set Subrs=nothing
CloseDatabase
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -