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";
}
?>




Leave a comment