- Internet & the Web
Show your visitors IP address
There are many instances were a webmaster/blogger might want to display the IP addresses of their visitors on a particular page, and for a number of reasons. It can, for example help to minimise fraud and help ban spammers and malicious people from your site by identifying their IP addresses. Or you can use it to get to know the location of your specific visitors. The applications are quite many and vary depending on what you want to use the addresses for.
In this hub/article I will provide you with the necessary code, (in multiple scripting languages) that you can implement into webpages on your website in order to, like the title of the article says, display your visitor's Ip address.
Before I continue, I would like to note that this hub is targeted towards users who are at least experienced or knowledgeable in basic scripting/programming languages. ASP, Java and PHP to be specific. If you are not familiar with any of these, I highly recommend you learn them before you attempt to use any of the code I will provide you. (Don't worry, they don't take that long to learn.)
Alright, now that you understand what this article is about, lets get right to the coding:
Scan through the following and copy and paste whichever code/language best suits your current needs. Don't forget to include their respective opening and closing tags when implementing them into your webpage(s).
var ip= '<!--#echo var="REMOTE_ADDR"-->'; document.write("Your IP Address is :"+ip+" ");
<? $remote_address = getenv("REMOTE_ADDR"); echo "Your IP address is $remote_address."; $browser_type = getenv("HTTP_USER_AGENT"); echo "You are using $browser_type."; ?>