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

    function 
community_banned($community_id=0)
    {
        if (
$GLOBALS['auth']['id'])
        {
            
$banned false;
            
            if (
$banned_user mysql_fetch_assoc(mysql_query('SELECT user_id FROM community_banned_users WHERE community_id="'.$community_id.'" AND user_id="'.$GLOBALS['auth']['id'].'"')))
                
$banned true;
            else if    (
$banned_user mysql_fetch_assoc(mysql_query('SELECT ip FROM community_banned_ips WHERE community_id="'.$community_id.'" AND ip="'.encode_ip($_SERVER['REMOTE_ADDR']).'"')))
                
$banned true;
            
            if (
$banned)
            {
                
show_error_page('You have been banned''You are not allowed to access this community');
                die;
            }
        }
    }


?>