Display of IPv6/IPv4 address on this blog

Created:

I have got some questions on how I managed to get the IP address of the client connecting to this blog in the right column. Specifically the IPv6 address.

First of all, the blog do have native IPv6 access, which of course is needed for accessing it over IPv6. Sounds like a natural thing, but sometimes not so easy to get. The number of ISPs and hosting companies that do have native IPv6 is though exploding, so if you checked a year or two ago and did not find one, check again.

Then to the actual display. I use Executable PHP Plugin, and in the widget, I have the following code, that display an image as well as the IP address of the peer:


<b>
<?php if(preg\_match('/:/',$\_SERVER["REMOTE\_ADDR"])) : ?>
 <IMG SRC="/stuff/xxxxxxxxxx.jpg">
<?php endif ;?>
<?php printf("You: %s",$\_SERVER["REMOTE\_ADDR"]) ?>
</b>

I do though not disclose what image it is, as I do not think people not using IPv6 for accessing the page should know what it is (it is not that fun, but still).