本文整理匯總了PHP中IP::isInRanges方法的典型用法代碼示例。如果您正苦於以下問題:PHP IP::isInRanges方法的具體用法?PHP IP::isInRanges怎麽用?PHP IP::isInRanges使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IP
的用法示例。
在下文中一共展示了IP::isInRanges方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: time
# Validate entry, skip when it does not apply to our case
# 1) skip when it does not apply to our database name
if (isset($options['dbname']) && !in_array($wgDBname, (array) $options['dbname'])) {
continue;
}
# 2) skip expired entries
$inTimeWindow = time() >= strtotime($options['from']) && time() <= strtotime($options['to']);
if (!$inTimeWindow) {
continue;
}
# 3) skip when throttle does not apply to the client IP
$ip = $wgRequest->getIP();
if (isset($options['IP']) && !in_array($ip, (array) $options['IP'])) {
continue;
}
if (isset($options['range']) && !IP::isInRanges($ip, (array) $options['range'])) {
continue;
}
# Finally) set up the throttle value
global $wgAccountCreationThrottle, $wgRateLimits;
if (isset($options['value']) && is_numeric($options['value'])) {
$wgAccountCreationThrottle = $options['value'];
} else {
$wgAccountCreationThrottle = 50;
// Provide some sane default
}
$wgRateLimits['badcaptcha']['ip'] = array(1000, 86400);
$wgRateLimits['badcaptcha']['newbie'] = array(1000, 86400);
return;
# No point in proceeding to another entry
}