Home  >  Article  >  php教程  >  dedecms ajax 下载统计代码

dedecms ajax 下载统计代码

WBOY
WBOYOriginal
2016-06-08 17:29:44978browse

dedecms ajax 下载统计代码

<script>ec(2);</script>

require_once (dirname(__FILE__) . "/include/common.inc.php");
require_once(DEDEINC."/channelunit.class.php");

 $aid = (isset($aid) && is_numeric($aid)) ? $aid : 0;
 
  $rand =mt_rand(10,80);
  
  $query = "select count(*) as dd from #@__downloads where id='$aid'";
  
  $row = $dsql->GetOne($query); 
 
  if($row['dd'] > 0)
  {
   $query = "update #@__downloads set downloads=downloads+$rand where id='$aid'";
   $dsql->ExecNoneQuery($query);
  }else {
   $query = "insert into #@__downloads(hash,id,downloads) values('null$aid','$aid',1)";
   $dsql->ExecNoneQuery($query);
  }
  

下面是实例方法。








缁胯
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn