You are here

public function CleantalkSFW::check_ip in Anti Spam by CleanTalk 7.5

Same name and namespace in other branches
  1. 7.2 cleantalk.module \CleanTalkSFW::check_ip()
  2. 7.4 src/CleantalkSFW.php \CleantalkSFW::check_ip()

File

src/CleantalkSFW.php, line 63

Class

CleantalkSFW

Code

public function check_ip() {
  foreach ($this->ip_array as $current_ip) {
    $this->db_result_data = db_query('SELECT network FROM {cleantalk_sfw} WHERE network = :network & mask', array(
      ':network' => sprintf("%u", ip2long($current_ip)),
    ))
      ->fetchField();
    if (!empty($this->db_result_data)) {
      $this->result = true;
      $this->blocked_ip = $current_ip;
      $this->blocked_network = $this->db_result_data;
    }
    else {
      $this->passed_ip = $current_ip;
    }
  }
}