View file system/connections/cheader/antispam.php

File size: 2.41Kb
<?php
  
if (post('message') || post('name') || post('title') || post('msg') || post('mess') || post('surname') || post('nature') || post('films') || post('music') || post('books') || post('interests') || post('profession') || post('about_me') || post('status') || post('comment') || post('komm') || post('comments')){
  
  if (post('comments')){
    
    $text = post('comments');
  
  }elseif (post('komm')){
    
    $text = post('komm');
  
  }elseif (post('comment')){
    
    $text = post('comment');
  
  }elseif (post('status')){
    
    $text = post('status');
  
  }elseif (post('about_me')){
    
    $text = post('about_me');
  
  }elseif (post('profession')){
    
    $text = post('profession');
  
  }elseif (post('interests')){
    
    $text = post('interests');
  
  }elseif (post('books')){
    
    $text = post('books');
  
  }elseif (post('music')){
    
    $text = post('music');
  
  }elseif (post('films')){
    
    $text = post('films');
  
  }elseif (post('nature')){
    
    $text = post('nature');
  
  }elseif (post('surname')){
    
    $text = post('surname');
  
  }elseif (post('mess')){
    
    $text = post('mess');
  
  }elseif (post('msg')){
    
    $text = post('msg');
  
  }elseif (post('name')){
    
    $text = post('name');
  
  }elseif (post('title')){
    
    $text = post('title');
  
  }elseif (post('message')){ 
    
    $text = post('message');
  
  }else{
    
    $text = null;
  
  }
  
  $text = esc($text);
  
  $spam = 0;
  $data = db::get_string_all("SELECT `DOMAIN` FROM `ANTISPAM`");
  while ($list = $data->fetch()){
    
    if (preg_match("/".mb_strtolower(strtolower($list['DOMAIN']), 'UTF-8')."/", mb_strtolower(strtolower($text), 'UTF-8'))){
      
      $spam = 1;
      
    }
    
  }
  
  if ($spam == 1) {
    
    $message_spam = "Пользователь [b][url=/id".user('ID')."]".user('LOGIN')."[/url][/b] использовал в сообщении запретное доменное имя или фразу.
    
    [b]Вот его сообщение:[/b] ".$text;
    
    $data = db::get_string_all("SELECT `ID` FROM `USERS` WHERE `MANAGEMENT` = '1'");
    while ($list = $data->fetch()){
      
      messages::get(intval(config('SYSTEM')), $list['ID'], $message_spam);
    
    }
    
    error('Сработала блокировка: в тексте обнаружено запрещенное доменное имя или фраза');    
    redirect('/');
    
  }

}