Jump to content

[1.7.8.2/ php 7.4] Spam question. Contact form. reCAPTCHA


Hans Wolf

Recommended Posts

  • Hans Wolf changed the title to [1.7.8.2/ php 7.4] Spam question. Contact form. reCAPTCHA

contactform.php

Find: function sendMessage().

Add your message control.

Add after $clientTokenTTL:

$restricts = ['#','/','$','%','*'];
$isValidMessage = true;
foreach ($restricts as $restrict) {
  if (strpos($message, $restrict) !== false){$isValidMessage = false;}
}

And update:

elseif (!Validate::isCleanHtml($message))

To:

elseif (!Validate::isCleanHtml($message) || $isValidMessage == false)

 

obrazek.png.8f475fda0d750d745c16aedee60fad8e.png

 

obrazek.png.c50c4cd4b9c60bf6492024ac925a5345.png

Edited by 4you.software (see edit history)
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

Hello @ps8moduly.cz,

many thanks for this BUT it didn't work for me.

I entered the code in the correct places but when I tested, the messages were sent without error/warning.

It should be the correct file as it matched yours and also as I made a typo and forgot a brace, it didn't work, until I corrected.

/modules/contactform/contactform.php

Any ideas?

Also, if anyone can point me to a maths question easy code guide for prestashop 1.7.6.7, I would be grateful. 

image.png.d3b8e36f32e8f723a3c0f20f41c77875.png

 

image.thumb.png.4fe60a4eb3378394f6a6e09adfa119c8.png

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...