首页 > 教程 >
dede下载统计for链接到真实软件地址
2023-03-06教程围观次
简介织梦dedecms下载统计for链接到真实软件地址:将软件下载链接弄成显示真实地址时的下载统计第一步打开Quote:includetaglibchannelsoftlinks.lib.php找到functiongetDownloads($url)在它之前加入functionch_softlinks_allb($fvalue,&$ctag,&$refObj,&$row){global$dsql;//
织梦dedecms下载统计for链接到真实软件地址 :
将软件下载链接弄成显示真实地址时的下载统计
第一步
打开
Quote:
includetaglibchannelsoft s.lib.php
找到
function getDownloads($url)
在它之前加入
function ch_soft s_allb($fvalue,&$ctag,&$refObj,&$row)
{
global $dsql;
//引入权限判断
require_once(DEDEINC."/memberlogin.class.php");
$cfg_ml = new MemberLogin(-1);
$query = "select daccess from ".$refObj->ChannelInfos['addtable']." where aid=’".$refObj->ArcID."’";
$daccess = $dsql->GetOne($query);
if($cfg_ml->M_Rank < $daccess['daccess'])
{
return ‘你的权限不足或者未登录, 不能下载! 请登陆或者升级等级‘;
}
$phppath = $GLOBALS['cfg_phpurl'];
$down s = ”;
$dtp = new DedeTagParse();
$dtp->LoadSource($fvalue);
if(!is_array($dtp->CTags))
{
$dtp->Clear();
return "无链接信息!";
}
$tempStr = GetSysTemplets(‘channel_down sb.htm’);
foreach($dtp->CTags as $ctag)
{
if($ctag->GetName()==’ ’)
{
$ s = trim($ctag->GetInnerText());
$serverName = trim($ctag->GetAtt(‘text’));
$islocal = trim($ctag->GetAtt(‘islocal’));
if(!isset($first ) && $islocal==1)
{
$first = $ s;
}
if($islocal==1 && $row['islocal']!=1)
{
continue;
}
else
{
//支持http,迅雷下载,ftp,flashget
if(!eregi(‘^http://|^thunder://|^ftp://|^flashget://’,$ s))
{
$ s = $GLOBALS['cfg_mainsite'].$ s;
}
$downloads = getDownloads($ s);
if($row['gotojump']==1)
{
$ s = $phppath."/download.php?open=1&id=".$refObj->ArcID."& =".urlencode( 64_encode($ s));
}
$temp = str_replace("~ ~",$ s,$tempStr);
$down s .= $temp;
}
}
}
$dtp->Clear();
//启用镜像功能的情况
if($row['ismoresite']==1 && !empty($row['sites']) && isset($first ))
{
$first = @eregi_replace($GLOBALS['cfg_ host'],”,$first );
$row['sites'] = ereg_replace("[rn]{1,}","n",$row['sites']);
$sites = explode("n",trim($row['sites']));
foreach($sites as $site)
{
if(trim($site)==”)
{
continue;
}
list($ ,$serverName) = explode(‘|’,$site);
$ = trim($ ).$first ;
$downloads = getDownloads($ );
if($row['gotojump']==1)
{
$ = $phppath."/download.php?open=1& =".urlencode( 64_encode($ ));
}
$temp = str_replace("~ ~",$ ,$tempStr);
$temp = str_replace("~server~",$serverName,$temp);
$temp = str_replace("~downloads~",$downloads,$temp);