Авторизация

UMI CMS Фильтрация спама на сайте

Работает в версии UMICMS 2.8.5

Фильтрация спама на сайте в обратной связи с помощью stopforumspam.com по e-mail и ip.

public function isSpambots($mail,$ip){
$spambot = false;
//check the e-mail adress
$xml_string = file_get_contents('http://www.stopforumspam.com/api?email='.$mail);
$xml = new SimpleXMLElement($xml_string);
if($xml->appears == 'yes'){
$spambot = true;
}elseif($spambot != true){
//e-mail not found in the database, now check the ip
$xml_string = file_get_contents('http://www.stopforumspam.com/api?ip='.$ip);
$xml = new SimpleXMLElement($xml_string);
if($xml->appears == 'yes'){
$spambot = true;
}
}
return $spambot;
}

В модуле classes/modules/webforms в class.php в методе send добавляем проверку:

$cmsController = cmsController::getInstance();
$moduleUs = $cmsController->getModule("users");
if($moduleUs->isSpambots($_REQUEST['data']['new']['email'], $_SERVER['REMOTE_ADDR'])){
    $this->errorNewMessage("Подазрение на спам");
    $this->errorPanic();
    return false;
}

[ Saitadmin.ru || с 2006 по текущий год || Санкт-Петербург ]