index.asp
来自「小游戏网站演示www.4399.io 拥有4万条游戏数据」· ASP 代码 · 共 132 行
ASP
132 行
<!--#include file="../conn.asp"-->
<!--#include file="../inc/const.asp"-->
<!--#include file="../inc/classmenu.asp"-->
<%
dim maxperpage, totalnumber, totalpagenum, currentpage, i
'dim rs, sql, sqllink,htmlcontent
dim flushaddress,linkaddress
dim templistcontent,listcontent
dim strlinkname,linkname,strlinklogo,strlinkpage
newasp.preventinfuse
newasp.loadtemplates 9999, 6, 0
htmlcontent = newasp.htmlcontent
htmlcontent = replace(htmlcontent,"{$installdir}", newasp.installdir)
htmlcontent = replace(htmlcontent, "{$channelid}", 0)
htmlcontent = replace(htmlcontent,"{$pagetitle}","友情连接")
maxperpage = newasp.chknumeric(newasp.htmlsetting(1)) '每页显示连接数
flushaddress = newasp.chknumeric(newasp.htmlsetting(2)) '是否直接显示连接地址
currentpage = newasp.chknumeric(request("page"))
if cint(currentpage) = 0 then currentpage = 1
if request("type") <> "" then
sqllink = "where islock <> 1 and islogo=" & newasp.chknumeric(request("type"))
else
sqllink = "where islock <> 1"
end if
'记录总数
totalnumber = newasp.execute("select count(linkid) from nc_link " & sqllink & "")(0)
totalpagenum = cint(totalnumber / maxperpage) '得到总页数
if totalpagenum < totalnumber / maxperpage then totalpagenum = totalpagenum + 1
if currentpage < 1 then currentpage = 1
if currentpage > totalpagenum then currentpage = totalpagenum
set rs = server.createobject("adodb.recordset")
sql = "select * from nc_link " & sqllink & " order by linktime desc,linkid desc"
if issqldatabase = 1 then
if currentpage > 100 then
rs.open sql, conn, 1, 1
else
set rs = newasp.execute(sql)
end if
else
rs.open sql, conn, 1, 1
end if
if rs.bof and rs.eof then
'htmlcontent = htmlcontent & newasp.htmlsetting(4)
htmlcontent = replace(htmlcontent, newasp.cutfixcontent(htmlcontent, "[showrepetend]", "[/showrepetend]", 1), newasp.htmlsetting(4))
else
i = 0
if totalpagenum > 1 then rs.move (currentpage - 1) * maxperpage
templistcontent = newasp.cutfixcontent(htmlcontent, "[showrepetend]", "[/showrepetend]", 1)
'listcontent = templistcontent
do while not rs.eof and i < cint(maxperpage)
if not response.isclientconnected then response.end
if flushaddress = 1 then
linkaddress = newasp.checktopic(rs("linkurl"))
else
linkaddress = "link.asp?id=" & rs("linkid") & "&url=" & newasp.checktopic(rs("linkurl"))
end if
linkname = newasp.htmlencode(rs("linkname"))
strlinkname = "<a href=""" & linkaddress & """ title=""" & linkname & """ target=""_blank"">" & linkname & "</a>"
if rs("islogo") <> 0 then
if not isnull(rs("logourl")) and trim(rs("logourl")) <> "" then
strlinklogo = "<a href=""" & linkaddress & """ title=""" & linkname & """ target=""_blank""><img src='" & newasp.readfileurl(rs("logourl")) & "' width=88 height=31 border=0></a>"
else
strlinklogo = "<a href=""" & linkaddress & """ title=""" & linkname & """ target=""_blank"">暂无logo</a>"
end if
else
strlinklogo = "<a href=""" & linkaddress & """ title=""" & linkname & """ target=""_blank"">文字连接</a>"
end if
listcontent = listcontent & templistcontent
listcontent = replace(listcontent,"{$linkid}", rs("linkid"))
listcontent = replace(listcontent,"{$linkurl}", linkaddress)
listcontent = replace(listcontent,"{$linkname}", strlinkname)
listcontent = replace(listcontent,"{$linklogo}", strlinklogo)
listcontent = replace(listcontent,"{$linkhist}", rs("linkhist"))
listcontent = replace(listcontent,"{$readme}", newasp.htmlencode(rs("readme")))
rs.movenext
i = i + 1
if i >= maxperpage then exit do
loop
htmlcontent = replace(htmlcontent, templistcontent, listcontent)
htmlcontent = replace(htmlcontent, "[showrepetend]", "")
htmlcontent = replace(htmlcontent, "[/showrepetend]", "")
end if
rs.close:set rs = nothing
strlinkpage = showlinkpage
htmlcontent = replace(htmlcontent, "{$友情连接分页代码}", strlinkpage)
htmlcontent = replace(htmlcontent, "{$readlistpage}", strlinkpage)
htmlcontent = readclassmenu(htmlcontent)
htmlcontent = readclassmenubar(htmlcontent)
response.write htmlcontent
'================================================
'过程名:showlinkpage
'作 用:友情连接分页
'================================================
function showlinkpage()
dim filename, ii, n,strtemp
filename = "index.asp"
on error resume next
if totalnumber mod maxperpage = 0 then
n = totalnumber \ maxperpage
else
n = totalnumber \ maxperpage + 1
end if
strtemp = "<table cellspacing=1 width='100%' border=0><tr><td align=center> " & vbcrlf
if currentpage < 2 then
strtemp = strtemp & " 共有友情连接 <font color=#ff0000>" & totalnumber & "</font> 个 首 页 上一页 "
else
strtemp = strtemp & "共有友情连接 <font color=#ff0000>" & totalnumber & "</font> 个 <a href=" & filename & "?page=1&type=" & request("type") & ">首 页</a> "
strtemp = strtemp & "<a href=" & filename & "?page=" & currentpage - 1 & "&type=" & request("type") & ">上一页</a> "
end if
if n - currentpage < 1 then
strtemp = strtemp & "下一页 尾 页 " & vbcrlf
else
strtemp = strtemp & "<a href=" & filename & "?page=" & (currentpage + 1) & "&type=" & request("type") & ">下一页</a>"
strtemp = strtemp & " <a href=" & filename & "?page=" & n & "&type=" & request("type") & ">尾 页</a>" & vbcrlf
end if
strtemp = strtemp & " 页次:<strong><font color=red>" & currentpage & "</font>/" & n & "</strong>页 "
strtemp = strtemp & " <b>" & maxperpage & "</b>个/页 " & vbcrlf
strtemp = strtemp & "</td></tr></table>" & vbcrlf
showlinkpage = strtemp
end function
closeconn
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?