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

How to disable proxy access in php

藏色散人
Release: 2023-03-04 09:10:01
Original
3929 people have browsed it

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("请勿使用代理服务器访问, 谢谢");
}
Copy after login

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;);
}
Copy after login

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!

Related labels:
php
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template