We're trying to block a bunch of spammers that are submitting forms, they all put the same subject in the subject field of the form "Google". I've been trying to figure out how to validate the field so that the form only goes through if subject is not "Google".. and I can't figure out how to do it. Any hints?
Thanks
Lydia
Thanks
Lydia
Hi Lydia,
Try a Custom Serverside Validation action with code like this in it:
This should redirect the spammer away from your site.
Bob
Try a Custom Serverside Validation action with code like this in it:
<?php
if ( isset($form->data['subject']) && strpos(strtolower($form->data['subject']), 'google') ) {
$mainframe =& JFactory::getApplication();
$mainframe->redirect('http://www.ic3.gov/complaint/default.aspx');
return false;
}
?>
!! Not tested and may need debugging !!This should redirect the spammer away from your site.
Bob
Thanks, but I've got to be missing something...
I changed it to my field names (ie. company, instead of subject)
and placed the code in the Custom Server Side Validation and put it in the On submit area (I've tried it before and after check captcha), and it's not working.
Did I forget something, or does it need to be in a different spot?
Thanks,
Lydia
I changed it to my field names (ie. company, instead of subject)
<?php
if ( isset($form->data['company']) && strpos(strtolower($form->data['company']), 'google') ) {
$mainframe =& JFactory::getApplication();
$mainframe->redirect('http://www.ic3.gov/complaint/default.aspx');
return false;
}
?>
and placed the code in the Custom Server Side Validation and put it in the On submit area (I've tried it before and after check captcha), and it's not working.
Did I forget something, or does it need to be in a different spot?
Thanks,
Lydia
This topic is locked and no more replies can be posted.