I needed a little something to check if one of my files was called from an internal IP, and for this I made this little function.
$IP = ip2long($IP);
$StartIP = ip2long("10.0.0.100");
$EndIP = ip2long("10.0.0.150");
if ($IP >= $StartIP && $IP <= $EndIP)
$ip = $_SERVER['REMOTE_ADDR'];