<!--#include file="conn.asp" -->
<!--#include file="inc/const.asp"-->
<%
Dim CurrentPage
Dim maxperpage
Dim totalnumber
Dim Pcount
Dim DownloadClass_Ads
Dim Rs
Dim SQL
Dim NowStats
Dim HtmlTitle
Dim Style_CSS
Dim HtmlTempStr
Dim TempTopStr
Dim TempFootStr
Dim bookmark
Dim i
OnlineList
If IsObject(DownloadClass_Ads) Then
	Set DownloadClass_Ads = Nothing
End If
CloseConn
Public Sub OnlineList()
	DownsysClass.LoadTemplates ("")
	Set DownloadClass_Ads = New Adcolumn_Cls
	Set Rs = Server.CreateObject("adodb.recordset")
	NowStats = "在线人数统计信息"
	HtmlTitle = "在线人数统计信息"
	TempTopStr = DownsysClass.mainhtml(0) & DownsysClass.mainhtml(1) & DownsysClass.mainhtml(2) & DownsysClass.mainhtml(3)
	TempFootStr = DownsysClass.mainhtml(4)
	Style_CSS = Replace(Replace(DownsysClass.Style_CSS, "{$SetupDir}", DownsysClass.SetupDir), "{$PicUrl}", DownsysClass.TempDir)
	HtmlTempStr = TempTopStr
	HtmlTempStr = Replace(HtmlTempStr, "{$NavMenu}", DownsysClass.SortingMenu)
	HtmlTempStr = Replace(HtmlTempStr, "{$Width}", DownsysClass.mainset(0))
	HtmlTempStr = Replace(HtmlTempStr, "{$Style_CSS}", Style_CSS)
	If CInt(DownsysClass.Setting(5)) = 0 Then
		HtmlTempStr = Replace(HtmlTempStr, "{$TopMeun}", DownsysClass.mainset(9))
	Else
		HtmlTempStr = Replace(HtmlTempStr, "{$TopMeun}", DownsysClass.mainset(10))
	End If
	HtmlTempStr = Replace(HtmlTempStr, "{$NowStats}", NowStats)
	HtmlTempStr = Replace(HtmlTempStr, "{$Title}", HtmlTitle)
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(0)}", DownloadClass_Ads.RunScriptAds(7))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(1)}", DownloadClass_Ads.BannerAds(7))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(2)}", DownloadClass_Ads.AdsColumn(7, 2))
	HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(3)}", DownloadClass_Ads.AdsColumn(7, 3))
	Response.Write HtmlTempStr
	TempFootStr = Replace(TempFootStr, "{$FootMeun}", DownsysClass.mainset(11))
	TempFootStr = Replace(TempFootStr, "{$Width}", DownsysClass.mainset(0))
	TempFootStr = Replace(TempFootStr, "{$Adcolumn(4)}", DownloadClass_Ads.ScriptFloatAds(7))
	TempFootStr = Replace(TempFootStr, "{$Adcolumn(5)}", DownloadClass_Ads.ScriptFixedAds(7))
	If Not IsEmpty(Request("page")) Then
		CurrentPage = CInt(Request("page"))
	Else
		CurrentPage = 1
	End If
	maxperpage = 30 '###每页显示数
	If Not IsNumeric(Request("page")) And Request("page") <> "" Then
		Response.Write "错误的系统参数!请输入整数"
		Err.Raise -19691969
	End If
	Response.Write "<SCRIPT src=online.asp></SCRIPT>"
	Response.Write "<TABLE width="""
	Response.Write DownsysClass.mainset(0)
	Response.Write """ class=TableBorder cellSpacing=0 cellPadding=0 align=center border=0>"
	Response.Write " <TR class=Border2>"
	Response.Write " <TD>"
	Response.Write "<BR style=""OVERFLOW: hidden; LINE-HEIGHT: 3px"">"
	Response.Write "<TABLE widTH=""99%"" bgcolor=""#CECECE"" cellSpacing=1 cellPadding=0 align=center border=0>"
	Response.Write " <TR>"
	Response.Write " <TH>用户名</TH>"
	Response.Write " <TH>用户身份</TH>"
	Response.Write " <TH>访问时间</TH>"
	Response.Write " <TH>活动时间</TH>"
	Response.Write " <TH>用户IP</TH>"
	Response.Write " <TH>操作系统</TH>"
	Response.Write " <TH>浏览器</TH>"
	Response.Write " </TR>"
	SQL = "select  * from NC_online order by lastTime desc"
	Rs.Open SQL, conn, 1, 1
	If Rs.bof And Rs.EOF Then
		Response.Write "<tr><td colspan=5 class=forumrow>还没有找到任何软件！</td></tr>"
	Else
		totalnumber = Rs.recordcount
		If (totalnumber Mod maxperpage) = 0 Then
			Pcount = totalnumber \ maxperpage
		Else
			Pcount = totalnumber \ maxperpage + 1
		End If
		Rs.MoveFirst
		If CurrentPage > Pcount Then CurrentPage = Pcount
		If CurrentPage < 1 Then CurrentPage = 1
		Rs.Move (CurrentPage - 1) * maxperpage
		bookmark = Rs.bookmark
		i = 0
		Do While Not Rs.EOF And i < CLng(maxperpage)
			Response.Write " <TR class=""Border2"">"
			Response.Write " <TD align=""center"" height=22>"
			Response.Write Rs("username")
			Response.Write "</TD>"
			Response.Write " <TD align=""center"">"
			Response.Write Rs("identity")
			Response.Write "</TD>"
			Response.Write " <TD align=""center"">"
			Response.Write Rs("startTime")
			Response.Write "</TD>"
			Response.Write " <TD align=""center"">"
			Response.Write Rs("lastTime")
			Response.Write "</TD>"
			Response.Write " <TD align=""center"">"
			Response.Write Rs("ip")
			Response.Write "</TD>"
			Response.Write " <TD align=""center"">"
			Response.Write usersysinfo(Rs("browser"), 2)
			Response.Write "</TD>"
			Response.Write " <TD align=""center"">"
			Response.Write usersysinfo(Rs("browser"), 1)
			Response.Write "</TD>"
			Response.Write " </TR>"
			Rs.movenext
			i = i + 1
			If i >= maxperpage Then Exit Do
		Loop
	End If
	Rs.Close
	Set Rs = Nothing
	Response.Write " <TR> "
	Response.Write " <TD colspan=""7"" height=25 class=""Border1"">"
	Call showpage
	Response.Write "</TD>"
	Response.Write "</TR>"
	Response.Write "</TABLE>"
	Response.Write "<BR style=""OVERFLOW: hidden; LINE-HEIGHT: 3px"">"
	Response.Write "</TD>"
	Response.Write "</TR>"
	Response.Write "</TABLE>"
	Response.Write TempFootStr
End Sub


Private Sub showpage()
	Dim filename
	Dim ii
	Dim n
	filename = "onlinelist.asp"
	If totalnumber Mod maxperpage = 0 Then
		n = totalnumber \ maxperpage
	Else
		n = totalnumber \ maxperpage + 1
	End If
	Response.Write "<table cellspacing=1 width='100%' border=0><form method=Post action=" & filename & "><tr><td align=center> " & vbCrLf
	If CurrentPage < 2 Then
		Response.Write " 当前在线人数 <font COLOR=#FF0000>" & totalnumber & "</font> 人&nbsp;&nbsp;首 页&nbsp;&nbsp;上一页&nbsp;&nbsp;&nbsp;"
	Else
		Response.Write "当前在线人数 <font COLOR=#FF0000>" & totalnumber & "</font> 人&nbsp;&nbsp;<a href=" & filename & "?page=1>首 页</a>&nbsp;&nbsp;"
		Response.Write "<a href=" & filename & "?page=" & CurrentPage - 1 & ">上一页</a>&nbsp;&nbsp;&nbsp;"
	End If
	If n - CurrentPage < 1 Then
		Response.Write "下一页&nbsp;&nbsp;尾 页 " & vbCrLf
	Else
		Response.Write "<a href=" & filename & "?page=" & (CurrentPage + 1) & ">下一页</a>"
		Response.Write "&nbsp;&nbsp;<a href=" & filename & "?page=" & n & ">尾 页</a>" & vbCrLf
	End If
	Response.Write "&nbsp;页次：<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
	Response.Write "&nbsp;<b>" & maxperpage & "</b>个/页 " & vbCrLf
	Response.Write "&nbsp;转到： "
	Response.Write "&nbsp;<select name='page' size='1' style=""font-size: 9pt"" onChange='javascript:submit()'>" & vbCrLf
	For ii = 1 To n
		Response.Write "&nbsp;<option value='" & ii & "' "
		If CurrentPage = CInt(ii) Then
			Response.Write "selected "
		End If
		Response.Write ">第" & ii & "页</option>"
	Next
	Response.Write "&nbsp;</select> " & vbCrLf
	Response.Write "</td></tr></FORM></table>" & vbCrLf
End Sub


Private Function usersysinfo(info, getinfo)
	Dim usersys
	If InStr(info, ";") > 0 Then
		usersys = Split(info, ";")
		If UBound(usersys) >= 2 Then
			usersys(1) = Replace(usersys(1), "MSIE", "Internet Explorer")
			usersys(2) = Replace(usersys(2), ")", "")
			usersys(2) = Replace(usersys(2), "NT 5.2", "2003")
			usersys(2) = Replace(usersys(2), "NT 5.1", "XP")
			usersys(2) = Replace(usersys(2), "NT 5.0", "2000")
			usersys(2) = Replace(usersys(2), "9x", "Me")
			usersys(2) = Replace(usersys(2), "CE", "CE")
			usersys(2) = Replace(usersys(2), "Linux", "Linux")
			usersys(2) = Replace(usersys(2), "SunOS", "SunOS")
			usersys(2) = Replace(usersys(2), "Mac", "Mac")
			usersys(1) = Trim(usersys(1))
			usersys(2) = Trim(usersys(2))
			If getinfo = 1 Then
				usersysinfo = usersys(1)
			Else
				usersysinfo = usersys(2)
			End If
		Else
			If getinfo = 1 Then
				usersysinfo = "未 知"
			Else
				usersysinfo = "未 知"
			End If
		End If
	Else
		If getinfo = 1 Then
			usersysinfo = "未 知"
		Else
			usersysinfo = "未 知"
		End If
	End If
End Function
%>
