You are here

public function Cleantalk::net_match in Anti Spam by CleanTalk 7.5

Same name and namespace in other branches
  1. 7 cleantalk.module \Cleantalk::net_match()
  2. 7.2 cleantalk.module \Cleantalk::net_match()
  3. 7.4 src/Cleantalk.php \Cleantalk::net_match()

From http://php.net/manual/en/function.ip2long.php#82397

File

src/Cleantalk.php, line 622

Class

Cleantalk
Cleantalk Base class

Code

public function net_match($CIDR, $IP) {
  list($net, $mask) = explode('/', $CIDR);
  return (ip2long($IP) & ~((1 << 32 - $mask) - 1)) == ip2long($net);
}