📄 gbook.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="conn.asp" -->
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoDateTime(str, nNamedFormat, nLCID)
dim strRet
dim nOldLCID
strRet = str
If (nLCID > -1) Then
oldLCID = Session.LCID
End If
On Error Resume Next
If (nLCID > -1) Then
Session.LCID = nLCID
End If
If ((nLCID < 0) Or (Session.LCID = nLCID)) Then
strRet = FormatDateTime(str, nNamedFormat)
End If
If (nLCID > -1) Then
Session.LCID = oldLCID
End If
DoDateTime = strRet
End Function
</SCRIPT>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select id,g_title,g_name,g_time,g_hit,g_rhit,g_top from gbook where g_id=0 order by g_top,g_time desc"
rs.open sql,conn,1,1
if not rs.eof then
rs.PageSize =10 '每页显示10条记录
total=rs.RecordCount '获得记录总数
maxpage=rs.PageCount '获得翻页的页数目
page=request("page")
if Not IsNumeric(page) or page="" then '判断是否第一页
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
else
total=0
maxpage=0
page=0
end if
out=""
if not rs.eof then '如果不为空集
for i=1 to rs.PageSize
out=out&"<info id='"&rs("id")&"' g_title='"&rs("g_title")&"' g_name='"&rs("g_name")&"' g_time='"&DoDateTime(rs("g_time"), 2, -1)&"' g_hit='"&rs("g_hit")&"' g_rhit='"&rs("g_rhit")&"' g_top='"&rs("g_top")&"'/>" '写成XML格式,给Flash读取
rs.movenext
if rs.EOF then
i=i+1
Exit For
end if
next
end if
rs.close
set rs=nothing
Response.Write "<?xml version='1.0' encoding='utf-8'?>"
Response.Write "<gbook total='"&total&"' maxpage='"&maxpage&"' page='"&page&"'>" &out&"</gbook>"
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -