You are here

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

Same name and namespace in other branches
  1. 7.5 src/Cleantalk.php \Cleantalk::net_match()
  2. 7 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

./cleantalk.module, line 1102
Main CleanTalk integration module functions.

Class

Cleantalk
Cleantalk class create request

Code

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