=$ips[0] && $ip2<=$ips[1]) return 'local IP address:'.$ip; if ($ip2<$ips[1]) break; // sorted so we can bail } // check fb ipv6 $lip="127.0.0.1"; if (substr($ip,0,2)=='FB'||substr($ip,0,2)=='fb') 'local IP address:'.$ip; // see if server and browser are running on same server. if (array_key_exists('SERVER_ADDR',$_SERVER)) { $lip=$_SERVER["SERVER_ADDR"]; if ($ip==$lip) return 'ip same as server:'.$ip; } else if (array_key_exists('LOCAL_ADDR',$_SERVER)) { // IIS 7? $lip=$_SERVER["LOCAL_ADDR"]; if ($ip==$lip) return 'ip same as server:'.$ip; } else { // IIs 6 no server address use a gethost by name? Hope we never get here try { $lip=@gethostbyname($_SERVER['SERVER_NAME']); if ($ip==$lip) return 'ip same as server:'.$ip; } catch (Exception $e) { // can't make this work - ignore } } // we can do this with ip4 addresses - check if same /24 subnet $j=strrpos($ip,'.'); if ($j===false) return false; $k=strrpos($lip,'.'); if ($k===false) return false; if (substr($ip,0,$j)==substr($lip,0,$k)) return 'ip same /24 subnet as server'.$ip; return false; } } ?>