You are here

function captcha_point_admin_form_submit in CAPTCHA 5.3

Same name and namespace in other branches
  1. 6.2 captcha.admin.inc \captcha_point_admin_form_submit()
  2. 6 captcha.admin.inc \captcha_point_admin_form_submit()
  3. 7 captcha.admin.inc \captcha_point_admin_form_submit()

submit function for captcha_point_admin_form

File

./captcha.module, line 393
This module enables basic CAPTCHA functionality: administrators can add a CAPTCHA to desired forms that users without the 'skip CAPTCHA' permission (typically anonymous visitors) have to solve.

Code

function captcha_point_admin_form_submit($form, $form_values) {
  $captcha_point_form_id = $form_values['captcha_point_form_id'];
  $captcha_type = $form_values['captcha_type'];

  // remove old settings
  db_query("DELETE FROM {captcha_points} WHERE form_id = '%s'", $captcha_point_form_id);

  // save new settings
  if ($captcha_type == 'none') {
    db_query("INSERT INTO {captcha_points} (form_id, module, type) VALUES ('%s', NULL, NULL)", $captcha_point_form_id);
  }
  else {
    list($module, $type) = explode('/', $captcha_type);
    db_query("INSERT INTO {captcha_points} (form_id, module, type) VALUES ('%s', '%s', '%s')", $captcha_point_form_id, $module, $type);
  }
  drupal_set_message(t('Saved CAPTCHA point settings.'), 'status');
}