示例#1
0
/**
 * Matches for IPv4 or IPv6 addresses
 *
 * @param string $testRange string of IP range to match
 * @param string $ipToTest  string of IP to test against range
 *
 * @return boolean    whether the IP mask matches
 *
 * @access  public
 */
function PMA_ipMaskTest($testRange, $ipToTest)
{
    if (mb_strpos($testRange, ':') > -1 || mb_strpos($ipToTest, ':') > -1) {
        // assume IPv6
        $result = PMA_ipv6MaskTest($testRange, $ipToTest);
    } else {
        $result = PMA_ipv4MaskTest($testRange, $ipToTest);
    }
    return $result;
}
/**
 * Matches for IPv4 or IPv6 addresses
 *
 * @param string $testRange string of IP range to match
 * @param string $ipToTest  string of IP to test against range
 *
 * @return boolean    whether the IP mask matches
 *
 * @access  public
 */
function PMA_ipMaskTest($testRange, $ipToTest)
{
    /** @var PMA_String $pmaString */
    $pmaString = $GLOBALS['PMA_String'];
    if ($pmaString->strpos($testRange, ':') > -1 || $pmaString->strpos($ipToTest, ':') > -1) {
        // assume IPv6
        $result = PMA_ipv6MaskTest($testRange, $ipToTest);
    } else {
        $result = PMA_ipv4MaskTest($testRange, $ipToTest);
    }
    return $result;
}