Support Forum

Ban plugin: implode warnings when I try to add an Ipaddress to add ip ban.

RB rb22
rb22
Member

Hi,

The following warning messages show when run the ban plugin and try to add an ip address. The Ip address does not get added.
I am trying this on wp s 3.4.1.  simpl-press 5.1.3  … and also on recent versions of wp and simplepress..

centos/cpanel

php 5.2.17

========

Add IP Ban
Warning: Implode() [function.implode]: Invalid arguments passed in …/wp-content/sp-resources/forum-plugins/ban/admin/sp-ban-admin.php on line 39

Add Ip Ban range.
Warning: implode() [function.implode]: Invalid arguments passed in …/public_html/wp-content/sp-resources/forum-plugins/ban/admin/sp-ban-admin.php on line 47

Add Hostname Ban
Warning: implode() [function.implode]: Invalid arguments passed in …/public_html/wp-content/sp-resources/forum-plugins/ban/admin/sp-ban-admin.php on line 57

Add User Agent Ban
Warning: implode() [function.implode]: Invalid arguments passed in …/public_html/wp-content/sp-resources/forum-plugins/ban/admin/sp-ban-admin.php on line 65
24.36.78.

2 Answers

New Answer

RB rb22
rb22
Member

Also seeing this when wp loads … prints out over the header.

 

Warning: Invalid argument supplied for foreach() in …/wp-content/sp-resources/forum-plugins/ban/library/sp-ban-components.php on line 35

Warning: Invalid argument supplied for foreach() in …/wp-content/sp-resources/forum-plugins/ban/library/sp-ban-components.php on line 49

Warning: Invalid argument supplied for foreach() in …/public_html/wp-content/sp-resources/forum-plugins/ban/library/sp-ban-components.php on line 35

Warning: Invalid argument supplied for foreach() in …/public_html/wp-content/sp-resources/forum-plugins/ban/library/sp-ban-components.php on line 35

MP Mr Papa
Mr Papa
Member

Yes, a known issue for a handful of servers in current version… we posted a fix for it in these forums, but cant seem to find it…  we cant release a new version of the plugin because other changes that required SP 5.3…

so quicker just to post the changes here again…  find the sp-ban-admin-save.php file and replace the sp_ban_admin_do_save_bans() function with the replacement one…

function sp_ban_admin_do_save_bans() {
    $ips = explode("n", trim($_POST['ip_addr']));
    sp_update_option('banned_ips', sp_esc_str($ips));

    $ip_ranges = explode("n", trim($_POST['ip_addr_range']));
    sp_update_option('banned_ip_ranges', sp_esc_str($ip_ranges));

    $hostnames = explode("n", trim($_POST['hostname']));
    sp_update_option('banned_hostnames', sp_esc_str($hostnames));

    $user_agents = explode("n", trim($_POST['user_agent']));
    sp_update_option('banned_agents', sp_esc_str($user_agents));

    return __('Bans updated', 'sp-ban');
}

not sure why it only affects a handful of users (you are second) while most use just fine…