<% 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 = "" & LinkName & "" If Rs("isLogo") <> 0 Then If Not IsNull(Rs("LogoUrl")) And Trim(Rs("LogoUrl")) <> "" Then strLinkLogo = "" Else strLinkLogo = "暂无LOGO" End If Else strLinkLogo = "文字连接" 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 = "
" & vbCrLf If CurrentPage < 2 Then strTemp = strTemp & " 共有友情连接 " & totalnumber & " 个  首 页  上一页   " Else strTemp = strTemp & "共有友情连接 " & totalnumber & " 个  首 页  " strTemp = strTemp & "上一页   " End If If n - CurrentPage < 1 Then strTemp = strTemp & "下一页  尾 页 " & vbCrLf Else strTemp = strTemp & "下一页" strTemp = strTemp & "  尾 页" & vbCrLf End If strTemp = strTemp & " 页次:" & CurrentPage & "/" & n & "页 " strTemp = strTemp & " " & maxperpage & "个/页 " & vbCrLf strTemp = strTemp & "
" & vbCrLf ShowLinkPage = strTemp End Function CloseConn %>