如何显示最后十名来访者?_编程10000问

<%
Application.Lock
IF NOT isArray( Application( "lastTen" ) ) THEN
  DIM dummy( 10, 3 )
  Application( "lastTen" ) = dummy<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

' 创建或者取得最近10个Application数组.
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]

时间: 2024-07-30 10:44:35

如何显示最后十名来访者?_编程10000问的相关文章

如何随机显示图片计数器?_编程10000问

count.asp< html >< head >< meta http-equiv="Content-Type"content="text/html; charset=gb2312" ><title>随风起舞之千变计数器</title></head><body><p><%dim outcountfile=server.mappath("aspcount.

如何检测用户第一次访问我的网站并显示友好信息?_编程10000问

< %@ LANGUAGE="VBscript" % >< % RequestName = Request.Form("Name")RequestLeaveMeAlone = Request.Form("LeaveMeAlone")If RequestName <  >"" or RequestLeaveMeAlone <  >"" then<?xml:nam

如何显示一个文本文件?_编程10000问

 Write(StrING) WriteLine(StrING) WriteBlankLines(LINES)  <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 〈html〉 〈head〉 〈http-equiv="Content-Type" content="text/html; charset=gb2312"〉 〈title〉

如何显示随机信息?_编程10000问

<html> <head> <title>千花飞舞之信息随机显示</title> </head> <body> <% randomize randomnum=int(rnd*6)+1 ' 随机发生次数. select CASE randomnum CASE 1%> 我最喜爱的出版社--中国水利水电出版社<br><?xml:namespace prefix = o ns = "urn:schema

如何在ASP里显示进度条?_编程10000问

response.buffer=true ' 应用缓存技术. dim lostnum ' 防止dmax过大而dstep过小. dim shownum delayshow(dstep,dmax) sub delayshow(dstep,dmax) ' dmax表示要处理多少dmax(步)才能完成全过程,dstep表示已处理的占全过程的大致百分比.  <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office

如何让一个方框栏内的文字滚动显示?_编程10000问

如何让一个方框栏内的文字滚动显示?<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> <!-- #include file="news.inc" --> <% dim NewsStr(1,5) NewsStr(0,0)="下载本栏链接" NewsStr(1,0)="http://www.intels.net

如何分页显示数据库查询结果?_编程10000问

<% if Request.QueryString("PageNumber").count > 0 then <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> ' 指定页号的参数PageNumber.如果指定页号,则以指定页号为依据. PageNumber = Request.QueryString("PageNumber&quo

如何用下拉列表显示数据库里的内容?_编程10000问

<%Dim objDC, objRS Set objDC = Server.CreateObject("ADODB.Connection")objDC.ConnectionTimeout = 15objDC.CommandTimeout = 30<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> ' 创建数据库连接 objDC.Open "

如何按时间显示最新标志_编程10000问

<%mytime=rs("time") '数据库中保存时间nowtime=now() '当前时间if datediff("d",mytime,nowtime)<1 then '比较当前时间和数据库中时间,如相差小于1,即显示图片new.gif%><img src="images/new.gif"><%end if%>