文件/plus/ad_js.php,用/api/cc.php 替代。cc.php全部内容如下:
<?php
/**
*
* 广告JS调用方式
*
* @version $Id: ad_js.php 1 20:30 2010年7月8日Z tianya $
* @package DedeCMS.Site
* @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
if(isset($_GET['arcID'])) $aid = intval($_GET['arcID']);
$arcID = $aid = (isset($_GET['aid']) && is_numeric($_GET['aid'])) ? intval($_GET['aid']) : 0;
if($aid==0) die(' Request Error! ');
$cacheFile = '../data/cache/myad-'.$aid.'.htm';
if(file_exists($cacheFile) && filesize($cacheFile) > 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\ndocument.write(\"{$adbody}\");\r\n-->\r\n";
$fp = fopen($cacheFile, 'w');
fwrite($fp, $adbody);
fclose($fp);
防止广告调用被浏览器的广告屏蔽软件阻止。