예제 #1
0
/**
 * Performs a check if an IPv4 is banned
 * 
 * NOTE: This function does not support IPv6
 *
 * @param   string  IP
 * @return  boolean
 * @since   2003-06-06
 * @access  public
 * @author  Thorsten Rinne <*****@*****.**>
 */
function IPCheck($ip)
{
    if (strstr($ip, '::')) {
        // currently we cannot handle IPv6
        return true;
    }
    $listBannedIPs = PMF_Configuration::getInstance()->get('main.bannedIPs');
    $bannedIPs = explode(' ', $listBannedIPs);
    foreach ($bannedIPs as $oneIPorNetwork) {
        if (checkForAddrMatchIpv4($ip, $oneIPorNetwork)) {
            return false;
        }
    }
    return true;
}
예제 #2
0
파일: functions.php 프로젝트: noon/phpMyFAQ
/**
 * Performs a check if an IPv4 is banned
 * 
 * NOTE: This function does not support IPv6
 *
 * @param   string  IP
 * @return  boolean
 * @since   2003-06-06
 * @access  public
 * @author  Thorsten Rinne <*****@*****.**>
 */
function IPCheck($ip)
{
    $faqconfig = PMF_Configuration::getInstance();
    $bannedIPs = explode(' ', $faqconfig->get('main.bannedIPs'));
    foreach ($bannedIPs as $oneIPorNetwork) {
        if (checkForAddrMatchIpv4($ip, $oneIPorNetwork)) {
            return false;
        }
    }
    return true;
}