Webserver displays client-address
![]()
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
<?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.
|