function system_ban_ip_settings_form_validate

7.x system.module system_ban_ip_settings_form_validate($form, &$form_state)

File

modules/system/system.module, line 734

Code

function system_ban_ip_settings_form_validate($form, &$form_state) {

  // Make sure our ban_ips.info file exists!

  $p = $form_state ['values']['ban_ip_file_path'];

  if (!file_exists($p)) {
    $res = file_put_contents($p, "");
    if ($res === FALSE) {
      form_error('', t("Unable to create ban ip file: %p. Make sure the directory is writable by the web server. This 
                        file must be in place before making changes to Apache.", array('%p' => $p)));
    }
  }

  $manual_ip = $form_state ['values']['system_manually_add_ip'] '';
  if ($manual_ip != '' && !filter_var($manual_ip, FILTER_VALIDATE_IP)) {
    form_error('system_manually_add_ip', t('Sorry, the IP address you entered does not appear to be valid. Please try again.'));
  }


}