当前位置: 移动技术网 > IT编程>开发语言>PHP > 如何在PHP程序中防止盗链

如何在PHP程序中防止盗链

2019年05月12日  | 移动技术网IT编程  | 我要评论
example:    

页面: dl.php     
--------------------------------------------------------------------------------------     
复制代码 代码如下:

<?php      

$id = $_get['id'];      
$act = $_get['act'];      

switch($act) {      
default :      
case "display" : displayhtml(); break;      
case "down" : down(); break;      
}      

function displayhtml($id) {      
setcookie("visited", "true");      

// print your html.      
}      

function down($id) {      
if(! isset($_cookie['visited']) ) print "你盗联?";      

$sql = "select path from table where id=". $id;      
//..............................      
}      
?>      

<a href="dl.php?id=1&act=down">download now...</a>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网