function CheckNet($networks, $ip = '') {
        //use client IP as default if $ip parameter omitted (see BL_Safe for more explanations)
        if (empty($ip)) {
            $ip = ($this->BL_Safe) ? $this->IP['proxy'] : $this->IP['client'];
        }
        if (!$this->isValid($ip)) {
            return false;
        }
        $ipl = ip2long(trim($ip));
        //if ($ipl===false) $ipl=-1;//ip2long returns FALSE for 255.255.255.255, convert it to its real value -1 (only PHP 5.0.0 < 5.0.3)
        $ips = (is_array($networks)) ? $networks : preg_split('/[\s,]+/', $networks);
        foreach ($ips as $value) {
            if (preg_match('/^' . $this->ipp . '(\/\d|\/' . $this->ipp . ')?/', $value)) {
                $ipa = explode('/', $value);
                if (count($ipa) < 2) {
                    $ipa[1] = ''; //prevent notice level error (I've added this line for some users reported notice level errors)
                }
                $net = ip2long($ipa[0]);
                //if ($net===false) $net=-1;
                $x = ip2long($ipa[1]);
                //if ($x===false) $x=-1;
                $mask = long2ip($x) == $ipa[1] ? $x : 0xffffffff << (32 - $ipa[1]);
                if (($ipl & $mask) == ($net & $mask)) {
                    return true;
                }
            }
        }
        return false;
    }