帝国cms7.5授权指定会员组每日最大文章阅读数量

需求描述
要设置每种会员每日最大浏览量,每天阅读文章数量。
步骤1
在后台会员字段,增加字段readwentong。
步骤2
添加管理计划任务,每天对“readwentong”进行清零。
任务名称:del.readwentong
任务代码
<?php
$usql=$empire->query("update {$dbtbpre}enewsmemberadd set readwentong=0");
?>
步骤3
会员点击访问文章记录,找到 e/public/viewclick/index.php修改这个文件,代码如下
//日周月浏览数
if($down==8)
{
$r=$empire->fetch1("select onclick from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$seesql=$empire->fetch1("select readwentong from {$dbtbpre}enewsmemberadd where userid='$muserid' limit 1");
$readwentong=$seesql['readwentong']+1;
if($_GET['addclick']==1)
{
$usql=$empire->query("update {$dbtbpre}ecms_".$cr['tbname']." set onclick=onclick+1,rclick=rclick+1,zclick=zclick+1,yclick=yclick+1 where id='$id' limit 1");
$add['onclick']=$add['onclick']+1;
$add['rclick']=$add['rclick']+1;
$add['zclick']=$add['zclick']+1;
$add['yclick']=$add['yclick']+1;
$sesql=$empire->query("update {$dbtbpre}enewsmemberadd set readwentong=readwentong+1 where userid='$muserid' limit 1");
}
}
步骤4
加入判断语句,如果超出每日访问的限制就不给看
找到e/class/chacklevel.php
在 //是否登陆
$user_r=ViewCheckLogin($infor);
//验证权限
上面添加代码
$userid=(int)getcvar('mluserid');
$s1sql=$empire->fetch1("select readwentong from {$dbtbpre}enewsmemberadd where userid='$userid' limit 1");
$s2sql=$empire->fetch1("select daydown from {$dbtbpre}enewsmembergroup where groupid='$groupid' limit 1");
if($s1sql['readwentong']>$s2sql['daydown'])
{
echo"<script>alert('今天看的够多了,请您明天再来吧!');history.go(-1);</script>";
exit();
}

支付宝转账赞助

支付宝扫一扫赞助

微信转账赞助

微信扫一扫赞助

留言与评论(共有 0 条评论)
   
验证码: