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.
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['HTTP_VIA']) and empty($_SERVER['HTTP_X_FORWARDED_FOR']) and empty($_SERVER['HTTP_XROXY_CONNECTION']) and empty($_SERVER['HTTP_PRAGMA']) ){ // 没有使用代理 }else{ exit('<meta charset="utf-8" />禁止使用代理访问'); }
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!