<!-- #include file="include/con_help.asp" -->
<!-- #include file="../include/functions.asp" -->
<!-- #include file="../include/jk_ip_sys.asp" -->
<%
dim wt
wt=int(format_mid_num(1))
tit="与我在线（模式二）"
if action="forum_view" then tit="查看在线用户论坛位置"
call web_head(0,0,0,0,0)
'----------------------------左边 开始----------------------------
call left_help()
call left_action()
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
if action="forum_view" then
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td>&nbsp;<%response.write img_skin("m_help")&tit%></td></tr>
<tr><td align=center><%call forum_view()%></td></tr>
<tr><td class=td>&nbsp;<%response.write img_skin("m_help")%>相关说明</td></tr>
<tr class=bg_td><td align=center height=30><%response.write img_user%></td></tr>
<tr class=bg_td><td align=center><%
select case wt
case 1
  response.write "本站现在已开启 标准模式：本站的注册用户可以登陆，并记录用户在线列表。"
case 2
  response.write "本站现在已开启 完整模式：所有登陆和浏览本站的人被并记录在线列表。"
case else
  response.write "本站现在已开启 简洁模式：本站的注册用户可以登陆，不记录在线列表。"
end select
%></td></tr>
<tr class=bg_td><td align=center><a href='online.asp' alt='更换到显示模式（一）' align='center'>更换到显示模式（一）</a></td></tr>
</table>
<%
  call web_end(0,0)
end if
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td>&nbsp;<%response.write img_skin("m_help")&tit%></td></tr>
<tr class=bg_td><td align=center><% call online_main() %></td></tr>
<tr><td class=td>&nbsp;<%response.write img_skin("m_help")%>相关说明</td></tr>
<tr class=bg_td><td align=center height=30><%response.write img_user%></td></tr>
<tr class=bg_td><td align=center><%
select case wt
case 1
  response.write "本站现在已开启 标准模式：本站的注册用户可以登陆，并记录用户在线列表。"
case 2
  response.write "本站现在已开启 完整模式：所有登陆和浏览本站的人被并记录在线列表。"
case else
  response.write "本站现在已开启 简洁模式：本站的注册用户可以登陆，不记录在线列表。"
end select
%></td></tr>
<tr class=bg_td><td align=center><a href='online.asp' alt='更换到显示模式（一）' align='center'>更换到显示模式（一）</a></td></tr>
</table>
<%
response.write ukong
'----------------------------中间 结束----------------------------
call web_end(0,0)

sub online_main()
  dim rssum,l_username,guest_name
  guest_name=request.cookies(joekoe_cms.web_cookies)("guest_name")
  if var_null(login_username)="" then
    response.write "<font class=blue>"
    if wt=1 then
      response.write request.cookies("joekoe_online")("guest_name")
    else
      response.write "游客"
    end if
    response.write "</font>，您好！"&web_nologin
  else
    response.write "<font class=blue>"&login_username&"</font>，您好！欢迎您注册并登陆本站！您现在可以点击浏览其它栏目的详细内容。"
  end if

  if wt=0 then
    response.write "<tr><td></td></tr><tr class=bg_td><td height=100>"
    exit sub
  end if
  if int(wt)>0 then
    sql="select count(l_id) from user_login where l_type=0"
    set rs=joekoe_cms.exec(sql,1)
    rssum=rs(0)
    rs.close
    sql="select user_login.*,user_data.power from user_data inner join user_login on user_login.l_username=user_data.username where user_login.l_type=0 order by user_login.l_id"
    call joekoe_cms.exec(sql,-1)
    rs.open sql,conn,1,3
%>
</td></tr>
<tr class=bg_tds><td><font class=red><b>在线用户</b></font>&nbsp;（<font class=red><% response.write rssum %></font>&nbsp;人）</td></tr>
<tr class=bg_td><td align=center height=150 valign=top>
  <table border=0 width='100%'>
  <tr><td <%response.write dd1%>></td><td <%response.write dd1%>></td><td <%response.write dd1%>></td><td <%response.write dd1%>></td><td <%response.write dd1%>></td></tr>
<%
    do while not rs.eof
      response.write "<tr>"
      for i=1 to 5
        if rs.eof then exit for
        l_username=rs("l_username")
        response.write vbcrlf&"<td>"&img_skin("icon_"&rs("power"))&"<a href='../user/view.asp?username="&server.urlencode(l_username)&"' alt='目前位置："&rs("l_where")&"<br>来访时间："&rs("l_tim_login")&"<br>活动时间："&rs("l_tim_end")&"<br>真实IP："&ip_types(rs("l_ip"),l_username,1)&"<br>"&view_sys(rs("l_sys"))&"' target=_blank"
        if cstr(l_username)=cstr(login_username) then
          response.write " class=blue"
        end if
        response.write ">"&l_username&"</a></td>"
        rs.movenext
      next
      response.write "</tr>"
    loop
    rs.close
    response.write "</table>"
  end if
  if int(wt)>1 then
    sql="select count(l_id) from user_login where l_type=1"
    set rs=joekoe_cms.exec(sql,1)
    rssum=rs(0)
    rs.close
    sql="select * from user_login where l_type=1 order by l_id"
    call joekoe_cms.exec(sql,-1)
    rs.open sql,conn,1,3
%>
</td></tr>
<tr class=bg_tds><td><font class=red><b>在线游客</b></font>&nbsp;（<font class=red><% response.write rssum %></font>&nbsp;人）</td></tr>
<tr class=bg_td><td align=center height=150 valign=top>
  <table border=0 width='98%'>
  <tr><td width='25%'></td><td width='25%'></td><td width='25%'></td><td width='25%'></td></tr>
<%
    do while not rs.eof
      response.write "<tr>"
      for i=1 to 4
        if rs.eof then exit for
        l_username=rs("l_username")
        response.write "<td>"&img_skin("icon_other")&"<font alt='目前位置："&rs("l_where")&"<br>来访时间："&rs("l_tim_login")&"<br>活动时间："&rs("l_tim_end")&"<br>"&ip_types(rs("l_ip"),l_username,1)&"<br>"&view_sys(rs("l_sys"))&"' target=_blank"
        if cstr(l_username)=cstr(guest_name) then
          response.write " class=blue"
        end if
        response.write ">"&l_username&"</font></td>"
        rs.movenext
      next
      response.write "</tr>"
    loop
    rs.close
    response.write "</table>"
  end if
  set rs=nothing
end sub

sub forum_view()
  dim vdim,vnum,nwid,fdim,f
  sql="select l_forum_online from user_login where l_forum_online<>0"
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  if rs.eof then
    rs.close
    response.write "<font class=gray>论坛当前没有人在线哦！</font>"
    exit sub
  end if
  vnum=rs.recordcount
  vdim=rs.getrows()
  rs.close
  sql="select forum_id,forum_name from bbs_forum where forum_f<>0"
  set rs=joekoe_cms.exec(sql,1)
  if rs.eof then
    response.write "<font class=gray>论坛还没添加版面哦！</font>"
    rs.close
  exit sub
  end if
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr class=bg_tds height=25 align=center>
<td width="30%">论坛版面</td>
<td>目前论坛共有 <font class=red><%response.write vnum%></font> 人在线！</td>
<td width="10%">百份数</td>
<td width="10%">在线人数</td>
</tr>
<%
  do while not rs.eof
  i=0
  for f=0 to vnum-1
  if rs("forum_id")=int(vdim(0,f)) then i=i+1
  next
    nwid=1
    if vnum>0 then
      nwid=cint(replace(formatpercent(i/vnum),"%",""))
    end if
%>
<tr class=bg_td align=center>
<td><a href=../forum/list.asp?forum_id=<%response.write rs("forum_id")%>><%response.write rs("forum_name")%></a></td>
<td align=left><img src='images/vote/vb<%response.write joekoe_cms.rand_num(1)%>.gif' border=0 height=10 width='<%response.write nwid%>%'></td>
<td class=tims><%response.write nwid%>%</td>
<td><font class=red><%response.write i%></font>人</td>
<%
    rs.movenext
  loop
  rs.close
  if isarray(vdim) then erase vdim
  if isarray(fdim) then erase fdim
%>
</tr>
</table>
<%
end sub
%>
