燈燈一号 發表於 2023-10-28 00:00:00

dedecms会员登录积分每天只限增加一次的实现思路及代码

<p>
        <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;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>具体修改:</strong><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;'>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;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>具体代码大概在370行</strong><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></p>
<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";'>
        <p class="right">
                <span><u>复制代码</u></span></p>
        <p>
                代码如下:</p>
</div>
<p class="msgborder" 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 &gt; 7200 &amp;&amp; $cfg_login_adds &gt; 0) <br>
        { <br>
        $dsql-&gt;ExecuteNoneQuery("Update `dede_member` set `scores`=`scores`+{$cfg_login_adds} where mid='$uid' "); <br>
        } <br>
        $this-&gt;M_ID = $uid; <br>
        $this-&gt;M_LoginTime = time(); </p>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>修改为: </span></p>
<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";'>
        <p class="right">
                <span><u>复制代码</u></span></p>
        <p>
                代码如下:</p>
</div>
<p class="msgborder" 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-&gt;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-&gt;ExecuteNoneQuery("Update `dede_member` set `scores`=`scores`+{$cfg_login_adds} where mid='$uid' "); <br>
        } <br>
        $nowtime = GetDateTimeMk(time()); <br>
        $logint = GetMkTime($nowtime); <br>
        $dsql-&gt;ExecuteNoneQuery("Update dede_member set logintime='$logint' where mid='$uid' "); <br>
        $this-&gt;M_ID = $uid; <br>
        $this-&gt;M_LoginTime = time(); </p>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>因为发现dedecms 本身记录登陆时间不准 就加了个修改登陆时间的语句,用这种笨方法实现了。</span></p>
頁: [1]
查看完整版本: dedecms会员登录积分每天只限增加一次的实现思路及代码