<%
Function GetReallyIP()
Dim strIP
strIP=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If strIP="" Or InStr(strIP,"unknown") Then
strIP=Request.ServerVariables("REMOTE_ADDR")
ElseIf InStr(strIP,",") Then
strIP=Split(strIP,",")(0)
ElseIf InStr(strIP,";") Then
strIP=Split(strIP,";")(0)
End If
GetReallyIP=Trim(strIP)
End Function
'创建 FileSystemObject 对象实例
Set fso=Server.CreateObject("Scripting.FileSystemObject")
'创建一个文本文件并返回 TextStream对象
'Set txtFile = fso.CreateTextFile(Server.MapPath("log.txt"),True)
Set txtfile = fso.OpenTextFile(Server.MapPath("log.txt"), 8)
'对文件执行写操作
txtFile.WriteLine now()&"[a]"& GetReallyIP()
txtFile.Close
%>