public function CleanTalkSFW::check_ip in Anti Spam by CleanTalk 7.2
Same name and namespace in other branches
- 7.5 src/CleantalkSFW.php \CleantalkSFW::check_ip()
- 7.4 src/CleantalkSFW.php \CleantalkSFW::check_ip()
File
- ./
cleantalk.module, line 65 - Main CleanTalk integration module functions.
Class
- CleanTalkSFW
- Cleantalk Spam FireWall class
Code
public function check_ip() {
$n = 1;
$r = db_query("SHOW TABLES LIKE 'cleantalk_sfw'");
$ob = $r
->fetchObject();
if (isset($ob) && is_object($ob)) {
for ($i = 0; $i < sizeof($this->ip_array); $i++) {
$r = db_query("select count(network) as cnt from `cleantalk_sfw` where network = " . $this->ip_array[$i] . " & mask;");
$cnt = intval($r
->fetchObject()->cnt);
if ($cnt > 0) {
$this->result = true;
$this->blocked_ip = $this->ip_str_array[$i];
}
else {
$this->passed_ip = $this->ip_str_array[$i];
}
}
}
if ($this->passed_ip != '') {
$key = variable_get('cleantalk_authkey', '');
@setcookie('ct_sfw_pass_key', md5($this->passed_ip . $key), 0, "/");
}
}