Home  >  Article  >  Backend Development  >  PHP user verification PHP simple anti-hotlink verification implementation method original

PHP user verification PHP simple anti-hotlink verification implementation method original

WBOY
WBOYOriginal
2016-07-28 08:27:23872browse

Here is an analysis of the simple anti-hotlink implementation method of PHP. Share it with everyone for your reference. The details are as follows: The

index.php page is as follows:

<html>
<head>
<meta http-equiv="Content-Language" c />
<meta name="GENERATOR" c />
<meta http-equiv="Content-Type" c />
<title>防盗链</title>
</head>
<body>
 <form action="check.php" method="post">
 提交信息:<input type="text" name="name" value=""/>
 <input type="submit" name="submit" value="提交"/>
 </form>
</body>
</html>

check.php page is as follows:

$urlar=parse_url($_SERVER['HTTP_REFERER']);
 print("<pre class="brush:php;toolbar:false">");
 print_r($urlar);
 print_r($_SERVER['HTTP_REFERER']);
 if($urlar['host']!="localhost"){//此处可替换成当前使用的域名
 echo "验证错误!";
 echo "<script>alert('连接失败');location.href='index.php';</script>";
 exit;
 }
 print("
");

I hope this article will be helpful to everyone in php programming design.

The above introduces the PHP user verification and PHP simple anti-hotlink verification implementation method. Original, including the content of PHP user verification. I hope it will be helpful to friends who are interested in PHP tutorials.

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