Validates an IPv4 or IPv6 address.
string $requestIp:
string|array $ips:
boolean Whether the IP is valid
public static function checkIp($requestIp, $ips) {
if (!is_array($ips)) {
$ips = array(
$ips,
);
}
$method = false !== strpos($requestIp, ':') ? 'checkIp6' : 'checkIp4';
foreach ($ips as $ip) {
if (self::$method($requestIp, $ip)) {
return true;
}
}
return false;
}