📄 index.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #include file="Conn.asp" -->
<!-- #include file="Function.asp" -->
<!-- #include file="Page.asp" -->
<%
'===============请保留以下版权信息==================
'程序名称:Goaler 采集
'程序版本:Ver 0.01
'运行环境:ASP+ACCESS+XMLHTTP
'采集目标:http://edu.cnzz.cn
'程序编写:goaler
'个人主页:http://www.goalercn.com
' http://blog.goalercn.com
'===============请保留以上版权信息==================
Dim StartTime,QueryNum
StartTime = Timer()
QueryNum = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>列表 - 演示</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.ListH {
padding:3px;
color:#0033FF;
font-weight:bold;
}
</style>
</head>
<body>
<%
Dim RS,listSQL,strCategory,i,Id,KeyWord,BorderId,ClassId,strPosition,QueryType
Id = Request.QueryString("Id")
KeyWord = CheckStr(Request.QueryString("keyword"),"s")
IF(Id<>"")THEN
IF(Instr(Id,","))THEN
BorderId = CheckStr(Split(Id,",")(0),"i")
ClassId = CheckStr(Split(Id,",")(1),"i")
QueryType = 2
ELSE
BorderId = CheckStr(Id,"i")
ClassId = False
QueryType = 1
END IF
ELSE
BorderId = False
ClassId = False
QueryType = 0
END IF
IF(KeyWord<>"" AND LEN(KeyWord)<=50)THEN QueryType = 3
Select Case(QueryType)
Case 3
listSQL = "SELECT A.Id,A.artTitle,A.artBID,A.artSID,A.artTime,A.artHits,S.SName,B.BName FROM artList A INNER JOIN (artSClass S INNER JOIN artBClass B ON S.BID=B.BID) ON A.artSID=S.SID WHERE A.artTitle LIKE '%"&KeyWord&"%' ORDER BY A.Id DESC"
strPosition = " >> 搜索 <font color=""blue"">"&KeyWord&"</font> 的结果"
SET RS=Conn.Execute("SELECT BID,BName FROM artBClass ORDER BY BID")
QueryNum = QueryNum + 1
IF(RS.EOF)THEN
strCategory = "没有分类"
ELSE
Do While(NOT RS.EOF)
strCategory = strCategory & "<a href=""Index.asp?Id="&RS(0)&""">"&RS(1)&"</a> | "
RS.MoveNext
Loop
END IF
RS.CLOSE
SET RS=NOTHING
Case 2
listSQL = "SELECT A.Id,A.artTitle,A.artBID,A.artSID,A.artTime,A.artHits,S.SName,B.BName FROM artList A INNER JOIN (artSClass S INNER JOIN artBClass B ON S.BID=B.BID) ON A.artSID=S.SID WHERE A.artSID=" & ClassId & " ORDER BY A.Id DESC"
SET RS=Conn.Execute("SELECT SID,SName FROM artSClass WHERE BID="&BorderId&" ORDER BY SID")
QueryNum = QueryNum + 1
IF(RS.EOF)THEN
strCategory = "没有分类"
ELSE
Do While(NOT RS.EOF)
strCategory = strCategory & "<a href=""Index.asp?Id="&BorderId&","&RS(0)&""">"&RS(1)&"</a> | "
RS.MoveNext
Loop
END IF
RS.CLOSE
SET RS=NOTHING
SET RS=Conn.Execute("SELECT S.SName,B.BName FROM artSClass S INNER JOIN artBClass B ON S.BID=B.BID WHERE S.SID="&ClassId)
QueryNum = QueryNum + 1
IF(RS.EOF)THEN
strPosition = " >>参数错误"
ELSE
strPosition = " >> <a href=""Index.asp?Id="&BorderId&""">"&RS(1)&"</a> >> <a href=""Index.asp?Id="&BorderId&","&ClassId&""">"&RS(0)&"</a>"
END IF
RS.CLOSE
SET RS=NOTHING
Case 1
listSQL = "SELECT A.Id,A.artTitle,A.artBID,A.artSID,A.artTime,A.artHits,S.SName,B.BName FROM artList A INNER JOIN (artSClass S INNER JOIN artBClass B ON S.BID=B.BID) ON A.artSID=S.SID WHERE A.artBID=" & BorderId & " ORDER BY A.Id DESC"
SET RS=Conn.Execute("SELECT SID,SName FROM artSClass WHERE BID="&BorderId&" ORDER BY SID")
QueryNum = QueryNum + 1
IF(RS.EOF)THEN
strCategory = "没有分类"
ELSE
Do While(NOT RS.EOF)
strCategory = strCategory & "<a href=""Index.asp?Id="&BorderId&","&RS(0)&""">"&RS(1)&"</a> | "
RS.MoveNext
Loop
END IF
RS.CLOSE
SET RS=NOTHING
SET RS=Conn.Execute("SELECT BName FROM artBClass WHERE BID="&BorderId)
QueryNum = QueryNum + 1
IF(RS.EOF)THEN
strPosition = " >>参数错误"
ELSE
strPosition = " >> <a href=""Index.asp?Id="&BorderId&""">"&RS(0)&"</a>"
END IF
RS.CLOSE
SET RS=NOTHING
Case Else
listSQL = "SELECT A.Id,A.artTitle,A.artBID,A.artSID,A.artTime,A.artHits,S.SName,B.BName FROM artList A INNER JOIN (artSClass S INNER JOIN artBClass B ON S.BID=B.BID) ON A.artSID=S.SID ORDER BY A.Id DESC"
strPosition = ""
SET RS=Conn.Execute("SELECT BID,BName FROM artBClass ORDER BY BID")
QueryNum = QueryNum + 1
IF(RS.EOF)THEN
strCategory = "没有分类"
ELSE
Do While(NOT RS.EOF)
strCategory = strCategory & "<a href=""Index.asp?Id="&RS(0)&""">"&RS(1)&"</a> | "
RS.MoveNext
Loop
END IF
RS.CLOSE
SET RS=NOTHING
End Select
%>
<table width="760" cellpadding="3" cellspacing="1" border="0" bgcolor="#cccccc" align="center">
<tr bgcolor="#f1f1f1">
<td align="center">
| <%=strCategory%>
</td>
</tr>
</table>
<table width="760" cellpadding="3" cellspacing="1" border="0" bgcolor="#cccccc" align="center">
<tr bgcolor="#FFF999">
<td colspan="3">当前位置:<a href="Index.asp">技术文章</a><%=strPosition%></td>
</tr>
<tr bgcolor="#f1f1f1">
<td width="530" align="left" class="ListH">标题</td>
<td width="150" align="center" class="ListH">时间</td>
<td width="80" align="center" class="ListH">人气</td>
</tr>
<%
Dim intPageSize,intPageCount,currPage,listResult,recCounts
intPageSize = 30 '每页记录数目
Set RS = Server.CreateObject("ADODB.RecordSet")
RS.Open listSQL,Conn,1,1
QueryNum = QueryNum + 1
'Response.Write(listSQL)
'计算总记录数
IF(Request.Cookies("recCounts")<>"")THEN
IF(Request.Cookies("listSQL") <> listSQL)THEN
recCounts = RS.RecordCount
Response.Cookies("recCounts") = recCounts
Response.Cookies("listSQL") = listSQL
ELSE
recCounts=Request.Cookies("recCounts")
END IF
ELSE
recCounts = RS.RecordCount
Response.Cookies("recCounts") = recCounts
Response.Cookies("listSQL") = listSQL
END IF
'=========计算页数=====================
IF (recCounts mod intPageSize)=0 THEN
intPageCount = recCounts\intPageSize
ELSE
intPageCount = recCounts\intPageSize+1
END IF
'Response.Write intPageCount
'==========取得当前页的page参数=============
currPage=Trim(Request.QueryString("page"))
IF currPage<>"" And Isnumeric(currPage) THEN
currPage=Clng(currPage)
IF currPage>intPageCount THEN currPage=intPageCount '如果取回的页数大于计算结果页
IF currPage<1 THEN currPage=1 '如果取回的页数小于计算结果页
ELSE
currPage=1
END IF
'Response.Write currPage
IF(recCounts<1)THEN
%>
<tr bgcolor="#ffffff">
<td colspan="3" align="left">没有内容</td>
</tr>
<%
ELSE
Dim j
RS.AbsolutePosition=(currPage-1)*intPageSize+1
listResult=RS.GetRows(intPageSize)
For j=0 To Ubound(listResult,2)
%>
<tr bgcolor="#ffffff" onmouseover="this.bgColor='#FFF999'" onmouseout="this.bgColor='#FFFFFF'">
<td align="left">[<a href="Index.asp?Id=<%=listResult(2,j)%>"><%=listResult(7,j)%></a> - <a href="Index.asp?Id=<%=listResult(2,j)%>,<%=listResult(3,j)%>"><%=listResult(6,j)%></a>] <a href="Article.asp?Id=<%=listResult(0,j)%>" target="_blank"><%=listResult(1,j)%></a></td>
<td align="center"><%=listResult(4,j)%></td>
<td align="center"><%=listResult(5,j)%></td>
</tr>
<%
Next
listResult = Null
%>
<tr bgcolor="#f1f1f1">
<td colspan="3"><%call RollPage(intPageSize,intPageCount,currPage,recCounts)%></td>
</tr>
<%
END IF
RS.CLOSE
SET RS=NOTHING
%>
</table>
<div align="center" style="padding:6px;">页面执行时间 <font color="#FF0000"><%=FormatNumber((Timer()-StartTime)*1000,2,-1)%></font> 毫秒, 查询数据库 <font color="#FF0000"><%=QueryNum%></font> 次. Powered By <span style="font-weight:bold;"><a href="http://www.goalercn.com"><font color="#9A4C32">Goaler</font><font color="#B8C549">CN</font>.<font color="#9A4C32">C</font><font color="#B8C549">om</font></a></span></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -