Home >Backend Development >PHP Problem >How to disable proxy access in php

How to disable proxy access in php

藏色散人
藏色散人Original
2020-08-11 09:50:463868browse

php method to prohibit proxy access: first open the corresponding script file; then pass "if($_SERVER['HTTP_PROXY_CONNECTION'] || $_SERVER['HTTP_VIA']...){...} ” method can be used to prohibit proxy access.

How to disable proxy access in php

Recommended: "PHP Video Tutorial"

PHP prohibits proxy access

if($_SERVER['HTTP_PROXY_CONNECTION'] || $_SERVER['HTTP_VIA'] || $_SERVER['HTTP_USER_AGENT_VIA'] || $_SERVER['HTTP_X_FORWARDED_FOR'] || $_SERVER['HTTP_PROXY_CONNECTION'] || $_SERVER['HTTP_CACHE_CONTROL'] || $_SERVER['HTTP_CACHE_INFO']) {
        die("请勿使用代理服务器访问, 谢谢");
}

or

PHP prohibits proxy access

<?php
if(empty($_SERVER[&#39;HTTP_VIA&#39;]) and empty($_SERVER[&#39;HTTP_X_FORWARDED_FOR&#39;]) and empty($_SERVER[&#39;HTTP_XROXY_CONNECTION&#39;]) and empty($_SERVER[&#39;HTTP_PRAGMA&#39;]) ){
// 没有使用代理
}else{
exit(&#39;<meta charset="utf-8" />禁止使用代理访问&#39;);
}

The above is the detailed content of How to disable proxy access in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn