下面是一统计的asp的代码,记录访问次程序的ip地址与个数还有时间 在同一的目录下生成txt文件记录下来
效果是
0:17:29----219.132.XX
0:17:43----219.132.XX
0:22:46----60.191.52XX
0:22:46----60.191.52XX
0:22:46----60.191.52XX
0:22:46----60.191.52XX
0:50:32----58.46.XX
但是如果刷新的话便会重复写入文件,请问如何能记录cookies去重复。
主要的目的就是去重复,请教如何修改.万分感激 !
<%
strLogFile = date & "-ss.txt"
Name = request("Name")
Pass = request("Pass")
StrLogText = time & "----" & request.servervariables("REMOTE_HOST")
set f = Server.CreateObject("Scripting.FileSystemObject")
If f.FileExists(Server.mappath(strLogFile)) = True Then
Set ff = f.OpenTextFile(Server.mappath(strLogFile), 8, False, 0)
Else
Set ff = f.CreateTextFile(Server.mappath(strLogFile), true)
End If
ff.writeline(StrLogText)
ff.close
set ff = nothing
set f = nothing
%>
<%
dim text
files=server.mappath(date & "-ss.txt")
set txtfile=server.createobject("scripting.filesystemobject")
set txt=txtfile.opentextfile(files,1,true,false)
do while not txt.atendofstream
c=c+1
%>
<%text=text+txt.readline() & ("<br>")%>
<%
loop
%>
<% response.write "今天总共访问[<font color=#FD2828>" & c & "</font>]次.<br>"%>
<% response.write text %>
[此贴子已经被作者于2007-10-28 0:55:52编辑过]