公告

Collapse
No announcement yet.

[解決]廣場首頁線上列表一個會員出現多次

Collapse
X
Collapse
Who has read this thread:
  • Filter
  • Time
  • Show
全部清除
新帖子

  • [解決]廣場首頁線上列表一個會員出現多次

    [hide]from: http://www.discuz.net/thread-1681057-1-1.html
    轉載: http://linux0911.no-ip.info/Discuz/t...13983-1-2.html

    [解決]廣場首頁線上列表一個會員出現多次
    lidq.jingwu

    開啟 /source/function/function_core.php
    找到函數,updatesession:
    Code:
    function updatesession($force = false) {
    
            global $_G;
            static $updated = false;
            if(!$updated) {
                    $discuz = & discuz_core::instance();
                    foreach($discuz->session->var as $k => $v) {
                            if(isset($_G['member'][$k]) && $k != 'lastactivity') {
                                    $discuz->session->set($k, $_G['member'][$k]);
                            }
                    }
    
                    foreach($_G['action'] as $k => $v) {
                            $discuz->session->set($k, $v);
                    }
    
                    $discuz->session->update();
    
                    $updated = true;
            }
            return $updated;
    }
    改為
    Code:
    function updatesession($force = false) {
    
            global $_G;
            static $updated = false;
            if(!$updated) {
                    $discuz = & discuz_core::instance();
                    foreach($discuz->session->var as $k => $v) {
                            if(isset($_G['member'][$k]) && $k != 'lastactivity') {
                                    $discuz->session->set($k, $_G['member'][$k]);
                            }
                    }
    
                    foreach($_G['action'] as $k => $v) {
                            $discuz->session->set($k, $v);
                    }
            //從 pre_common_session 中查詢是否有相同 UID 的會員,有說明是同一會員在不同的地方登入,不再更新 session
                    $t_session = DB::fetch_first("SELECT * FROM ".DB::table('common_session')." WHERE uid='".$_G['uid']."'");
                    if($t_session['sid']){
                            //資料庫中有記錄,不更新 SESSION
                    } else {
                            $discuz->session->update();
                            $updated = true;
                    }
    
            }
            return $updated;
    }
    UTF-8 版另存 utf-8 格式

    [/hide]
Working...
X