I'm making a joomla module and wanto block or ban bad words in message textarea. I tried
if(preg_match('/adult|sex|porn/i',trim($_POST['cf_message']))){
echo 'bad word, pls remove it';
}
But I want to quote the bad words in a text field in module backend, I entered bad words in the text field:
adult|sex|porn
$badwords= $params->get("bad_words", " ");
I changed above codes to be:
if(preg_match(/$badwords/i,trim($_POST['cf_message']))){
echo 'bad word, pls remove it';
}
but couldn't work.