dedecms会员登录积分每天只限增加一次的实现思路
<span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>首先把思路说一下:先先检测当前时间与上次登陆日期是否为同一天?如果是就不加积分。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>如果上次登陆日期与当前登陆日期不相等就加积分。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>具体修改: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>include文件夹下memberlogin.class.php文件 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>具体代码大概在370行 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>原先代码 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'><div class="right">
<span><u>复制代码</u></span>
</div>
代码如下:</div>
<div class="msgborder" id="phpcode2" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
//登录增加积分(上一次登录时间必须大于两小时) <br>
if(time() - $logintime > 7200 && $cfg_login_adds > 0) <br>
{ <br>
$dsql->ExecuteNoneQuery("Update `dede_member` set `scores`=`scores`+{$cfg_login_adds} where mid='$uid' "); <br>
} <br>
$this->M_ID = $uid; <br>
$this->M_LoginTime = time(); </div>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>修改为: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<div class="right">
<span><u>复制代码</u></span>
</div>
代码如下:</div>
<div class="msgborder" id="phpcode3" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
//登录增加积分(每天登陆加一次积分) <br>
$row = $dsql->GetOne("SELECT logintime FROM dede_member WHERE mid='$uid' "); <br>
$logintime = $row['logintime']; <br>
$timel = GetDateMk($logintime); <br>
$now = GetDateMk(time()); <br>
if($timel!=$now) <br>
{ <br>
$dsql->ExecuteNoneQuery("Update `dede_member` set `scores`=`scores`+{$cfg_login_adds} where mid='$uid' "); <br>
} <br>
$nowtime = GetDateTimeMk(time()); <br>
$logint = GetMkTime($nowtime); <br>
$dsql->ExecuteNoneQuery("Update dede_member set logintime='$logint' where mid='$uid' "); <br>
$this->M_ID = $uid; <br>
$this->M_LoginTime = time(); </div>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>因为发现dedecms 本身记录登陆时间不准 就加了个修改登陆时间的语句,用这种笨方法实现了。</span>
頁:
[1]