修改DEDECMS的广告显示文件地址,防止广告被阻止显示。

文件/plus/ad_js.php,用/api/cc.php 替代。cc.php全部内容如下:

 100)
{
    echo file_get_contents($cacheFile);
    exit();
}

require_once '../include/common.inc.php';
$row = $dsql->GetOne("SELECT * FROM `#@__myad` WHERE aid='$aid' ");
$adbody = '';
if($row['timeset']==0)
{
    $adbody = $row['normbody'];
} else {
    $ntime = time();
    if($ntime > $row['endtime'] || $ntime < $row['starttime'])
    {
        $adbody = $row['expbody'];
    } else {
        $adbody = $row['normbody'];
    }
}
$adbody = str_replace('"', '\"',$adbody);
$adbody = str_replace("\r", "\\r",$adbody);
$adbody = str_replace("\n", "\\n",$adbody);
$adbody = "\r\n";
$fp = fopen($cacheFile, 'w');
fwrite($fp, $adbody);
fclose($fp);



防止广告调用被浏览器的广告屏蔽软件阻止。


你可能感兴趣的:(网站运营,dedecms)