噜噜哒
您可以使用“ HTTP HEADERS ”阻止代理 function shapeSpace_block_proxy_visits() { $headers = array('CLIENT_IP','FORWARDED','FORWARDED_FOR','FORWARDED_FOR_IP','VIA','X_FORWARDED','X_FORWARDED_FOR','HTTP_CLIENT_IP','HTTP_FORWARDED','HTTP_FORWARDED_FOR','HTTP_FORWARDED_FOR_IP','HTTP_PROXY_CONNECTION','HTTP_VIA','HTTP_X_FORWARDED','HTTP_X_FORWARDED_FOR'); foreach ($headers as $header){ if (isset($_SERVER[$header])) { die('Proxy access not allowed.'); } } }
POPMUISE
2 方法可以实现它。这些技术适用于任何支持 PHP 的站点,包括 WordPress、Drupal、Joomla 等1)通过端口扫描阻止代理访问function blockproxyvisits() {$ports = array(80,81,553,554,1080,3128,4480,6588,8000,8080);foreach ($ports as $port) { if (@fsockopen($_SERVER['REMOTE_ADDR'], $port, $errno, $errstr, 5)) { die('Proxy access not allowed.'); }} }2) 通过 HTTP 标头阻止代理访问function blockproxy_visits() {$headers = array('CLIENT_IP','FORWARDED','FORWARDED_FOR','FORWARDED_FOR_IP','VIA','X_FORWARDED','X_FORWARDED_FOR','HTTP_CLIENT_IP','HTTP_FORWARDED','HTTP_FORWARDED_FOR','HTTP_FORWARDED_FOR_IP','HTTP_PROXY_CONNECTION','HTTP_VIA','HTTP_X_FORWARDED','HTTP_X_FORWARDED_FOR');foreach ($headers as $header){ if (isset($_SERVER[$header])) { die('Proxy access not allowed.'); }} }这里的缺点是扫描开放端口比简单地检查 HTTP 标头需要更多的时间