当前位置: 代码网 > it编程>编程语言>其他编程 > 如何显示最后十名来访者?

如何显示最后十名来访者?

2024年05月15日 其他编程 我要评论
<%application.lockif not isarray( application( "lastten" ) ) then dim dummy( 10, 3 ) application(

<%
application.lock
if not isarray( application( "lastten" ) ) then
  dim dummy( 10, 3 )
  application( "lastten" ) = dummy

' 创建或者取得最近10application数组.
end if
  lastten = application( "lastten" )
application.unlock

if lastten( 9, 0 ) <> "" then
for i = 0 to 9
  lastten( i, 0 ) = lastten( i + 1, 0 )
  lastten( i, 1 ) = lastten( i + 1, 1 )
  lastten( i, 2 ) = lastten( i + 1, 2 )

' 在数组里向下移动每位来访者.
next
end if

for i = 0 to 9

' 添加新数组.
  if lastten( i, 0 ) = "" then
    lastten( i, 0 ) = request.servervariables( "remote_addr" )
      lastten( i, 1 ) = request.servervariables( "http_user_agent" )
      lastten( i, 2 ) = now()
    exit for
  end if
next

application.lock
application( "lastten" ) = lastten
application.unlock

%>
<center>
<table bgcolor="#ccccc" cellspacing=0 cellpadding=3 border=1>
<tr bgcolor="lightyellow">
  <td>
来访者</td>
  <td>ip
地址</td>
  <td>
浏览器</td>
  <td>
访问时间</td>

' 显示最后10名来访者.
</tr>
<%
for i = 0 to 9
if lastten( i, 0 ) <> "" then
%>
<tr>
  <td><small><%=i + 1%></small></td>
  <td><small><%=lastten( i, 0 )%></small></td>
  <td><small><%=lastten( i, 1 )%></small></td>
  <td><small><%=lastten( i, 2 )%></small></td>
</tr>
<%
end if
next
%>
</table>

[1]

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com