%
Response.Expires=-1
if isbanip(Request.ServerVariables("REMOTE_ADDR"))=true or isbanip(Request.ServerVariables("HTTP_X_FORWARDED_FOR"))=true then
Response.Write "
"
Response.End
elseif StatusOpen=false then
Response.Write ""
Response.End
end if
call addstat("view")
%>
<%=HomeName%>
onLoad="<%=framecheck%>">
<%
'
Dim cn,rs
set cn=server.CreateObject("ADODB.Connection")
set rs=server.CreateObject("ADODB.Recordset")
CreateConn cn,dbtype
'=============分页控制=============
Dim ItemsCount,PagesCount,CurrentItemsCount,ipage
if clng(ItemsPerPage)>0 then
ItemsPerPage=clng(ItemsPerPage)
else
ItemsPerPage=10
end if
rs.Open "SELECT COUNT(id) FROM main",cn,,,1
ItemsCount=rs(0)
rs.Close
if ItemsCount mod ItemsPerPage <>0 then
PagesCount=ItemsCount \ ItemsPerPage +1
else
PagesCount=ItemsCount \ ItemsPerPage
end if
if isnumeric(request("page")) and request("page")<>"" then
if clng(request("page"))>PagesCount then
ipage=PagesCount
elseif clng(request("page"))>0 then
ipage=clng(request("page"))
else
ipage=1
end if
else
ipage=1
end if
if ipage=PagesCount then
CurrentItemsCount=ItemsCount - ItemsPerPage*(ipage -1)
else
CurrentItemsCount=ItemsPerPage
end if
if ItemsCount>0 then rs.Open "SELECT * FROM (SELECT TOP " &cstr(CurrentItemsCount)& " * FROM (SELECT TOP " &cstr(ItemsPerPage*(ipage-1)+CurrentItemsCount)& " * FROM main ORDER BY id DESC) ORDER BY id ASC) ORDER BY id DESC",cn,,,1
'==============================
%>
<%if ShowTitle=true then%>
<%
if HomeLogo<>"" then Response.Write " "
if HomeName<>"" then
if HomeAddr<>"" then
Response.Write "" &HomeName& " >> leave word"
else
Response.Write HomeName& " >> leave word"
end if
else
Response.Write "leave word"
end if
%>
|
<%end if%>
<%
if ItemsCount=0 then
Response.Write "
目前尚无留言,请点击“签写留言”。 "
else
dim pagename
pagename="index"%>
<%rs.Close%>
<%end if%>
<%if PagesCount>1 then%>
| [留言分页] |
|
<%
for j=1 to PagesCount
if j=ipage then
Response.Write "[" &cstr(j)&"] "
else
Response.Write "[" &cstr(j)&"] "
end if
next
%>
|
<%end if
if StatusSearch=true and PagesCount>0 then%>
<%end if%>
|
<%
cn.Close
set rs=nothing
set cn=nothing
'
%>