<!-- #include file=../inc/BBSSetup.asp -->
<!-- #include file=../inc/Board_Popfun.asp -->
<%
DEF_BBS_HomeUrl = "../"
If DEF_DisplayOnlineUser <> 1 and DEF_DisplayOnlineUser <> 3 Then Response.End
Const LMT_Max_OnlineUserList = 500
OpenDatabase
DisplayUserOnline

Function DisplayUserOnline

	Dim BoardID,Url,ActiveUsers
	BoardID = Left(Request.QueryString("id"),14)
	Url = Left(Request.QueryString("ur"),30)

	ActiveUsers = Left(Request.QueryString("acu"),14)
	If isNumeric(ActiveUsers) = False Then ActiveUsers = 0
	If isNumeric(BoardID) = False Then BoardID = 0
	BoardID = Fix(cCur(BoardID))
	
	If BoardID > 0 and isArray(Application(DEF_MasterCookies & "BoardInfo" & BoardID)) = True Then ActiveUsers = cCur(Application(DEF_MasterCookies & "BDOL" & BoardID))

	%>
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=gb2312>
<meta http-equiv="Content-Language" content="zh-cn">
<body>

<script language=javascript>
var tempstr
parent.document.followImg0.loaded="yes";
tempstr="<table cellspacing=1 cellpadding=6 width=100%><tr><td><table width=100%>";
var n=1;
var rguser=0;

function s(GetData0,GetData1,GetData2)
{
	if(GetData0 == "")return;
	if(n==1)tempstr+="<tr>";
	tempstr+="<td>&nbsp;";
	if(GetData1 == null || trim(GetData1) == "")
	{
		tempstr+="<img src=images/yk.gif><a href=<%=Url%>User/LookUserMoreInfo.asp?OlID=" + GetData0 + ">游客</a></td>";
	}
	else
	{
		rguser+=1;
		if (GetData1 == "隐身")
		{
			tempstr+="<img src=images/yshy.gif><a href=<%=Url%>User/LookUserMoreInfo.asp?OlID=" + GetData0 + ">隐身</a></td>";
		}
		else
		{
			if(parseInt(GetData2)&(1<<(10-1))){tempstr+="<img src=images/zbz.gif>";}
			else
			{
				if(parseInt(GetData2)&(1<<(14-1))){tempstr+="<img src=images/qbz.gif>";}
				else
				{
					if(parseInt(GetData2)&(1<<(8-1))){tempstr+="<img src=images/ltbz.gif>";}
					else
					{
						if(parseInt(GetData2)&(1<<(2-1))){tempstr+="<img src=images/rzhy.gif>";}
						else{tempstr+="<img src=images/zchy.gif>";}
					}
				}
			}
			tempstr+="<a href='<%=Url%>User/LookUserInfo.asp?name=" + GetData1 + "'>" + GetData1 + "</a></td>";
		}
	}
	n+=1;
	if(n>7)
	{
		tempstr+="</tr>";
		n=1;
	}
}
function trim(str)
{
	var re = /( )/gi;
	var rv = str.replace(re,"");
	return(rv);
}
<%
	Dim Temp
	Temp = 0
	If ActiveUsers < Num + 1 Then ActiveUsers = Num + 1
	
	Dim Rs,SQL
	If BoardID = 0 Then
		SQL = "select TOP " & LMT_Max_OnlineUserList & " ID,UserName,HiddenFlag from LeadBBS_onlineUser order by id"
	Else
		SQL = "select TOP " & LMT_Max_OnlineUserList & " ID,UserName,HiddenFlag from LeadBBS_onlineUser where AtBoardID=" & boardID &" and UserID>0"
	End If

	Set Rs = Con.ExeCute(SQL)
	GBL_DBNum = GBL_DBNum + 1
	Dim Num
	Dim GetData
	If Not rs.Eof Then
		Response.Write "s("""
		Response.Write Rs.GetString(,,""",""",""");" & VbCrLf & "s(""","")
		'Response.Write Rs.GetString(,,""",",");" & VbCrLf & "s(""","")
		Response.Write ""","""",0);"
	Else
		Num = -1
	End If
	Rs.close
	Set Rs = Nothing
	closeDataBase

	If ActiveUsers < Num Then ActiveUsers = Num
	Temp = Num
	If isNumeric(application(DEF_MasterCookies & "ActiveUsers")) = 0 Then
		Application.Lock
		application(DEF_MasterCookies & "ActiveUsers") = 0
		Application.UnLock
	End If
	If application(DEF_MasterCookies & "ActiveUsers") < Temp Then
		Application.Lock
		application(DEF_MasterCookies & "ActiveUsers") = Temp
		Application.UnLock
	End If
	Response.Write "var online=" & cCur(application(DEF_MasterCookies & "ActiveUsers")) & ";" & VbCrLf & "if(online<rguser)online=rguser;" & VbCrLf
	Response.Write "tempstr+=""<tr><td colspan=7><img src=" & url & "images/null.gif width=2 height=4><br>&nbsp;目前论坛总共有 "" + online + "" 人在线。"
	If BoardID > 0 Then
		Response.Write "此版面共 " & ActiveUsers & " 人在线，"
		Response.Write "其中注册会员 "" + rguser + "" 人，游客 "" + (" & ActiveUsers & "-rguser) + "" 人 "
	Else
		Response.Write "其中注册会员 "" + rguser + "" 人，游客 "" + (online-rguser) + "" 人 "
	End If
	Response.Write "执行时间" & fix(abs(CDBL(Timer)*1000 - DEF_PageExeTime1*1000)) & "毫秒"
	If BoardID = 0 Then Response.Write "<br><img src=" & url & "images/null.gif height=7 width=2><br>&nbsp;图例： <img src=images/yk.gif>游客 &nbsp; <img src=images/yshy.gif>隐身会员 &nbsp; <img src=images/zbz.gif>总版主 &nbsp; <img src=images/qbz.gif>区版主 &nbsp; <img src=images/ltbz.gif>版主 &nbsp; <img src=images/rzhy.gif>认证会员 &nbsp; <img src=images/zchy.gif>注册会员"
	Response.Write "</td></tr>"";"
%>tempstr+="</table></td></tr></table>";
parent.followTd0.innerHTML = tempstr;
</script>
<BODY></BODY></HTML>
<%

End Function%>