Author Options:

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

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.


You may be able to get log files written of page requests. Check your web hosting package? L

Should've thought of that, but sorry, nothing there...


8 years ago

This will tell you most of the info you want.

<b>You are browsing this site with:</b>
<b>Your IP address is:</b>
<b>The DNS lookup of the IP address is:</b>
<b>The method used to call the page:</b>
<b>The server's domain name:</b>
<b>The server's port:</b>
<b>The server's software:</b>

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.

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

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.

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....

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...