protected static function checkBotIPv4($UserIP = false, $Bot_IPv4_List = false)
    {
        if (false === $Bot_IPv4_List) 
        {
        	return false;
        }
        // Check if IP present
        if ($UserIP === false)
        {
            if (\Environment::get('remoteAddr'))
            {
                if (strpos(\Environment::get('remoteAddr'), ',') !== false) //first IP
                {
                    $UserIP =  trim(substr(\Environment::get('remoteAddr'), 0, strpos(\Environment::get('remoteAddr'), ',')));
                }
                else
                {
                    $UserIP = trim(\Environment::get('remoteAddr'));
                }
            }
            else
            {
                return false; // No IP, no search.
            }
        }
        // search user IP in bot-ip-list
        if (file_exists($Bot_IPv4_List))
        {
            $source = file($Bot_IPv4_List);
            foreach ($source as $line)
            {
                if ($line[0] === '#')
                {
                    continue;
                }
                $lineleft = explode("#", $line); // Abtrennen Netzwerk/Mask von Bemerkung
                $network = explode("/", trim($lineleft[0]));
                if (!isset($network[1]))
                {
                    $network[1] = 32;
                }
                if (static::checkIp4InNetwork($UserIP,$network[0],$network[1]))
                {
                    return true; // IP found
                }
            }
        }
        // search for user bot IP-filter definitions in localconfig.php
        if ( isset($GLOBALS['BOTDETECTION']['BOT_IP']) )
        {
            foreach ($GLOBALS['BOTDETECTION']['BOT_IP'] as $lineleft)
            {
                $network = explode("/", trim($lineleft));
                if (!isset($network[1]))
                {
                    $network[1] = 32;
                }
                if (static::checkIp4InNetwork($UserIP,$network[0],$network[1]))
                {
                    return true; // IP found
                }
            }
        }
        return false;
    }
protected static function checkBotIPv4($UserIP = false, $Bot_IPv4_List = false)
    {
        if (false === $Bot_IPv4_List) 
        {
        	return false;
        }
        // Check if IP present
        if ($UserIP === false)
        {
            if (\Environment::get('remoteAddr'))
            {
                if (strpos(\Environment::get('remoteAddr'), ',') !== false) //first IP
                {
                    $UserIP =  trim(substr(\Environment::get('remoteAddr'), 0, strpos(\Environment::get('remoteAddr'), ',')));
                }
                else
                {
                    $UserIP = trim(\Environment::get('remoteAddr'));
                }
            }
            else
            {
                return false; // No IP, no search.
            }
        }
        // search user IP in bot-ip-list
        if (file_exists($Bot_IPv4_List))
        {
            $source = file($Bot_IPv4_List);
            foreach ($source as $line)
            {
                if ($line[0] === '#')
                {
                    continue;
                }
                $lineleft = explode("#", $line); // Abtrennen Netzwerk/Mask von Bemerkung
                $network = explode("/", trim($lineleft[0]));
                if (!isset($network[1]))
                {
                    $network[1] = 32;
                }
                if (static::checkIp4InNetwork($UserIP,$network[0],$network[1]))
                {
                    return true; // IP found
                }
            }
        }
        // search for user bot IP-filter definitions in localconfig.php
        if ( isset($GLOBALS['BOTDETECTION']['BOT_IP']) )
        {
            foreach ($GLOBALS['BOTDETECTION']['BOT_IP'] as $lineleft)
            {
                $network = explode("/", trim($lineleft));
                if (!isset($network[1]))
                {
                    $network[1] = 32;
                }
                if (static::checkIp4InNetwork($UserIP,$network[0],$network[1]))
                {
                    return true; // IP found
                }
            }
        }
        return false;
    }
protected static function checkBotIPv4 ( $ UserIP = false , $ Bot_IPv4_List = false ) { if ( false === $ Bot_IPv4_List ) { return false ; } // Check if IP present if ( $ UserIP === false ) { if ( \ Environment :: get ( 'remoteAddr' ) ) { if ( strpos ( \ Environment :: get ( 'remoteAddr' ) , ',' ) !== false ) //first IP { $ UserIP = trim ( substr ( \ Environment :: get ( 'remoteAddr' ) , 0 , strpos ( \ Environment :: get ( 'remoteAddr' ) , ',' ) ) ) ; } else { $ UserIP = trim ( \ Environment :: get ( 'remoteAddr' ) ) ; } } else { return false ; // No IP, no search. } } // search user IP in bot-ip-list if ( file_exists ( $ Bot_IPv4_List ) ) { $ source = file ( $ Bot_IPv4_List ) ; foreach ( $ source as $ line ) { if ( $ line [ 0 ] === '#' ) { continue ; } $ lineleft = explode ( "#" , $ line ) ; // Abtrennen Netzwerk/Mask von Bemerkung $ network = explode ( "/" , trim ( $ lineleft [ 0 ] ) ) ; if ( ! isset ( $ network [ 1 ] ) ) { $ network [ 1 ] = 32 ; } if ( static :: checkIp4InNetwork ( $ UserIP , $ network [ 0 ] , $ network [ 1 ] ) ) { return true ; // IP found } } } // search for user bot IP-filter definitions in localconfig.php if ( isset ( $ GLOBALS [ 'BOTDETECTION' ] [ 'BOT_IP' ] ) ) { foreach ( $ GLOBALS [ 'BOTDETECTION' ] [ 'BOT_IP' ] as $ lineleft ) { $ network = explode ( "/" , trim ( $ lineleft ) ) ; if ( ! isset ( $ network [ 1 ] ) ) { $ network [ 1 ] = 32 ; } if ( static :: checkIp4InNetwork ( $ UserIP , $ network [ 0 ] , $ network [ 1 ] ) ) { return true ; // IP found } } } return false ; }
Spider Bot IP Check for IPv4

@param string   User IP, optional for tests
@return boolean true when bot found over IP
@param string $Bot_IPv4_List   Bot IPv6 List, absolute Path+Filename including TL_ROOT
@access protected
Spider Bot IP Check for IPv4