New articles Năng lực quản lý: nhân tố thứ năm     ♥ Lựa chọn mục tiêu cuộc đời     ♥ 10 bí quyết cân bằng công việc và gia đình     ♥ Cô đơn trên mạng     ♥ Chứng khoán: Giấc mơ và ác mộng     ♥ Tám     ♥ Những tính năng của blog VnVista     ♥ Các mạng xã hội thống trị Google     ♥ Điều gì tạo nên một giám đốc công nghệ thông tin giỏi?     ♥ Cố gắng xóa bỏ những ấn tượng xấu     ♥ Cần một cách làm ăn mới     ♥ Tiếp thị hướng đến doanh nhân     ♥ Đưa cửa hàng thật lên chợ ảo     ♥ Bí quyết quản lý các nhân viên trẻ     ♥ Một số câu hỏi phỏng vấn “đặc biệt” của Microsoft     ♥ 4 bài học thành công trong kinh doanh     ♥ Tạo dựng hình ảnh một cô gái trẻ chuyên nghiệp     ♥ Góc “khác” của thế giới online đêm     ♥ Phong cách người Mỹ     ♥ Chỉ nghĩ đến tiền cũng làm người ta ích kỷ     
New blog entries SHEET Giây phút êm đềm      ♥ Máy Triệt Lông Công Nghệ Cao K18A      ♥ Cách chọn giày bảo hộ tại Đà Nẵng      ♥ hình ảnh Yae Miko Game Genshin Impact      ♥ Cách bảo quản và vệ sinh giày bảo hộ lao động      ♥ SHEET Yêu 1 người sao buồn đến thế      ♥ Bí quyết bảo quản giày bảo hộ lao động      ♥ Máy Triệt Lông Lạnh Diode Laser K17      ♥ Công Nghệ Đùn Ống Nhựa Với Hạt Nhựa Nguyên Sinh      ♥ SHEET Xin cho 1 tiếng kinh cầu      ♥ máy nâng cơ xóa nhăn      ♥ Top 5 dầu gội thảo dược Việt nam 2025      ♥ Nhà phân phối giày bảo hộ tại Đà Nẵng uy tín      ♥ Máy Laser 1450nm Noable Triệt Dầu - Trị Mụn      ♥ Những ích lợi từ dầu gội thảo dược trị gàu      ♥ Công ty bảo hộ lao động tại Nghệ An uy tín      ♥ SHEET Vì em quá yêu anh      ♥ Unlock Your Medical Career with the MCCQE Part 1:      ♥ So sánh các thương hiệu giày bảo hộ hàng đầu      ♥ SHEET Quê hương tình yêu và tuổi trẻ      

[ Liệt Kê ] · Bình Thường · Tách Biệt+

Mod xem số người online trong ngày


Tacaza
post Sep 7 2005, 12:51 AM
Gửi vào: #1


Group Icon

The chALLeNgER
**********
Thành viên: 1
Nhập: 3-July 05
Bài viết: 3,003
Tiền mặt: 1,210
Thanked: 1572
Cấp bậc: 43
------
Giới tính: Male
Sinh nhật: 3 Tháng 4 - 1983
Đến từ: Hà Nội
------
Xem blog
Bạn bè: 253 (Xem)
Thêm vào nhóm bạn bè
Gửi thiệp điện tử
Trang thông tin





Mod này sẽ cho bạn biết những thành viên đã online trong ngày, số lượng khách, & số lần các search engine tới crawl website bạn.
Bắt đầu nào:

Bước 1 (Files):

Mở file ./sources/boards.php

Tìm:
CODE
//-----------------------------------
 // Add in show online users
 //-----------------------------------

 $stats_html .= $this->statfunc->active_users();

Thêm bên dưới:

CODE
//-----------------------------------
    // Add in show online users for today
    //-----------------------------------

    $stats_html .= $this->statfunc->online_users();


Mở file ./sources/lib/boardstats_functions.php

Tìm:

CODE
var $users_online  = "";


Thêm bên dưới:

CODE
var $wwo_users_online  = "";


Tìm:

CODE
function register_class(&$class)
{
 $this->class = $class;

 $this->sep_char = '<{ACTIVE_LIST_SEP}>';
}


Thêm bên dưới:

CODE
//*-------------------------------------------------------------------------*/
//
// SHOW ONLINE USERS FOR TODAY
//
/*-------------------------------------------------------------------------*/

function online_users()
{
 global $DB, $std, $ibforums;
 //--------------------------------
 // Enabled or disabled?
 //--------------------------------

       if ($ibforums->vars['enable_wwo'])
       {

        //--------------------------------
        // Our globals :)
        //--------------------------------

        //--------------------------------
        // Main data variable
        //--------------------------------

           $members = array( 'TOTAL'    => 0 ,
                             'NAMES'    => "",
                             'SPIDERS'  => 0 ,
                             'GUESTS'   => 0 ,
                             'MEMBERS'  => 0 ,
                             'ANON'     => 0 ,
                             'LINKS'  => "",
                             'GROUPS'  => "",
                             'T_GUESTS' => "",
                             'T_SPIDERS' => ""
                        );
        //--------------------------------
        // Member count for server
        //--------------------------------

        $realmemcount  = 0;

        //--------------------------------
        // Groups' info cache
        //--------------------------------

 $groups   = array ();

            //--------------------------------
        // Gonna eat some cookies
 //--------------------------------

           $filt = trim($std->my_getcookie ('wwo_filter'));

           if (($filt == "") and ($ibforums->input['wwo'] == ""))
           {
 if ($ibforums->vars['filter_wwo_hide'])
               {
             $ibforums->input['wwo'] = "0";
  }
 else
            {
             $ibforums->input['wwo'] = "10";
            }
           }

           if ($ibforums->input['wwo'] != "")
           {
 $std->my_setcookie('wwo_filter', $ibforums->input['wwo']);
               $filt = $ibforums->input['wwo'];
           }

 //--------------------------------
        // Let's set-up our filters
 //--------------------------------

           $posted_only = ( substr ($filt, 0, 1) == "2" );

           if ($filt != "0")
           {
            $filter = substr ($filt, 1);
           }

            //--------------------------------
            // All this GMT stuff is really annoying
        // But we should go around this if our members live in other time zones than server
 //--------------------------------
        // So we getting server timestamp what for end-user will be his midnight time
    //--------------------------------

        $realtimestamp  = mktime(0,0,0,date("m,d,Y"));
        $timestamp  = time() - (($std->get_time(time(), "H" ) * 3600) + ($std->get_time(time(), "i" ) * 60) + $std->get_time(time(), "s" ) );

 //--------------------------------
        // We should get members who was online today for both server and client

            // If we should show this of course
 //--------------------------------

           if (($ibforums->vars['show_wwo']) and ($ibforums->member['g_can_view_wwo']))
           {
            $use_timestamp_s = min ($timestamp, $realtimestamp);
            $use_timestamp_e = max (($timestamp + 86399), ($realtimestamp + 86399));
           }
           else
           {
 $use_timestamp_s = $realtimestamp;
 $use_timestamp_e = $realtimestamp + 86399;
           }

 //--------------------------------
 // Get the users from the DB
 //--------------------------------

            $DB->simple_construct(array('select' => 'id, name, last_activity, posts, last_post, last_ip, login_anonymous, mgroup',
                 'from' => 'members',
                                         'where' => "id != 0 AND mgroup != {$ibforums->vars['guest_group']}
                                             AND (last_activity BETWEEN '{$use_timestamp_s}' AND '{$use_timestamp_e}')",
                                         'order' => "last_activity DESC"));
 $DB->simple_exec();

            //-----------------------------------------
 // FETCH...
 //-----------------------------------------

 while ($r = $DB->fetch_row() )
 {

                if (($r['last_activity'] >= $timestamp) and ($r['last_activity'] < ($timestamp + 86400)))
         {
                 $rows[] = $r;
  }

                //--------------------------------
                // Server's just only counts
  //--------------------------------

                if (($r['last_activity'] >= $realtimestamp) and ($r['last_activity'] < ($realtimestamp + 86400)))
             {
                 $realmemcount++;
             }
 }

           //--------------------------------
           // Client should get extra info, if allowed, of course
           //--------------------------------

           if (($ibforums->vars['show_wwo']) and ($ibforums->member['g_can_view_wwo']))
           {
 if ( !empty($rows) )
 {
            foreach ( $rows as $r )
            {
                   //--------------------------------
                   // Why should we redo this comparsion?
                   //--------------------------------

                   $posted_today = (($r['last_post'] >= $timestamp) and ($r['last_post'] < ($timestamp + 86400)));

                   //--------------------------------
                   // Getting login type
                   //--------------------------------

                   $be_anon = substr( $r['login_anonymous'], 0, 1 );

                   //--------------------------------
                   // Yeah, count'em all
                   //--------------------------------

                   $members['TOTAL']++;

                   //--------------------------------
                   // Getting group info for current member
                   //--------------------------------

                   $g = $ibforums->cache['group_cache'][$r['mgroup']];

                   //--------------------------------
                   // Just writing group infos, if we need to do so
                   //--------------------------------

                   if ($ibforums->vars['show_wwo_groups'])
                   {
                       $groups [($r['mgroup'])]['names'] = preg_replace ( array("/<#NAME#>/", "/<#POSTED#>/"),
                                                                          array("<a href='{$ibforums->base_url}act=idx&wwo=1{$r['mgroup']}'>{$g['g_wwo_prefix']}{$g['prefix']}{$g['g_title']}{$g['suffix']}{$g['g_wwo_suffix']}</a>",
                                                                                "<a href='{$ibforums->base_url}act=idx&wwo=2{$r['mgroup']}'>{$g['g_wwo_post_prefix']}{$g['prefix']}{$ibforums->lang['wwo_posted']}{$g['suffix']}{$g['g_wwo_post_suffix']}</a>"),
                                                                          $ibforums->lang['wwo_g_info']
                                                                        );
                       $groups [($r['mgroup'])]['count']++;

                       if ($posted_today)
                       {
                           $groups [($r['mgroup'])]['posted_count']++;
                       }
                   }

                   //--------------------------------
                   // Filter it up
                   //--------------------------------
                   // Default - show
                   //--------------------------------

                   $add = true;

                   //--------------------------------
                   //  Can we see anonymous logins?
                   //--------------------------------

                   if ($be_anon == 1)
                   {
                       $members['ANON']++;
                       $add = ( ($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) and ($ibforums->vars['disable_admin_anon'] != 1) );
                   }

                   //--------------------------------
                   //  Checking filters
                   //--------------------------------

                   $add = (($add) and (( $r['mgroup'] == $filter ) or ( $filter == "0" )));
                   $add = (($add) and ((!$posted_only) or ($posted_today)));

                   //--------------------------------
                   //  So, we about to add member to list
                   //--------------------------------
                   if ($add)
                   {
                       //--------------------------------
                       // Building user info
                       //--------------------------------

                       $user_info  = "{$ibforums->lang['last_activity']}".$std->get_date($r['last_activity'], 'LONG');
                       $user_info .= "\n{$ibforums->lang['wwo_posts']}{$r['posts']}";
                       $user_info .= "\n{$ibforums->lang['wwo_last_post']}".$std->get_date($r['last_post'], 'LONG');

                       if ($ibforums->member['mgroup'] == $ibforums->vars['admin_group'])
                       {
                           $user_info .= "\n{$ibforums->lang['wwo_ip_address']}{$r['last_ip']}";
                       }

                       if ($posted_today)
                       {
                           $members['NAMES'] .= $g['g_wwo_post_prefix'];
                           $members['NAMES'] .= "<a href='{$ibforums->base_url}showuser={$r['id']}' title='$user_info'>{$g['prefix']}{$r['name']}{$g['suffix']}</a>";
                           $members['NAMES'] .= $g['g_wwo_post_suffix'];
                           if ($be_anon == 1)
                           {
                               $members['NAMES'] .= "*";
                           }
                           $members['NAMES'] .= "{$this->sep_char} \n";
                       }
                       else
                       {
                           $members['NAMES'] .= $g['g_wwo_prefix'];
                           $members['NAMES'] .= "<a href='{$ibforums->base_url}showuser={$r['id']}' title='$user_info'>{$g['prefix']}{$r['name']}{$g['suffix']}</a>";
                           $members['NAMES'] .= $g['g_wwo_suffix'];
                           if ($be_anon == 1)
                           {
                               $members['NAMES'] .= "*";
                           }
                           $members['NAMES'] .= "{$this->sep_char} \n";
                       }
                   }

            }
 }
            $members['MEMBERS'] = $members['TOTAL'] - $members['ANON'];

            if ($members['NAMES'] != "")
            {
                $members['NAMES'] = preg_replace( "/".preg_quote($this->sep_char)."$/", "", trim($members['NAMES']) );
            }
            else
            {
                $members['NAMES'] = $ibforums->lang['wwo_empty'];
            }

            //--------------------------------
            //  Filter list make-up
            //--------------------------------

            $members['LINKS']  = "<#MARK1#><a href='{$ibforums->base_url}act=idx&wwo=10'>{$ibforums->lang['wwo_all']}</a>, ";
            $members['LINKS'] .= "<#MARK2#><a href='{$ibforums->base_url}act=idx&wwo=0'>{$ibforums->lang['wwo_none']}</a>";

            $mark1 = "";
            $mark2 = "";

            if ($filt == "10")
            {
                $mark1 = $ibforums->lang['wwo_marker'];
            }
            elseif ($filt == "0")
            {
                $mark2 = $ibforums->lang['wwo_marker'];
            }

            $members['LINKS'] = preg_replace( array ( "/<#MARK1#>/","/<#MARK2#>/" ),
                                              array ( $mark1, $mark2 ),
                                              $members['LINKS'] );

            //--------------------------------
            //  Going around groups' info
            //--------------------------------

            if ((!empty($groups)) and ($ibforums->vars['show_wwo_groups']) and ($ibforums->vars['show_wwo']) and ($ibforums->member['g_can_view_wwo']))
            {
                ksort ($groups);
                foreach ($groups as $k => $v)
                {
                    $mark           = "";
                    $posted_mark    = "";

                    if (($filter == $k) and (!$posted_only))
                    {
                        $mark           = $ibforums->lang['wwo_marker'];
                    }
                    elseif (($filter == $k) and ($posted_only))
                    {
                        $posted_mark    = $ibforums->lang['wwo_marker'];
                    }

                    $members['GROUPS'] .= preg_replace( array ( "/<#NUM#>/","/<#PNUM#>/","/<#MARK#>/","/<#PMARK#>/" ),
                                            array ($std->do_number_format(intval($v['count'])), $std->do_number_format(intval($v['posted_count'])), $mark, $posted_mark),
                                            $v['names'] ).", \n";
                }
                $members['LINKS'] .= ",";
                $members['GROUPS'] = preg_replace( "/".preg_quote(',')."$/", "", trim($members['GROUPS']) );
            }
 }

    $this->wwo_users_online = $realmemcount;

    //--------------------------------
           // Lets update log
    //--------------------------------

           if ($ibforums->vars['log_wwo'])
           {
            $DB->simple_construct( array( 'select' => '*',
                                          'from'   => 'wwo_days',
                                          'where'  => "day_id = $realtimestamp",
                                 )      );

            $DB->simple_exec();

            if ( $DB->get_num_rows() != 0 )
            {
                $r = $DB->fetch_row();

                    $members['GUESTS']  = intval($r['guests']);
                    $members['SPIDERS']  = intval($r['spiders']);

                if ($r ['was_online'] < $realmemcount)
                {
                    $DB->do_shutdown_update( 'wwo_days', array( 'was_online' => $realmemcount ), 'day_id = '.$realtimestamp );
                }
            }
            else
            {
                $DB->do_insert( 'wwo_days', array( 'day_id' => $realtimestamp,
                                                   'was_online' => $realmemcount ) );
            }
               if (($ibforums->vars['show_wwo_guest']) and ($ibforums->vars['log_wwo_guest']))
               {
                   $members['T_GUESTS'] = "{$ibforums->lang['guests']},";
               }
               else
               {
                   $members['GUESTS'] = "";
 }

               if (($ibforums->vars['show_wwo_spider']) and ($ibforums->vars['log_wwo_spider']))
               {
                   $members['T_SPIDERS'] = "{$ibforums->lang['wwo_spiders']},";
               }
               else
               {
                   $members['SPIDERS'] = "";
 }
           }

  //--------------------------------
  // Should we print this?
  //--------------------------------

           if (($ibforums->vars['show_wwo']) and ($ibforums->member['g_can_view_wwo']))
           {
         return $this->class->html->online_today($members);
           }
       }
   }


Tìm:

CODE
//----------------------------------------
  // Update the most active count if needed
  //----------------------------------------

  if ($this->users_online > $stats['most_count'])
  {
   $stats['most_count'] = $this->users_online;
   $stats['most_date']  = time();

   $DB->do_update( 'cache_store',
       array( 'cs_array' => 1, 'cs_value' => addslashes(serialize($stats)) ),
          "cs_key='stats'"
        );
  }


Thêm bên dưới:

CODE
//----------------------------------------
  // Who Was Online Statistics
  //----------------------------------------

  if (($ibforums->vars['show_most_wwo']) and ($ibforums->vars['enable_wwo']))
             {
       if ($this->wwo_users_online > $stats['wwo_most_count'])
          {
           $stats['wwo_most_count'] = $this->wwo_users_online;
               $stats['wwo_most_date']  = mktime(0,0,0,date("m,d,Y"));

               $DB->do_update( 'cache_store',
                         array( 'cs_array' => 1, 'cs_value' => addslashes(serialize($stats)) ),
                                "cs_key='stats'"
                                 );
          }
          $wwo_most_time = $std->get_date( $stats['wwo_most_date'], 'JOINED', 1 );
   $ibforums->lang['wwo_most_online'] = str_replace( "<#NUM#>" ,   $std->do_number_format($stats['wwo_most_count'])  , $ibforums->lang['wwo_most_online'] );
   $ibforums->lang['wwo_most_online'] = str_replace( "<#DATE#>",                   $wwo_most_time                    , $ibforums->lang['wwo_most_online'] );
  }


Tìm:

CODE
$ibforums->lang['most_online'] = str_replace( "<#NUM#>" ,   $std->do_number_format($stats['most_count'])  , $ibforums->lang['most_online'] );
  $ibforums->lang['most_online'] = str_replace( "<#DATE#>",                   $most_time                    , $ibforums->lang['most_online'] );

Thêm bên dưới:
//wwo
           if (($ibforums->vars['show_most_wwo']) and ($ibforums->vars['enable_wwo']))
           {
 $ibforums->lang['most_online'] .= "<br />".$ibforums->lang['wwo_most_online'];
           }
//wwo


Xem tiếp bên dưới


--------------------
Nhóm bạn bè:


dung_buong_tay

tamhonngoc_536

uchinhuong

MTTH

xuxusp2

Xem tất cả


--------------------

Sao không là mặt trời, gieo hạt nắng vô tư?


 
Nếu bạn thấy bài viết này vi phạm nội quy forum, hãy click nút này:
User is offlineProfile CardPM
Go to the top of the page
+Quote Post



Thank you! Reply to this topicTopic OptionsStart new topic
 

Bản Rút Gọn Bây giờ là: 18th July 2025 - 06:21 AM
Home | Mạng xã hội | Blog | Thiệp điện tử | Tìm kiếm | Thành viên | Sổ lịch