Hello,
Is there a way to grab everyperson hostname/ip address that visits my site and store them into a txt file for later viewing ?
Thanks
:)
Printable View
Hello,
Is there a way to grab everyperson hostname/ip address that visits my site and store them into a txt file for later viewing ?
Thanks
:)
The following can be used in server side script (ASP)
Request.Servervariables("HTTP_REFERER") Where your page was linked from.
Request.ServerVariables("REMOTE_USER") The IP address of the Client PC. This is as their ISP has assigned them for the current session.
To save the IP address and visit time would be as follows:Hope this helps :cool:Code:<%
Sub SaveIPaddress()
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\mySiteVisitors.txt", ForAppending, True)
f.Write Request.ServerVariables("REMOTE_USER") & ", " Now()
f.Close
End Sub
%>
Jerry Grant beat me to it!
the only difference here though is that I used Server.MapPath and filename so the file can be easily viewed through a browser if required if you are using someone else's server.
Code:<html><BODY>
<%@ Language=VBScript%>
<%
dim ip
ip = Request.ServerVariables("REMOTE_ADDR")
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile(Server.MapPath(".\iplog.html"), ForAppending, True)
MyFile.Write now() & " " & ip
MyFile.Close
'response.write ip
%>
</BODY>
</HTML>