You are here

function restrict_by_ip_role_settings_validate in Restrict Login or Role Access by IP Address 7.3

Same name and namespace in other branches
  1. 6.3 restrict_by_ip.module \restrict_by_ip_role_settings_validate()

Validation function for role ip restriction settings

File

./restrict_by_ip.module, line 353
Allows the admin to select which ip addresses role or a user can login from for this site Some of the code below is taken from the cck_ipaddress_module

Code

function restrict_by_ip_role_settings_validate($form, &$form_state) {
  foreach ($form_state['values'] as $key => $value) {
    if (strpos($key, 'restrict_by_ip_role_') !== FALSE && strlen($value) > 0) {
      $ret = _restrict_by_ip_validate_ip($value);
      if ($ret['result'] == FALSE) {
        form_set_error($key, t(implode('<br />', $ret['messages'])));
      }
    }
  }
}