SixXS::Sunset 2017-06-06

Webserver displays client-address
[at] Shadow Hawkins on Friday, 09 September 2005 13:26:12
I´d like to put a display of the clients IP-address in the bottom of my test-webserver, much like sixxs.net have it. I think this could be done in PHP. Since I am not the great programmen - could someone supply a code-snippet to include in my page? tia karl
Webserver displays client-address
[ch] Jeroen Massar SixXS Staff on Friday, 09 September 2005 14:22:35
<?php if (strstr(getenv("REMOTE_ADDR"), ".")) echo "IPv4"; else echo "IPv6"; ?> Or in english: when there is a dot (.) in the Remote Address, thus the client, then it is IPv4, other wise IPv6. This also handles the case where one gets IPv4 compatibility or mapped addresses which contain an IPv4 address. These connections are actually IPv4 anyway.

Please note Posting is only allowed when you are logged in.

Static Sunset Edition of SixXS
©2001-2017 SixXS - IPv6 Deployment & Tunnel Broker