
dedecms 软件下载频道怎样防盗链?
因网站改版,之前的很多多少网站都是链接到咱们的内页。招致达没有到用户体验,也避免一些盗链咱们资本的网站。
保举学习:织梦cms
dede做软件站有的缺陷
就是他人转帖你的下载的时分间接转帖http://www.xxx.com/plus/download.php.........
就是间接关上下载地点列表页这类就能够下载了,消耗资本却又带没有了用户。
通过钻研,终于搞定了软件频道下载的防盗链,代码收回来各人同享,心愿能用的到
改后的性能是
如果软件信息页地点是:https://www.xxx.net/soft/1.htm
下载地点衔接是:https://www.xxx.net/plus/download.php?.........
判别去路,
假如没有是https://www.xxx.net/soft/1.htm,
间接跳转到https://www.xxx.net/soft/1.htm
假如去路是https://www.xxx.net/soft/1.htm 则展现下载地点
阐明下:下边的代码是间接复制我本人站上的,我启用的是全站迅雷下载,关上就主动应用迅雷下载,你也能够做下小修正,没有让应用迅雷下载
没有应用迅雷的很容易修正:删掉迅雷相干代码,只援用$link就能够了
需求修正的文件为 /plus/download.php
演示:
https://www.xxx.net/do/plus/download.php?open=0&aid=20975&cid=3
必需从https://www.xxx.net/codes/20975.html这个页面进入才失常
代码以下:
<script src="http://pstatic.xunlei.com/js/webThunderDetect.js"></script>
<?php require("encode.inc"); ?>
<?php
require_once(dirname(__FILE__)."/../include/config_base.php");
require_once(dirname(__FILE__)."/../include/inc_channel_unit.php");
if(!isset($open)) $open = 0;
if(!isset($aid)) $aid = "";
$dsql = new DedeSql(false);
//读取文档根本信息
$arctitle = "";
$arcurl = "";
$gquery = "Select
dede_archives.title,dede_archives.senddate,dede_archives.arcrank,
dede_archives.ismake,dede_archives.typeid,dede_archives.channel,dede_archives.money,
dede_arctype.typedir,dede_arctype.namerule
From dede_archives
left join dede_arctype on dede_arctype.ID=dede_archives.typeid
where dede_archives.ID='$aid'
";
$arcRow = $dsql->GetOne($gquery);
if(is_array($arcRow)){
$arctitle = $arcRow['title'];
$arcurl = GetFileUrl($aid,$arcRow['typeid'],$arcRow['senddate'],$arctitle,$arcRow['ismake'],$arcRow['arcrank'],$arcRow['namerule'],$arcRow['typedir'],$arcRow['money']);
}else{
$dsql->Close();
ShowMsg("无奈猎取未知文档的信息!","-1");
exit();
}
$cu = new ChannelUnit($arcRow['channel'],$aid);
if(!is_array($cu->ChannelFields)) {
$cu->Close();
$dsql->Close();
ShowMsg("猎取文档链接信息失败!","-1");
exit();
}
$vname = "";
foreach($cu->ChannelFields as $k=>$v){
if($v['type']=="softlinks"){ $vname=$k; break; }
}
if(!is_array($cu->ChannelFields)) {
$cu->Close();
$dsql->Close();
ShowMsg("猎取文档链接信息失败!","-1");
exit();
}
if(!strstr($_SERVER['HTTP_REFERER'],$arcurl))
{
echo "<script language='javascript'>location=\"$arcurl\";</script>";
}
$row = $dsql->GetOne("Select $vname From ".$cu->ChannelInfos['addtable']." where aid='$aid'");
$downlinks = $cu->GetAddLinks($row[$vname]);
$dsql->Close();
$cu->Close();
$link = base64_decode($link);
$thunderUrl = ThunderEncode($link);
echo "<script>OnDownloadClick('".$thunderUrl."','',location.href,'07231',2,'')</script>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><?php echo $arctitle?>下载地点列表</title>
<link href="../templets/style/dede.css" rel="stylesheet" type="text/css" />
<link href="../templets/style/spage.css" rel="stylesheet" type="text/css" />
</head>
</head>
<body>
<center>
<div>
<span>下载</span>
<span><a href="/" _fcksavedurl="/">前往主页</a></span></div>
<div>
<div>
<div>软件称号:<a href='<?php echo $arcurl?>' _fcksavedurl='<?php echo $arcurl?>' style='font-size:11pt'><?php echo $arctitle?></a></div>
</div>
<div class="">
<div>
<div>标签: dedecms 织梦教程 织梦技巧 dedecms教程 dede问题解决