function UpdateAllowedIPs($memberID, $allowedIPS) { global $smcFunc; // Check if there is an entry setup SetupLoginSecurityTable($memberID); $validIPs = array(); $allowedIPS = trim($allowedIPS); foreach (explode(",", $allowedIPS) as $ip) { if (preg_match('~^((([1]?\\d)?\\d|2[0-4]\\d|25[0-5])\\.){3}(([1]?\\d)?\\d|2[0-4]\\d|25[0-5])$~', $smcFunc['htmltrim']($ip)) !== 0) { $validIPs[] = $ip; } } $smcFunc['db_query']('', ' UPDATE {db_prefix}login_security SET allowedips = {string:allowedips} WHERE id_member = {int:current_member}', array('current_member' => $memberID, 'allowedips' => implode(',', $validIPs))); }
function UpdateAllowedIPs($memberID, $allowedIPS) { global $db_prefix; // Check if there is an entry setup SetupLoginSecurityTable($memberID); $validIPs = array(); $allowedIPS = trim($allowedIPS); foreach (explode(",", $allowedIPS) as $ip) { if (preg_match('~^((([1]?\\d)?\\d|2[0-4]\\d|25[0-5])\\.){3}(([1]?\\d)?\\d|2[0-4]\\d|25[0-5])$~', trim($ip)) !== 0) { $validIPs[] = $ip; } } db_query("\n\tUPDATE {$db_prefix}login_security \n\tSET allowedips = '" . implode(',', $validIPs) . "' \n\tWHERE ID_MEMBER = " . $memberID, __FILE__, __LINE__); }