function restrict_by_ip_user_profile_submit in Restrict Login or Role Access by IP Address 6.3
Same name and namespace in other branches
- 8.4 restrict_by_ip.module \restrict_by_ip_user_profile_submit()
- 7.3 restrict_by_ip.module \restrict_by_ip_user_profile_submit()
Custom submit function for the user_profile_form page.
1 string reference to 'restrict_by_ip_user_profile_submit'
- restrict_by_ip_form_alter in ./
restrict_by_ip.module - Implmentation of hook_form_alter().
File
- ./
restrict_by_ip.module, line 392 - 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_user_profile_submit($form, &$form_state) {
// Remove any existing restrictions
db_query("DELETE FROM {restrict_by_ip} WHERE uid=%d", $form['#uid']);
if (strlen($form_state['values']['restrict_by_ip_address']) > 0) {
// Add new restrictions
db_query("INSERT INTO {restrict_by_ip} (uid, restrict_by_ip_address) VALUES (%d, '%s')", $form['#uid'], $form_state['values']['restrict_by_ip_address']);
}
}