原帖由 ninelife 于 2005-12-4 20:32 发表
给我看看你的onlinetimeupdate.php
- <?php
- @include DISCUZ_ROOT.'./forumdata/cache/cache_plugins.php';
- $online = $_DCACHE['plugins_settings']['onlinetime'];
- @include DISCUZ_ROOT.'./forumdata/cache/cache_plugins.php';
- $salarysetting = $_DCACHE['plugins_settings']['salary'];
- /*
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: 在線時間 ::
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: Author: Ninelife ::
- :: Version: 2.5F 2005/02/15 05:15 ::
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- */
- if($discuz_uid) {
- $timenow = time();
- $monthnow = date(n);
- $query = $db->query("SELECT onlinetime,lastonline,onlinemonth,lastmonth FROM $tablepre"."members WHERE username='$discuz_user'");
- while($onlinetime = $db->fetch_array($query)) {
- $last = $onlinetime[lastonline];
- $lastmonth = $onlinetime[lastmonth];
- }
- if($last==0||$lastmonth == 0||$monthnow-$lastmonth<0){
- $db->query("UPDATE $tablepre"."members SET lastonline = $timenow,lastmonth = $monthnow, onlinemonth = 0 WHERE username='$discuz_user'");
- }elseif($monthnow-$lastmonth>0){
- if($salarysetting[pm]){
- $pmsubject="★工資通知★";
- $pmmessage="親愛的用戶您好:\n為了獎勵您上個月在論壇做出的傑出成績";
- $pmmessage.="你的工資已到帳。";
- $pmmessage.="請到銀行查收。謝謝";
- $db->query("INSERT INTO $table_pms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message) SELECT 'SYSTEM', '0', uid, 'inbox', '1', '$pmsubject', '$timestamp', '$pmmessage' FROM $table_members ");
- }
- $db->query("UPDATE $tablepre"."members SET lastmonth = $monthnow,onlinemonth = 0 ,lastmonthonline=onlinemonth,newpm=1");
- }elseif(($timenow-$last)>$online[maxtime]){
- $db->query("UPDATE $tablepre"."members SET lastonline = $timenow WHERE username='$discuz_user'");
- }elseif(($timenow-$last)<$online[maxtime] && ($timenow-$last)>$online[mintime]){
- $db->query("UPDATE $tablepre"."members SET onlinetime = onlinetime + $timenow - lastonline,onlinemonth = onlinemonth + $timenow - lastonline,timeremain=timeremain + $timenow - lastonline, lastonline = $timenow WHERE username='$discuz_user'");
- }elseif(($timenow-$last) < 0){
- $db->query("UPDATE $tablepre"."members SET lastonline = $timenow WHERE username='$discuz_user'");
- }
- }
- function showonline($h,$m){
- @include DISCUZ_ROOT.'./forumdata/cache/cache_plugins.php';
- $online = $_DCACHE['plugins_settings']['onlinetime'];
- if($online[upgradetype] == 2 ){
- for($lv=0;$lv>=0;$lv++)
- if((5*($lv+1)*($lv+1)+15*($lv+1))>$h)
- break;
- $upgrade = 5*($lv+1)*($lv+1)+15*($lv+1)-$h;
- $lv = $lv + 1;
- }elseif($online[upgradetype]== 1 ){
- for($lv=0;$lv>=0;$lv++)
- if(($online[upgradetime]*$lv)>$h)
- break;
- $upgrade = $online[upgradetime]*$lv-$h;
- }
- if($online[showalt]){
- $alt = 'alt="等級:'.$lv.'
- 在線時間:'.$h.'小時'.$m.'分鐘
- 升級還需:'.$upgrade.'小時 "';
- }
- if($online[showform]){
- for($i=intval($lv/($online[sm]*$online[ms])); $i>0; $i--){
- echo '<a href="plugins.php?p=onlinetime"><img src=images/sun.gif '.$alt.' border=0></a>';
- }
- for($i=intval($lv%($online[sm]*$online[ms])/$online[sm]); $i>0; $i--){
- echo '<a href="plugins.php?p=onlinetime"><img src=images/moon.gif '.$alt.' border=0></a>';
- }
- for($i=$lv%($online[sm]*$online[ms])%$online[sm]; $i>0; $i--){
- echo '<a href="plugins.php?p=onlinetime"><img src=images/star.gif '.$alt.' border=0></a>';
- }
- }else{
- for($i=intval($lv/($online[sm]*$online[ms])); $i>0; $i--){
- echo '<img src=images/sun.gif '.$alt.' border=0>';
- }
- for($i=intval($lv%($online[sm]*$online[ms])/$online[sm]); $i>0; $i--){
- echo '<img src=images/moon.gif '.$alt.' border=0>';
- }
- for($i=$lv%($online[sm]*$online[ms])%$online[sm]; $i>0; $i--){
- echo '<img src=images/star.gif '.$alt.' border=0>';
- }
- }
- }
- ?>
复制代码 |