功能强大:
<%
Dim ValidEntry
ValidEntry = True
If not IsEmpty(Session("LogIn")) then ValidEntry = False
If ValidEntry Then
Const ForAppending = 8
Const Create = true
Dim FSO
DIM TS
DIM MyFileName
'Dim strLog
Dim strTime,strUrl,strOporation,strUserAgent
MyFileName = Server.MapPath("MyLogFile.txt")
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set TS = FSO.OpenTextFile(MyFileName, ForAppending, Create)
strTime=now()
strUrl=Request.ServerVariables("REMOTE_ADDR") & " "
strOporation=Request.ServerVariables("HTTP_REFERER") & " "
strUserAgent=Request.ServerVariables("HTTP_USER_AGENT") & " "
' Write current information to Log Text File.
Ts.writeline "来访者详细资料:"
TS.writeline "访问时间:"&strTime
Ts.writeline "访问者IP地址:"&strUrl
Ts.writeline "前次访问网址:"&strOporation
Ts.writeline "浏览器及操作系统:"&strUserAgent
Ts.writeline "----------------------------------------"
TS.Writeline ""
' Create a session varialbe to check next time for ValidEntry
Session("LogIn") = "yes"
Set TS = Nothing
Set FSO = Nothing
End If
%>