<?
    
require_once('include/functions/ip_encode.php');

    
$_id = isset($_GET['i']) ? intval($_GET['i']) : 0;
    
$_ip = isset($_POST['ip']) ? encode_ip(trim(strval($_POST['ip']))) : '';

    if (
language() == 'french')
    {
        
define('ACTION_COMMUNITY_ADMIN_NOT_FOUND_COMMUNITY''Sorry, but this community does not exist.');
        
define('ACTION_COMMUNITY_ADMIN_NOT_FOUND_PERMISSION''Sorry, you don\'t have permission to modify this community.');
    }
    else
    {
        
define('ACTION_COMMUNITY_ADMIN_NOT_FOUND_COMMUNITY''Sorry, but this community does not exist.');
        
define('ACTION_COMMUNITY_ADMIN_NOT_FOUND_PERMISSION''Sorry, you don\'t have permission to modify this community.');
    }
    
    
$community mysql_query("SELECT * FROM community WHERE community_id = " sq($_id));
    if (!
$community_row mysql_fetch_assoc($community))
    {
        
make_cookie('notice'ACTION_COMMUNITY_ADMIN_NOT_FOUND_COMMUNITY);
        
header('Location: ./?s=community_create');
        die;
    }
    
    require_once(
'include/functions/community_permissions.php');
    
community_permissions($community_row['community_id']);
    
    if (!
$GLOBALS['auth']['community']['administration_ban_ip'])
    {
        
make_cookie('notice'ACTION_COMMUNITY_ADMIN_NOT_FOUND_PERMISSION);
        
header('Location: ./?s=community_modify&i=' $community_row['community_id']);
        die;
    }

    
mysql_query("REPLACE INTO community_banned_ips SET community_id = '" $community_row['community_id'] . "', ip = '" $_ip "'");

    
header('Location: ./?s=community_modify&i=' $community_row['community_id']);
    die;
?>