Hello. You need to make a request filter, there is a $ request variable, which contains a request from a visitor, there is a second variable $ bad_word , which stores the list of forbidden words in a file in the bad_word format '=> "Sex, Porn, etc." to separate words, use a comma and a space . It is necessary to make it so that if any word from the $ bad_word variable matches, the $ request variable will take an empty value. It is desirable that the words from bad_word can be used independently of the register. I myself understand little in PHP, you can say a beginner, but you need to do it now. Thanks, I will be grateful for any tips.

    2 answers 2

    To get an array of words from the $ bad_word string, use the explode () function, you can use the foreach loop to search and check all elements of the array, you can use stripos () to search for words in the sentence.

    • Thank you, I read a lot of interesting things, but how to put this into practice? I'm not asking my laziness, I'm just not a programmer, I understand HTML a little, but then the dark forest is for me. I think for a knowledgeable person it will take 5 minutes, and today I spent all day on it .. - admydoor
    • 3
      If you are not a programmer and do not plan to become one, it is easiest to save time by contacting <a href=" free-lance.ru/"> free-lance.ru </ a >. And you, for money, will write a ready-made script of any complexity. - KiTE
    • The script works, I just want to modify it, because even I am not a programmer, I understand that there are only 3-6 lines of code, I can pay within reason, if no one can help for free. ICQ 305 405 000 or admydoor_sobaka_yandex.ru - admydoor

    You just need to find the occurrence of the substring in the string. Use mb_stripos () , which, unlike stripos (), works with UTF-8 characters.

    <?php $needle = trim($request); if(mb_stripos($bad_word, $needle) !== false){ $request = null; } ?> 
    • one
      it would not be bad to see the opinions of the minus - korytoff