loading

Is it possible to find and store the IP address information of anyone that visits your site?

I know there are sites and images that show your IP Address, browser, OS, possible location, etc. Could you have some way of writing this found information into a database, or would that be too much of a security flaw? I'm not talking about tracert commands, IP locators, etc. EDIT: Sorry if i wasn't clear enough for anyone, I was meaning something like a PHP, HTML or Java code that logs the visitors IP Address (And if possible, some other miscellaneous information) on a .txt file or something similar.

sort by: active | newest | oldest
lemonie7 years ago
You may be able to get log files written of page requests. Check your web hosting package? L
iTraceur (author)  lemonie7 years ago
Should've thought of that, but sorry, nothing there...
You read something like this?
http://httpd.apache.org/docs/2.0/logs.html

L
Z1ggy7 years ago
This will tell you most of the info you want.

<html>
<body>
<p>
<b>You are browsing this site with:</b>
<%Response.Write(Request.ServerVariables("http_user_agent"))%>
</p>
<p>
<b>Your IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_addr"))%>
</p>
<p>
<b>The DNS lookup of the IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_host"))%>
</p>
<p>
<b>The method used to call the page:</b>
<%Response.Write(Request.ServerVariables("request_method"))%>
</p>
<p>
<b>The server's domain name:</b>
<%Response.Write(Request.ServerVariables("server_name"))%>
</p>
<p>
<b>The server's port:</b>
<%Response.Write(Request.ServerVariables("server_port"))%>
</p>
<p>
<b>The server's software:</b>
<%Response.Write(Request.ServerVariables("server_software"))%>
</p>
</body>
</html>
iTraceur (author)  Z1ggy7 years ago
Erm, I'm probably doing something incredibly wrong, but in a html file, it turns out like this: "You are browsing this site with: Your IP address is: The DNS lookup of the IP address is: The method used to call the page: The server's domain name: The server's port: The server's software:" I may not have clarified, I meant something that automatically writes the visitors IP Address into a file.
Z1ggy iTraceur7 years ago
Im sorry i should have specified. instead of a .html(.htm), the file should be a .aspx. THis will get you the information.

Its easy enough to add a function on pageload that sends this information to a database.

The below is in visual basic. It gets the IP address and stores it in a string, which you can use in calling a stored procedure.

Dim UserIPAddress As String

UserIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If UserIPAddress = "" Then
UserIPAddress = Request.ServerVariables("REMOTE_ADDR")
End If
oddmidge7 years ago
A vaguely remember a while ago there was PHP code to store data such as IP and that. I can't remember where it was, but i can tell you it is definitely possible and does exist, keep looking.
iTraceur (author)  oddmidge7 years ago
Great, thanks, thats exactly what i wanted! If you remember anything about it, please tell me!
Well, I don't know if this is a IP locator, but if you could somehow embed this, it could work. It does, afterall tell you all that info....
iTraceur (author)  thermoelectric7 years ago
Yeah, this is what I didn't want. Oh well.

I meant something like a PHP, HTML, or Java code that writes a visitors IP address to a file.

Sorry if I wasn't clear enough on that...