<!-- #include file=../inc/BBSsetup.asp -->
<!-- #include file=../inc/Board_popfun.asp -->
<!-- #include file=../inc/ubbcode.asp -->
<!-- #include file=inc/UserTopic.asp -->
<%
DEF_BBS_HomeUrl = "../"
dim str1,str2,str3,str4
Dim GBL_ID,GBL_LookUserID,LookUserLevel
initDatabase
GBL_CHK_TempStr = ""
GBL_ID = Left(Request.QueryString("ID"),14)
If GBL_ID="" or isNumeric(GBL_ID)=0 Then GBL_ID = 0
GBL_ID = cCur(GBL_ID)
If GBL_ID = 0 Then
	GBL_ID = GBL_UserID
	GBL_LookUserID = GBL_ID
Else
	GBL_LookUserID = GBL_ID
End if

SiteHead(DEF_SiteNameString & " - 社员社员区")
UpdateOnlineUserAtInfo GBL_board_ID,"查看社员更多信息"
If GBL_ID=0 Then
	GBL_CHK_TempStr = "找不到社员，要查看自己的资料请先登录。<br>" & VbCrLf
End If

UserTopicTopInfo
DisplayUserNavigate("查看更多社员信息")
If GBL_UserID<>0 Then
	if GBL_ID=0 Then
		Response.Write "<br><p align=left><font color=ff0000 class=RedFont><b>" & GBL_CHK_TempStr & "</b></font>"
	Else
		GBL_CHK_TempStr = ""
		If LookUserInfo = 0 Then Response.Write "<br><p align=left><font color=ff0000 class=RedFont><b>" & GBL_CHK_TempStr & "</b></font>"
	End If
Else
	Response.Write "<p>请确认您的身份，游客无权查询</b>"
	DisplayLoginForm
End If
UserTopicBottomInfo
closeDataBase
SiteBottom
If GBL_ShowBottomSure = 1 Then Response.Write GBL_SiteBottomString

Function LookUserInfo
	
	Dim Online_OnlineFlag,Online_LastDoingTime,Online_IP,Online_StartTime
	
	Dim Form_ID,Form_UserName,Form_IP,Form_Login_oknum,SessionID,Browser,System
	Dim Rs,AtUrl,AtInfo,Login_RightIP
	
	Dim OlID
	
	OlID = Left(Request.QueryString("OlID"),14)
	If OlID="" or isNumeric(OlID)=0 Then OlID = 0
	OlID = cCur(OlID)
	If OlID > 0 Then
		Set Rs = Con.ExeCute("Select top 1 LastDoingTime,StartTime,IP,AtUrl,AtInfo,UserID,SessionID,Browser,System,ID from LeadBBS_onlineUser where ID=" & OlID)
	Else
		Set Rs = Con.ExeCute("Select top 1 LastDoingTime,StartTime,IP,AtUrl,AtInfo,UserID,SessionID,Browser,System,ID from LeadBBS_onlineUser where UserID=" & GBL_ID)
	End If
	GBL_DBNum = GBL_DBNum + 1
	If Rs.Eof Then
		Online_OnlineFlag = 0
	Else
		Online_OnlineFlag = 1
		Online_LastDoingTime = Rs(0)
		Online_StartTime = Rs(1)
		Online_IP = Rs(2)
		AtUrl = Rs(3)
		AtInfo = Rs(4)
		GBL_ID = cCur(Rs(5))
		SessionID = Rs(6)
		Browser = Rs(7)
		System = Rs(8)
		OlID = cCur(Rs(9))
		GBL_LookUserID = GBL_ID
	End If
	Rs.Close
	Set Rs = Nothing
	If Browser = "" Then Browser = "未知"
	If System = "" Then System = "未知"

	Dim ShowFlag

	Set Rs = Con.ExeCute("Select top 1 UserName,ShowFlag,UserLevel,IP,ID,Login_okNum,Login_RightIP from LeadBBS_User where id=" & GBL_LookUserID)
	GBL_DBNum = GBL_DBNum + 1
	If Online_OnlineFlag = 0 Then
		If Rs.Eof Then
			GBL_CHK_TempStr = GBL_CHK_TempStr & "社员不存在<br>" & VbCrLf
			LookUserInfo = 0
			GBL_CHK_Flag = 0
			Rs.Close
			Set Rs = Nothing
			Exit Function
		End If
	End If

	If Not Rs.Eof Then
		Form_UserName = Rs(0)
		ShowFlag = Rs(1)
		REM 特殊数据
		Form_IP = Rs(3)
		Form_ID = Rs(4)
		Form_Login_oknum = Rs(5)
		Login_RightIP = Rs(6)
		If (ShowFlag = True or ShowFlag = 1) and DEF_EnableUserHidden = 1 and (CheckSupervisorUserName = 0) Then Online_OnlineFlag = 0
	Else
		Form_UserName = ""
		ShowFlag = 1
		Form_IP = "0.0.0.0"
		Form_ID = 0
		Form_Login_oknum = 0
	End If
	Rs.Close
	Set Rs = Nothing

	Set Rs = Con.ExeCute("Select top 1 UserLevel from LeadBBS_User where ID=" & GBL_UserID)
	GBL_DBNum = GBL_DBNum + 1
	If Not Rs.Eof Then
		LookUserLevel = cCur(Rs(0))
	Else
		LookUserLevel = 0
	End If
	Rs.Close
	Set Rs = Nothing
	
	If GBL_UserID=GBL_LookUserID or CheckSupervisorUserName = 1 Then LookUserLevel=15

	Dim Old_GBL_CHK_User
	Old_GBL_CHK_User = GBL_CHK_User
	GBL_CHK_User = Form_Username
	If CheckSupervisorUserName = 1 Then
		Form_IP = "218.53.238.111"
		Online_IPAddress = "218.53.238.111"
		Online_IP = "218.53.238.111"
	End If
	GBL_CHK_User = Old_GBL_CHK_User
	%>
	<br><p><b>社区<%
	If GBL_ID = 0 or CheckSupervisorUserName = 0 Then
		Response.Write "第" & OlID & "号在线人员"
	Else
		Response.Write "第<font color=ff0000 class=RedFont>" & GBL_ID & "</font>号社员"
	End If%>其它档案资料</b>
	<TABLE border=0 cellpadding="0" cellspacing="0" width=400>
	<TR align=middle>
		<TD colspan="2">
			<TABLE border=0 class=font cellpadding="0" cellspacing="0" width=400><%
			If GBL_ID > 0 and (OlID=0 or LookUserLevel >= 15) Then%>
			<TR>
				<TD height=2 bgcolor="#ececff" width=100 class=TBBG1><img src="<%=DEF_BBS_HomeUrl%>images/null.GIF" width=1 height=1></TD>
				<TD height=2 bgcolor="#ececff" width=300 class=TBBG1><img src="<%=DEF_BBS_HomeUrl%>images/null.GIF" width=1 height=1></TD>
			</TR>
			<TR>
				<TD height="25" width=100>
					<p>社员注册编号：
				</TD>
				<TD height="25">
					<a href=LookUserInfo.asp?ID=<%=GBL_ID%>><%=GBL_ID%></a></TD>
			</TR>
			<TR>
				<TD height="25">
					<p>社员使用账号：
				</TD>
				<TD height="25">
					<%=Server.HtmlEncode(Form_Username)%></TD>
			</TR><%end If%>
			<tr>
				<td colspan=2 bgcolor=F7F7F7 height=25 class=TBBG1>
					:::::::::::其它资料:::::::::::</td>
			</tr><%If Online_OnlineFlag=1 Then%>
			<TR>
				<TD height="25" width=100>
					<p><img src="<%=DEF_BBS_HomeUrl%>images/null.GIF" width=100 height=1><br>浏览器及系统：
				</TD>
				<TD height="25">
					<%=Browser%> / <%=System%></TD>
			</TR><%End If
			If GBL_ID > 0 and (Online_OnlineFlag > 1 or CheckSupervisorUserName = 1) Then%>
			<TR>
				<TD height="25" width=100>
					<p><img src="<%=DEF_BBS_HomeUrl%>images/null.GIF" width=100 height=1><br>成功登录次数：
				</TD>
				<TD height="25">
					<%If LookUserLevel>=4 Then
						Response.Write Form_Login_oknum & "次"
					Else
						Response.Write "需要5级社员才能查看"
					End If%></TD>
			</TR><%
			End If
			If LookUserLevel>=0 Then%>
			<TR>
				<TD height="25">
					<p>社员是否在线：
				</TD>
				<TD height="25">
					<%
					If Online_OnlineFlag=1 Then
						Response.Write "是"
					else
						Response.Write "否或隐身"
					End If%></TD>
			</TR><%If Online_OnlineFlag=1 Then%>
			<TR>
				<TD height="25">
					<p>当前浏览网页：
				</TD>
				<TD height="25">
					<a href="<%=AtUrl%>"><%=AtInfo%></a></TD>
			</TR><%End If
			End If%>
			<TR>
				<TD height="25">
					<p>在线登录时间：
				</TD>
				<TD height="25">
					<%			
					If LookUserLevel>=9 Then
						If Online_OnlineFlag=1 Then
							response.Write RestoreTime(Online_StartTime)
						else
							Response.Write "</font>离线或隐身</font>"
						end If
					Else
						Response.Write "需要10级社员才能查看"
					End If%></TD>
			</TR><%
					If LookUserLevel>=15 Then%>
			<TR>
				<TD height="25">
					<p>最后操作时间：
				</TD>
				<TD height="25">
					<%
						If Online_OnlineFlag=1 Then
							Response.Write RestoreTime(Online_LastDoingTime)
						else
							Response.Write "</font>离线或隐身</font>"
						end If
					'Else
					'	Response.Write "需要7级社员才能查看"%></TD>
			</TR><%
			End If
			If CheckSupervisorUserName = 0 and Online_OnlineFlag=1 Then
				Form_IP=Online_IP
			End If
			
			Dim Online_IPAddress,Form_IPAddress
			Form_IPAddress = GetIPAddressData(Form_IP)
			If CheckSupervisorUserName = 1 or GBL_UserID=GBL_LookUserID Then
			Else
				Form_IPAddress = ""
			End If
			
			
			If CheckSupervisorUserName = 1 Then Online_IPAddress = GetIPAddressData(Online_IP)
			If CheckSupervisorUserName = 1 Then
			Else
				Online_IPAddress = ""
				Online_IP = ""
			End If
			%>
			<%If CheckSupervisorUserName = 1 and Online_OnlineFlag=1 Then%>
			<TR>
				<TD height="25">
					<p>Session标识：
				</TD>
				<TD height="25">
					<%=SessionID%></TD>
			</TR>
			<TR>
				<TD height="25">
					<p>在线ＩＰ地址：
				</TD>
				<TD height="25">
					<%=Online_IP%></TD>
			</TR>
			<TR>
				<TD height="25">
					<p>在线地理位置：
				</TD>
				<TD height="25">
					<%=Online_IPAddress%></TD>
			</TR><%End If
			If GBL_ID = 0 Then
				Form_IP = "游客无注册IP地址"
				Form_IPAddress = "游客无注册地理位置"
			End If
			If CheckSupervisorUserName = 1 Then%>
			<TR>
				<TD height="25">
					<p>注册ＩＰ地址：
				</TD>
				<TD height="25">
					<%=Form_IP%></TD>
			</TR><%End If%>
			<%If (CheckSupervisorUserName = 1) or Form_IPAddress <> "" Then%>
			<TR>
				<TD height="25">
					<p>注册地理位置：
				</TD>
				<TD height="25">
					<%=Form_IPAddress%></TD>
			</TR><%End If			
			
			If Login_RightIP = "3u7s9_d9299Xls" Then Login_RightIP = "无"
			If LookUserLevel>=15 and CheckSupervisorUserName = 1 Then%>
			<TR>
				<TD height="25">
					<p>登录ＩＰ地址：
				</TD>
				<TD height="25">
					<%=Login_RightIP%></TD>
			</TR>
			<TR>
				<TD height="25">
					<p>登录地理位置：
				</TD>
				<TD height="25">
					<%If Login_RightIP <> "" and Login_rightIP <> "无" Then Response.Write GetIPAddressData(Login_RightIP)%></TD>
			</TR><%End If%>
			</tr>
			</TABLE>
		</TD>
	</TR>
	<TR>
		<TD colspan="2" height=2 bgcolor="ececff" class=TBBG1><img src="<%=DEF_BBS_HomeUrl%>images/null.GIF" width=1 height=1></TD>
	</TR>
	</TABLE>
	<%

End Function

Function DisplayOfficerString(Officer)

	Dim Officer_Temp,Temp_N,dotFlag
	dotFlag = 0
	Officer_Temp = split(Officer,",")
	For Temp_N = 0 to Ubound(Officer_Temp,1)
		If isNumeric(Officer_Temp(Temp_N)) Then
			Officer_Temp(Temp_N) = cCur(Officer_Temp(Temp_N))
			If Officer_Temp(Temp_N)>=0 and Officer_Temp(Temp_N)<=DEF_UserOfficerNum Then
				If dotFlag = 0 Then
					dotFlag = 1
					DisplayOfficerString = DisplayOfficerString & DEF_UserOfficerString(Officer_Temp(Temp_N))
				Else
					DisplayOfficerString = DisplayOfficerString & "," & DEF_UserOfficerString(Officer_Temp(Temp_N))
				End If
			End If
		End If
	Next

End Function

Function GetIPAddressData(IP)

	dim sip,num
	if ip<>"" then
		sip=ip
		If inStr(sip,".") = 0 Then Exit Function
		str1=left(sip,instr(sip,".")-1)
		sip=mid(sip,instr(sip,".")+1)
		If inStr(sip,".") = 0 Then Exit Function
		str2=left(sip,instr(sip,".")-1)
		sip=mid(sip,instr(sip,".")+1)
		If inStr(sip,".") = 0 Then Exit Function
		str3=left(sip,instr(sip,".")-1)
		str4=mid(sip,instr(sip,".")+1)
		if isNumeric(str1)=0 or isNumeric(str2)=0 or isNumeric(str3)=0 or isNumeric(str4)=0 then
		else
			num=cint(str1)*256*256*256+cint(str2)*256*256+cint(str3)*256+cint(str4)-1
		end if
	else
		ip="0.0.0.0"
		num=0
		str1="0.0"
	End If
	If CheckSupervisorUserName = 0 or LookUserLevel<1 Then Exit Function
	Dim Rs
	Set Rs = Con.ExeCute("select top 1 country,city from [LeadBBS_IPAddress] where ip1 <=" & num & " and ip2 >=" & num)
	GBL_DBNum = GBL_DBNum + 1

	If Not Rs.Eof Then
		GetIPAddressData = Rs("Country") & rs("city")
	end If
	Rs.Close
	Set Rs = Nothing
	If GetIPAddressData = "" Then GetIPAddressData="未知"

end function%>