Board logo

标题: 如何在PHP程序中防止盗链 [打印本页]

作者: php    时间: 2007-7-28 23:02     标题: 如何在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>





欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/) Powered by Discuz! 6.0.0