mirror of
https://github.com/HaschekSolutions/pictshare.git
synced 2025-11-18 05:58:01 +00:00
updated cloudflare ips
This commit is contained in:
51
inc/core.php
51
inc/core.php
@@ -657,30 +657,35 @@ function ip_in_range($ip, $range) {
|
|||||||
return (($ip_decimal & $netmask_decimal) == ($range_decimal & $netmask_decimal));
|
return (($ip_decimal & $netmask_decimal) == ($range_decimal & $netmask_decimal));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// from https://www.cloudflare.com/ips-v4
|
||||||
|
// and https://www.cloudflare.com/ips-v6
|
||||||
function _cloudflare_CheckIP($ip) {
|
function _cloudflare_CheckIP($ip) {
|
||||||
$cf_ips = array(
|
$cf_ips = array_filter(array_map('trim',explode("\n","
|
||||||
'173.245.48.0/20',
|
2400:cb00::/32
|
||||||
'103.21.244.0/22',
|
2606:4700::/32
|
||||||
'103.22.200.0/22',
|
2803:f800::/32
|
||||||
'103.31.4.0/22',
|
2405:b500::/32
|
||||||
'141.101.64.0/18',
|
2405:8100::/32
|
||||||
'108.162.192.0/18',
|
2a06:98c0::/29
|
||||||
'190.93.240.0/20',
|
2c0f:f248::/32
|
||||||
'188.114.96.0/20',
|
173.245.48.0/20
|
||||||
'197.234.240.0/22',
|
103.21.244.0/22
|
||||||
'198.41.128.0/17',
|
103.22.200.0/22
|
||||||
'162.158.0.0/15',
|
103.31.4.0/22
|
||||||
'104.16.0.0/12',
|
141.101.64.0/18
|
||||||
'172.64.0.0/13',
|
108.162.192.0/18
|
||||||
'131.0.72.0/22',
|
190.93.240.0/20
|
||||||
'2400:cb00::/32',
|
188.114.96.0/20
|
||||||
'2606:4700::/32',
|
197.234.240.0/22
|
||||||
'2803:f800::/32',
|
198.41.128.0/17
|
||||||
'2405:b500::/32',
|
162.158.0.0/15
|
||||||
'2405:8100::/32',
|
104.16.0.0/13
|
||||||
'2a06:98c0::/29',
|
104.24.0.0/14
|
||||||
'2c0f:f248::/32'
|
172.64.0.0/13
|
||||||
);
|
131.0.72.0/22
|
||||||
|
")));
|
||||||
|
|
||||||
$is_cf_ip = false;
|
$is_cf_ip = false;
|
||||||
foreach ($cf_ips as $cf_ip) {
|
foreach ($cf_ips as $cf_ip) {
|
||||||
if (ip_in_range($ip, $cf_ip)) {
|
if (ip_in_range($ip, $cf_ip)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user