prefix."accessqontrol` (`address`, `range`, `reason`, `redirect`, `thetime`, `duration`) VALUES ('$address', '$range', '$reason', '$redirect', '$thetime', '$duration')"; if ($wpdb->query($postquery) !== FALSE) { aqontrol_return('new'); } else { die(mysql_error()); } } else { aqontrol_return('error', array('reserved_address_forbidden')); } } else { aqontrol_return('error', array('not_all_required_fields')); } } /* ------------------------------------------------------------- Name: aqontrol_remove_expired Purpose: Removes expired bans Receive: -none- Return: -none- ------------------------------------------------------------- */ function aqontrol_remove_expired() { global $wpdb; $thetime = current_time('timestamp'); $old_bans = $wpdb->get_results("DELETE FROM `".$wpdb->prefix."accessqontrol` WHERE `duration` >= '$thetime'"); } /*------------------------------------------------------------- Name: aqontrol_request_action Purpose: Prepare action for ban management Receive: -none- Return: -none- -------------------------------------------------------------*/ function aqontrol_request_action() { global $wpdb, $userdata; if(isset($_POST['bancheck'])) $ban_ids = $_POST['bancheck']; $action = strtolower($_POST['aqontrol_action']); if(current_user_can('manage_options')) { if($ban_ids != '') { foreach($ban_ids as $ban_id) { if($action == 'delete') { if($wpdb->query("DELETE FROM `".$wpdb->prefix."accessqontrol` WHERE `id` = $ban_id") == FALSE) { die(mysql_error()); } } } } aqontrol_return($action, array($ban_id)); } else { aqontrol_return('no_access'); } } /*------------------------------------------------------------- Name: aqontrol_options_submit Purpose: Save options Receive: $_POST Return: -none- -------------------------------------------------------------*/ function aqontrol_options_submit() { $template['title'] = htmlspecialchars(trim($_POST['aqontrol_title'], "\t\n "), ENT_QUOTES); $template['content'] = htmlspecialchars(trim($_POST['aqontrol_content'], "\t\n "), ENT_QUOTES); update_option('aqontrol_template', $template); } /*------------------------------------------------------------- Name: aqontrol_access_submit Purpose: Save options Receive: $_POST Return: -none- -------------------------------------------------------------*/ function aqontrol_access_submit() { $access['allow'] = $_POST['aqontrol_allow']; $access['except'] = trim($_POST['aqontrol_except'], "\t\n "); update_option('aqontrol_access', $access); } ?>