erphpdown是模板兔开发的一款资源付费类插件,功能非常强大。我一直在使用。
但这么多版本迭代过去了。有一个bug(也不知道是不是故意如此设定的),那就是你设置了某种会员一天只能下载2个资源。昨天下载过了,到了第二天,这个资源又重复购买,它会又消耗第二天的下载次数。
这个插件一直升级,最近较新的是erphpdown v12.3,依然存在这个问题。
那怎么修改呢?
修改文件路径:erphpdown/includes/mobantu.php,具体地方如下:
大概89行,这个函数:function checkDownLog
修改前代码:
if($result > $times)
return false;
elseif($result == $times){
$exist = $wpdb->get_var("select ice_id from $wpdb->down where ice_user_id=".$uid." and DATEDIFF(ice_time,NOW())=0 and ice_post_id = $pid");
if($exist)
return true;
else
return false;
}
else
return true;
修改后代码:
$result1 = $wpdb->get_var("select count(ice_post_id) from $wpdb->down where ice_user_id=".$uid." and ice_post_id = $pid");
if($result1 == 0)
if($result > $times)
return false;
elseif($result == $times){
$exist = $wpdb->get_var("select ice_id from $wpdb->down where ice_user_id=".$uid." and DATEDIFF(ice_time,NOW())=0 and ice_post_id = $pid");
if($exist)
return true;
else
return false;
}
else
return true;
else
return true;
我大概解释一下:vip免费下载资源,有一个记录。这个数据表里面会存储文章id。在检测每日下载次数之前,先查这个表里有没有这个文章id,有的话就不计入当日下载次数里。如果没有,就进行计算。
感谢您的来访,获取更多精彩文章请收藏本站。

© 版权声明
THE END
暂无评论内容