Software
PHP snipplet for detecting users with IPv6
Should I ever need to detect with PHP if a user has IPv6, this code snipplet should do the job:
<?php
$ip = getenv ("REMOTE_ADDR");
if (substr_count($ip,":") > 0
&& substr_count($ip,".") == 0) {
echo 'You are using <a '
.'href="http://www.dnsstuff.com/tools/whois.ch?ip='
. $ip . '"> IPv6 </a>';
} else {
echo "You are using IPv4";
}
?>
0 TrackBacks
Listed below are links to blogs that reference this entry: PHP snipplet for detecting users with IPv6.
TrackBack URL for this entry: http://pugio.net/mt/mt-tb.cgi/9



Leave a comment