<!-- #Include File="../Include/Skin.asp" -->
<!-- #Include File="../Include/functions.asp" -->
<!-- #Include File="../Include/Cls_IpSys.asp" -->
<!-- #Include File="../Include/Cls_PageCute.asp" -->
<%
dim wt
wt=int(Cls.Web_Mode)
tit="与我在线"
call DoWebHead(0,0)
call online_main()
call DoWebEnd()

sub online_main()
  dim tmp1,gname,TrHtml,TmpStr,tmpend
  if Not Is_LoginTrue then
    gname=request.cookies(Cls.web_cookies)("guest_name")
  else
    gname=login_username
  End If
  Cls.ReadPage "online_view"
  TrHtml = Cls.CutFixContent(NewContent, "[Repeat]" , "[/Repeat]", 0)
if wt=0 then
   tmp1 = "<tr class=tr><td colspan=4><font class=red>当前模式不统计在线列表！</font></td></tr>"
   tmpend = ""
else
  dim obj_page
  set obj_page=new Cls_PageCute
  obj_page.pageurl="?"
  obj_page.nummer=Format_Mid_Num(12)
  obj_page.page_t=1
  obj_page.page_p=8
  obj_page.page_unit="位"
  obj_page.page_tit="在线用户"
  obj_page.v_id="l_id"
  call obj_page.p_init("l_id,l_username,l_where,l_type,l_tim_login,l_tim_end,l_ip,l_sys,l_power","AsaiMHUserLogin","","l_id desc")
  sql=obj_page.sql_count
  set rs=Cls.exec(sql,1)
  obj_page.rssum=rs(0)
  rs.close
  call obj_page.p_main("l_id,l_username,l_where,l_type,l_tim_login,l_tim_end,l_ip,l_sys,l_power","AsaiMHUserLogin","","l_id desc")
  for i=1 to obj_page.page_num
  tmp1=tmp1&online_type(i+obj_page.page_now,rs("l_id"),rs("l_username"),rs("l_where"),rs("l_type"),rs("l_tim_login"),rs("l_tim_end"),rs("l_ip"),rs("l_sys"),rs("l_power"),gname,trhtml)
    rs.movenext
  next
  rs.close
  tmpend = "<tr><td colspan=6 class=tr0><div id=""asaipage""> "&obj_page.page_var&" "&obj_page.page_cute&" "&obj_page.page_shortcut&"</div></td></tr>"
  set obj_page=nothing
end if
	select case wt
	case 1
	  TmpStr="本站现在已开启 简洁模式：本站的注册用户可以登陆，并记录用户在线列表"
	case 2
	  TmpStr="本站现在已开启 完整模式：所有登陆和浏览本站的人被并记录在线列表。"
	case else
	  TmpStr="本站现在已开启 节能模式：本站的注册用户可以登陆，不记录在线列表"
	end select
    NewContent = Replace(NewContent,"[Repeat]"&TrHtml&"[/Repeat]",tmp1)
	Cls.HtmlRcod "img_user",img_user
	Cls.HtmlRcod "online_mode",TmpStr
    Cls.HtmlRcod "ends",tmpend
	Cls.HtmlRcod "tit",tit
	Cls.HtmlRcod "m_help2",img_skin("m_help2")
	Cls.OutPage
End Sub

Function online_type(u_i,u_id,u_username,u_where,u_type,u_tim_login,u_tim_end,u_ip,u_sys,u_power,gname,u_trhtml)
  Dim u_online,u_tim
  'If login_modep=1 then
   ' u_where=Cls.code_html(u_where,1,40)
  'else
    u_where=""&Cls.code_html(u_where,1,40)&""
  'End If
  If login_modep=1 then 
     u_tim=""&Cls.time_type(u_tim_end,3)&"" 
  else 
    u_tim="权限不足" 
  End If 
  If login_modep=1 then 
    u_ip="<a href='"&Cls.Web_Dir&"Common/Ip_Address.asp?ip="&u_ip&"'  title='"&Cls.code_html(u_where,1,200)&vbcrlf&"（管理员点此查看地理位置）'>"&u_ip
  else 
    u_ip="权限不足" 
  end if 
  If datediff("n",u_tim_end,now)<5 then 
    u_online="[<font color=red>活 跃</font>]" 
    else 
    u_online="[<font color=#808080>发 呆</font>]" 
  End If 
  Dim HtmlStr:HtmlStr=u_TrHtml
  HtmlStr = Replace(HtmlStr,"{$u_i}",u_i)
  HtmlStr = Replace(HtmlStr,"{$u_username}",online_username(u_type,u_username,gname,u_ip,u_sys))
  HtmlStr = Replace(HtmlStr,"{$u_where}",u_where)
  HtmlStr = Replace(HtmlStr,"{$u_online}",u_online)
  HtmlStr = Replace(HtmlStr,"{$u_tim}",u_tim)
  HtmlStr = Replace(HtmlStr,"{$u_power}",Cls.img("icon_"&u_power))
  HtmlStr = Replace(HtmlStr,"{$u_ip}",u_ip)
  online_type=HtmlStr
End Function

Function online_username(u_type,u_username,gname,u_ip,u_sys)
dim sTmp
    if int(u_type)=1 then
      sTmp=sTmp&"<a href='"&Cls.Web_Dir&"User/View.asp?username="&server.urlencode(u_username)&"'"
    else
      if cstr(u_username)=cstr(gname) then
        sTmp=sTmp&"<font class=blue"
      else
        sTmp=sTmp&"<font class=Gys"
      End If
    End If
    sTmp=sTmp&" title='"&ip_types(u_ip)&vbcrlf&view_sys(u_sys,0)&"' target=_blank"
    if cstr(u_username)=cstr(login_username) then
      sTmp=sTmp&" class=blue"
    End If
    sTmp=sTmp&">"&u_username
    if int(u_type)=0 then
     sTmp=sTmp&"</a>"
    else
     sTmp=sTmp&"</font>"
    End If
online_username=sTmp
End Function
%>