📄 ru_query.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<!--#include file="char.asp"-->
<%
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim keyword
dim sql
dim rs
dim founderr
dim errmsg
dim findword
founderr=false
keyword=request("keyword")
if keyword="" then
errmsg=errmsg+"<br>"+"请输入查询条件。"
founderr=true
else
keyword=replace(replace(replace(replace(keyword,"'","‘"),"<","<"),">",">")," "," ")
if request("action")="title" then
findword="title like '%"&keyword&"%' "
elseif request("action")="content" then
findword="content like '%"&keyword&"%' "
elseif request("action")="writer" then
findword="writer like '%"&keyword&"%' "
else
findword="title 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 classid,Nclassid
dim classname,Nclassname
if request("classid")="" then
classid=""
classname="所有分类"
' classid="classid=1 and "
' sql="select class from Aclass where classid=1"
' rs.open sql,conn,1,1
' classname=rs("class")
' rs.close
else
classid="classid="&cstr(request("classid"))&" and "
sql="select class from Aclass where classid="&cstr(request("classid"))
rs.open sql,conn,1,1
classname=rs("class")
rs.close
end if
if request("Nclassid")="" then
Nclassid=""
Nclassname="所有专题"
else
Nclassid=" Nclassid="&cstr(request("Nclassid"))&" and "
sql="select Nclass from ANclass where Nclassid="&cstr(request("Nclassid"))
rs.open sql,conn,1,1
Nclassname=rs("Nclass")
rs.close
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<LINK href="style.css" rel=stylesheet>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>大连企业管理测评培训中心[<%=classname%>]</title>
</head>
<body topmargin="0" leftmargin="0">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="720" id="AutoNumber3">
<tr>
<td><!--#include file="head.inc"-->
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="720" id="AutoNumber4">
<tr>
<td width="107" background="images/default_14.gif" valign="top">
<!--#include file="left.inc"-->
</td>
<td width="480" valign="top">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber6">
<tr>
<td width="100%">
<p style="line-height: 200%"><font color="#000F6C"> 您所在位置…搜索结果 </td>
</tr>
<tr>
<td width="100%">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="401" id="AutoNumber7" height="63">
<tr>
<td height="12"></td>
</tr>
<tr>
<td height="18"><img border="0" src="images/kong.GIF"></td>
</tr>
<tr>
<td height="64">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="401" id="AutoNumber8">
<tr>
<td bgcolor="#234EA6" valign="bottom" width="1">
<img border="0" src="images/line.GIF"></td>
<td width="400" valign="top">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%" id="AutoNumber9">
<tr>
<td width="100%"> </td>
</tr>
<tr>
<td width="100%">
<%
response.write "[查询条件] <font color=red><b>"&keyword&"</b></font> "
response.write "在"&classname&"的"&Nclassname&"中"
%>
<%
if request("classid")="" and request("Nclassid")="" then
sql="select * from article where "&findword&" "
sql=sql&" order by articleid desc"
elseif request("Nclassid")="" then
sql="select * from article where "&classid&" "&findword&" "
sql=sql&" order by articleid desc"
else
sql="select * from article where "&classid&" "&Nclassid&" "&findword&" "
sql=sql&" order by articleid 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>"
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,"ru_query.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"ru_query.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"ru_query.asp"
end if
end if
rs.close
end if
sub showContent
dim i ,content
i=0
%>
</td>
</table>
</center>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="18"><img border="0" src="images/search.GIF"></td>
</tr>
<tr>
<td height="1">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="401" id="AutoNumber8" height="1">
<tr>
<td bgcolor="#234EA6" valign="bottom" width="1" height="1">
<img border="0" src="images/line.GIF"></td>
<td width="400" valign="top" height="1">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%" id="AutoNumber9">
<tr>
<td width="100%"> </td>
</tr>
<tr>
<td width="100%">
<%do while not rs.eof%>
<img border="0" src="images/dot.GIF"><a href="list.asp?id=<%=rs("articleid")%>">
<font style='TEXT-DECORATION: underline'>
<b><%=replace(rs("title"),""&keyword&"","<font color=red>"&keyword&"</font>")%></b></font></a><br>
<div style="padding:10px 20px">
<%
content=nohtml(rs("content"))
response.write left(content,60)
%>......[<%=rs("dateandtime")%>]
</div>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%></td>
</tr>
<tr><td> </td></tr>
<tr>
<td width="100%">
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n, i
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<form method=Post action="&filename&"?classid="&request("classid")&"&Nclassid="&request("Nclassid")&"&action="&request("action")&"&keyword="&keyword&">"
response.write "<p align='center'><font color='red'>"&Nclassname&"</font> "
if CurrentPage<2 then
response.write ""&totalnumber&"篇 首页 上一页 "
else
response.write ""&totalnumber&"个 <a href="&filename&"?page=1&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"&action="&request("action")&"&keyword="&keyword&">首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"&action="&request("action")&"&keyword="&keyword&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"&action="&request("action")&"&keyword="&keyword&">"
response.write "下一页</a> <a href="&filename&"?page="&n&"&classid="&request("classid")&"&Nclassid="&request("Nclassid")&"&action="&request("action")&"&keyword="&keyword&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
response.write " <b>"&maxperpage&"</b>篇文章/页 "
%>
<p align="left">
<img border="0" src="images/dot2.GIF"> <select name='page' size='1' class="smallinput" onchange='javascript:submit()'>
<%for i = 1 to n%>
<option value='<%=i%>' <%if cint(CurrentPage)=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
<%next%>
</select>
</form>
<%
end function
%> </p>
<p align=center><!--#include file=query.asp-->
<%
set rs=nothing
conn.close
set conn=nothing
%>
</td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="12"></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
<tr>
<td width="100%"> </td>
</tr>
</table>
</td>
<td width="133" valign="top" background="images/index_66.GIF"><!--#include file="right.inc"--></td>
</tr>
</table>
<!--#include file="foot.inc"-->
</center>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -