dede的文章点击计数不防刷的,自己改了下,自己试着好像没问题。

将plus/count.php 改为下面代码就OK了。

以下为引用的内容:

<?
$__ONLYDB = true;
require_once(dirname(__FILE__)."/../include/config_base.php");
session_start(); //新加入

if(empty($aid)) $aid="0";
$aid = ereg_replace("[^0-9]","",$aid);
if(empty($mid)) $mid="0";
$mid = ereg_replace("[^0-9]","",$mid);




以下为引用的内容:


if (!isset($_SESSION['c_time'.$aid])) // 如果第一次访问,设定时间戳,并允许增加
{
  $_SESSION['c_time'.$aid] = time();

  $dsql = new DedeSql(false);
  $dsql->ExecuteNoneQuery("Update #@__archives set click=click+1 where ID='$aid'");
  if(!empty($mid)){
  $dsql->ExecuteNoneQuery("Update #@__member set pageshow=pageshow+1 where ID='$mid'");
  }
  if(!empty($view)){
    $row = $dsql->GetOne("Select click From #@__archives where ID='$aid'");
    echo "document.write('".$row[0]."');\r\n";
  }
  $dsql->Close();
  exit();

}
elseif (time() - $_SESSION['ctime'.$aid] < 3600) // 如果在一小时内刷新页面,则不增加。按此可以设置永远不增加
{
  exit();
} else {                 // 如果超过一小时,则重新计时,并允许增加
  $allow_insert = true;
  unset($_SESSION['ctime'.$aid]);
}

?>



学习时间 | 评论(0) | 引用(0) | 阅读(22)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]