0

I am having a lot of spam signups on a drupal site. I am even using captcha and mollum, but still getting a lot. I have a field that asks 'why are you signing up?' which, when a human user / non-signup signs up, is filled with proper information, however, it seems there are a lot of robots / fake sign ups that all fill the field with a value which is just the literal path to the node field value like why_are_you_Signing_up[und][0][value]. It is always the same. So I thought I could check for this value and cancel the sign up. I have looked at hook_user_presave and hook_save. These look like good starting points.

1
  • 1
    As an aside, have you seen the Spambot module? It "protects the user registration form from spammers and spambots by verifying registration attempts against the Stop Forum Spam (www.stopforumspam.com) online database. ". Just another tool for the arsenal
    – Clive
    Jan 3, 2013 at 17:44

1 Answer 1

0

hope I'm not stating the obvious but if your form resides in a template or module you can add server-side validation to the form values using a function like:

function your_form_validate($form, &$form_state) {
  if ($form_state['values']['your_form_field_name']) {
    // Perform PHP validation, and return FALSE if rejected.
  }
}

Also, see Form generation.

1
  • 1
    For system forms like user_register_form you would need to use hook_form_alter to add your own validation function in #validate array of the form.
    – Beebee
    Jan 4, 2013 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.