b3gund4L icon

blockerr

b3gund4L | PRO | 02/07/25 03:54:09 PM UTC | 0 ⭐ | 7047 👁️ | Never ⏰ | []
PHP |

1.09 KB

|

None

|

0 👍

/

0 👎

<?php
 
// Mendapatkan referer HTTP
$referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
 
// Domain yang ingin diblokir
$blocked_domain = 'https://search.google.com/search-console/remove-outdated-content?hl=en';
 
// Mengecek apakah referer mengandung domain yang diblokir
if (strpos($referrer, $blocked_domain) !== false) {
    header('HTTP/1.0 403 Forbidden');
    echo 'Access is blocked from this referrer.';
    exit();
}
 
function ip_in_range($ip, $range) {
    list($subnet, $bits) = explode('/', $range);
    $ip = ip2long($ip);
    $subnet = ip2long($subnet);
    $mask = -1 << (32 - $bits);
    return ($ip & $mask) == ($subnet & $mask);
}
 
$blocked_ranges = [
    '103.134.18.0/24',
    '103.134.19.0/24',
    '103.170.104.0/23',
    '103.18.117.0/24',
    '103.225.242.0/24',
    '103.8.238.0/24',
    '202.10.50.0/24',
    '202.10.51.0/24'
];
 
$user_ip = $_SERVER['REMOTE_ADDR'];
foreach ($blocked_ranges as $range) {
    if (ip_in_range($user_ip, $range)) {
        header('HTTP/1.1 403 Forbidden');
        die('Access Denied');
    }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎