= $range_start && $ip <= $range_end) { return true; } return false; } ### Function: Check Whether Or Not The Hostname Belongs To Admin function is_admin_hostname($check) { $admin_hostname = @gethostbyaddr(get_IP()); $regexp = str_replace ('.', '\\.', $check); $regexp = str_replace ('*', '.+', $regexp); if(ereg("^$regexp$", $admin_hostname)) { return true; } return false; } ### Function: Check Whether Or Not The Referer Belongs To This Site function is_admin_referer($check) { $regexp = str_replace ('.', '\\.', $check); $regexp = str_replace ('*', '.+', $regexp); $url_patterns = array(get_option('siteurl'), get_option('home'), get_option('siteurl').'/', get_option('home').'/', get_option('siteurl').'/ ', get_option('home').'/ ', $_SERVER['HTTP_REFERER']); foreach($url_patterns as $url) { if(ereg("^$regexp$", $url)) { return true; } } return false; } ### Function: Create Ban Options add_action('activate_ban/ban.php', 'ban_init'); function ban_init() { global $wpdb; $banned_ips = array(); $banned_ips_range = array(); $banned_hosts = array(); $banned_referers = array(); $banned_exclude_ips = array(); $banned_stats = array('users' => array(), 'count' => 0); add_option('banned_ips', $banned_ips, 'Banned IPs'); add_option('banned_hosts', $banned_hosts, 'Banned Hosts'); add_option('banned_stats', $banned_stats, 'WP-Ban Stats'); add_option('banned_message', ''."\n". ''."\n". ''."\n". ''."\n". '%SITE_NAME% - %SITE_URL%'."\n". ''."\n". ''."\n". '

'.__('You Are Banned.', 'wp-ban').'

'."\n". ''."\n". '', 'Banned Message'); // Database Upgrade For WP-Ban 1.11 add_option('banned_referers', $banned_referers, 'Banned Referers'); add_option('banned_exclude_ips', $banned_exclude_ips, 'Banned Exclude IP'); add_option('banned_ips_range', $banned_ips_range, 'Banned IP Range'); } ?>