function restrict_by_ip_login_add_edit_user_submit in Restrict Login or Role Access by IP Address 6.3
Same name and namespace in other branches
- 7.3 restrict_by_ip.module \restrict_by_ip_login_add_edit_user_submit()
Submit function for add/edit new login IP restriction form.
File
- ./
restrict_by_ip.module, line 305 - 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_login_add_edit_user_submit($form, &$form_state) {
$uid = db_result(db_query("SELECT uid FROM {users} WHERE name='%s'", $form_state['values']['name']));
// Remove any existing settings
db_query("DELETE FROM {restrict_by_ip} WHERE uid=%d", $uid);
// Insert new settings
if (strlen($form_state['values']['restriction']) > 0) {
db_query("INSERT INTO {restrict_by_ip} (uid, restrict_by_ip_address) VALUES (%d, '%s')", $uid, $form_state['values']['restriction']);
}
drupal_set_message("User restriction has been saved.");
}