function system_ip_blocking_form_validate
1 string reference to 'system_ip_blocking_form_validate'
- system_ip_blocking_form in drupal-7.x/modules/system/system.admin.inc
- Define the form for blocking IP addresses.
Archivo
- drupal-7.x/modules/system/system.admin.inc, line 1429
- Admin page callbacks for the system module.
Código
function system_ip_blocking_form_validate($form, &$form_state) {
$ip = trim($form_state['values']['ip']);
if (db_query("SELECT * FROM {blocked_ips} WHERE ip = :ip", array(':ip' => $ip))->fetchField()) {
form_set_error('ip', t('This IP address is already blocked.'));
}
elseif ($ip == ip_address()) {
form_set_error('ip', t('You may not block your own IP address.'));
}
elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE) == FALSE) {
form_set_error('ip', t('Enter a valid IP address.'));
}
}