Opencart Filter Cyrillic Characters In Contact Us Form.

A client is getting lots of “Russian” looking spam in his contact us form.  I edited this file.

web/catalog/controller/information/contact.php

In the validate section, which starts like this;
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {

Just before this line;

$mail->setText($this->request->post['enquiry']);

Add this code block

if (preg_match("/\p{Cyrillic}+/u", $this->request->post['enquiry'])) {
    $log = new Log('error.log');
    $log->write('Cyrillic characters found in the enquiry field: ' . $this->request->post['enquiry']);
    exit;

}

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.