How to create easy antibot registration module for Drupal 7

Any project should be protected from automatic registration, One of wellknown solutions is using CAPTCHA.  There are a lot of kinds of CAPTCHA and most part of them were designed for very big projects wich could be affected by directed spam attack of competitors or other "enthusiasts". On simple sites which are not as famous as facebook or twitter we don't need such difficult protection. 

As I've noticed simple bots are devided into some groups: first of them simply fill all fields with some content (without any fields analysis), second most common group fill only required fields and make some field analysis (if we have phone field the bot will put numbers (1234567)). Spam is very bad but why our users should suffer against it. we can easily simplify user registering process with almost 100% protection from robots. How we can do it? 

1) We can insert hidden field to user register form (if you want you can add css rule to input id, it would be better, because it would be almost impossible to find out that field is invisible.)

$form['phone'] = array(
      '#type' => 'textfield',
      '#title' => 'Phone',
      '#prefix' => '<div style="display:none;">',
      '#suffix' => '</div>',
    );

2) Then as second step is creating field with checkbox and description "check me if you are not a bot!"

And all together

function yourmodule_form_alter(&$form, &$form_state, $form_id){
if ($form_id == 'user_register_form') {

    //here we add blank field for bot excluding
    $form['bot_check'] = array(
      '#type' => 'checkbox',
      '#title' => t('I am not a robot.'),
    );
    $form['phone'] = array(
      '#type' => 'textfield',
      '#title' => 'Phone',
    );
    $form['#validate'][] = 'yourmodule_forms_register_validate';
  }                                                                                                                                                                        }
/**
 * Submit callback function for user register form
 */
function yourmodule_forms_register_validate(&$form, &$form_state) {
  if (!empty($form_state['values']['phone'])) {
    form_set_error('phone', t('Sorry, but you are bot!'));
  }                                                                                                                                                                         if(empty($form_state['values']['bot_check'])){ form_set_error('bot_check', t('Sorry, but you are bot!')); } }
Rating: 
10 out of 10 based on 3 ratings.