Skip to main content
higgsyd
Inspiring
December 3, 2018
Question

what errors have I made implementing osgood's antispam code

  • December 3, 2018
  • 3 replies
  • 1105 views

Our Mr Osgood kindly provided some code which I have added to my contact page but spam keeps arriving, usually one or two emails each day.  It attempts to defeat the spammer by requiring an answer to the calculation:  3 x 4 to be entered.  Could he or one of his esteemed colleagues take a look at the code please?  The page is at http://ancestry.higgsy.co.uk/contact5.php

This topic has been closed for replies.

3 replies

Nancy OShea
Community Expert
Community Expert
December 3, 2018

We would need to see the PHP code.  Maybe there's nothing wrong with your code.     Math problems will only defeat spambots.  It won't stop human spammers.   Unless you block their IP address at the server level, nothing will stop human spam.

Nancy O'Shea— Product User & Community Expert
higgsyd
higgsydAuthor
Inspiring
December 4, 2018

Thanks everybody.  I think Wolfshade's comment about putting my jquery call in the wrong place needs to be corrected before any further debugging need take place.   So I have moved the jquery call to appear before the validation.js  and I'll wait a few days and see if that fixes it.  BTW Nancy, are you suggesting some poor soul is sitting each day filling in my contact form manually?  I find it hard to believe but, hey, what do I know? :-) Thanks again. 

WolfShade
Legend
December 3, 2018

Part of the problem is that you're using client-side (Javascript) validation that requires jQuery, but you're loading jQuery AFTER the validation.js file.

I sincerely hope you're also using server-side PHP validation.  Using JS alone is a very bad idea.

HTH,

^ _ ^

Legend
December 4, 2018

WolfShade  wrote

Part of the problem is that you're using client-side (Javascript) validation that requires jQuery, but you're loading jQuery AFTER the validation.js file.

I sincerely hope you're also using server-side PHP validation.  Using JS alone is a very bad idea.

HTH,

^ _ ^

I would assume whatever it is that I supplied is in the php file because I dont see any client side validation for the spam form field.

WolfShade
Legend
December 4, 2018

I clicked the link to his site, did a View Source, and noticed that there is a "validation.js" file loading before jQuery.  I looked at the .js file source, and the client-side form validation is in there, using jQuery selectors for the form elements.

It may not be the only thing that's not properly working, but moving the jQuery load before the .js file should be a huge improvement. 

V/r,

^ _ ^

pziecina
Legend
December 3, 2018

As Osgoods code is probably in php we will be unable to view it, as php code is applied on the server, not in the browser.

Osgood may look in on the forum, so patience is necessary.