HTTP防盗链

<?php 

    if(isset($_SERVER['HTTP_REFERER'])) {
        //判断$_SERVER['HTTP_REFERER']是不是以http://localhost/http 开始
        if(strpos($_SERVER['HTTP_REFERER'],"http://localhost/http")==0) {
            echo "显示信息";
        }else {
            //跳转到警告页面
            header("Location:warning.php");
        }
    }else {
        header("Location:warning.php");
    }

?>

 

posted @ 2014-10-31 19:10  ayee  阅读(231)  评论(0编辑  收藏  举报