Hi,
I’m trying to filter what a user input in the subject because I noticed that I’m getting spam emails, so I created an array :
$BannedWords = array('bitcoin', 'crypto','apply now');
Then I have this code:
if (trim($subject) != '') {
if (!Validate::isMailSubject($subject)) {
$this->errors[] = $this->module->l('Subject is not valid.', 'createticket');
} elseif (Tools::strlen($subject) > 255) {
$this->errors[] = $this->module->l('Subject is greater then 255 characters.', 'createticket');
} elseif (Tools::strpos($subject) == (in_array($BannedWords))) {
header('Location: https://google.com');
exit;
}
} else {
$this->errors[] = $this->module->l('Subject is required field.', 'createticket');
}
The problem here is that I’m redirected whatever the subject is.