1.找到plusdownload.php,查找:
$vname = '';
foreach($cu->ChannelFields as $k=>$v){
if($v['type']=='softlinks'){ $vname=$k; break; }
}
在上面这个代码前面添加如下代码:
$id = isset($id) && is_numeric($id) ? $id : 0;
$hash = md5($link);
$query = "select click from dede_archives where id='$aid'";
$row = $dsql->GetOne($query);
$query = "update dede_archives set click=click+1 where id='$aid'";
$dsql->ExecNoneQuery($query);
2.找到plusdisdls.php,用以下代码全部替换
<?php
require_once(dirname(__FILE__)."/../include/common.inc.php");
$aid = (isset($aid) && is_numeric($aid)) ? $aid : 0;
$row = $dsql->GetOne("Select click From `dede_archives` where id='$aid' ");
if(is_array($row))
{
echo "document.write('".$row['click']."');rn";
}
exit();
/*-----------
如果想显示下载次数,即把下面JS调用放到文档模板适当位置
<script src="{dede:field name='phpurl'/}/disdls.php?aid={dede:field name='id'/}" language="javascript"></script>
------------*/
?>