php簡單防盜鏈驗(yàn)證實(shí)現(xiàn)方法
來源:易賢網(wǎng) 閱讀:1112 次 日期:2016-08-15 14:48:44
溫馨提示:易賢網(wǎng)小編為您整理了“php簡單防盜鏈驗(yàn)證實(shí)現(xiàn)方法”,方便廣大網(wǎng)友查閱!

這里分析了php的簡單防盜鏈實(shí)現(xiàn)方法。分享飛大家供大家參考。具體如下:

index.php頁面如下:

<html>

<head>

<meta http-equiv="Content-Language" content="en" />

<meta name="GENERATOR" content="PHPEclipse 1.0" />

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<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頁面如下:

$urlar=parse_url($_SERVER['HTTP_REFERER']);

 print("<pre>");

 print_r($urlar);

 print_r($_SERVER['HTTP_REFERER']);

 if($urlar['host']!="localhost"){//此處可替換成當(dāng)前使用的域名

 echo "驗(yàn)證錯(cuò)誤!";

 echo "<script>alert('連接失敗');location.href='index.php';</script>";

 exit;

 }

 print("</pre>");

 希望本文所述對(duì)大家php程序設(shè)計(jì)有所幫助。

更多信息請(qǐng)查看網(wǎng)絡(luò)編程
易賢網(wǎng)手機(jī)網(wǎng)站地址:php簡單防盜鏈驗(yàn)證實(shí)現(xiàn)方法
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn)

版權(quán)所有:易賢網(wǎng)