Other Hide Admin/Moderator IP Address - Ẩn địa chỉ IP của Admin/Moderator

PVS

Super Moderator
Thành viên BQT
Tham gia
28/02/2015
Bài viết
16,829
Được Like
12,687
Hide Admin/Moderator IP Address - Ẩn địa chỉ IP của Admin/Moderator

Đây là cách để che giấu địa chỉ IP của Admin/Moderator/Bất kỳ người dùng khác mà bạn chọn (miễn là bạn đã xác định ID người dùng cụ thể).
Nó không phải là "ẩn", thực sự nó được ghi đè lên dữ liệu IP của họ trong cơ sở dữ liệu với một IP giả.

Sửa đổi này cần chỉnh sửa tập tin gốc của Xenforo, mà nằm ở:
Mã:
/library/Xenforo/Model/Ip.php

Hãy tạo một bản sao của tập tin trước khi tiến hành.

Lưu ý:
  • Việc thay đổi tập tin sẽ được ghi đè nếu bạn tải lên các tập tin Xenforo mới khi nâng cấp diễn đàn.
  • Ngay cả khi bạn hoàn tác các tập tin chỉnh sửa, dữ liệu IP giả sẽ không được thay thế bằng IP thật. Đây là một cách thay thế.
  • Mod này không thay thế dữ liệu IP được ghi lại trước khi mod này được kích hoạt.
  • Vì vậy, nếu bạn muốn thay thế dữ liệu IP cũ của bạn, bạn phải chạy một truy vấn SQL như thế này:
    Mã:
    UPDATE xf_ip SET ip =  'cccc' WHERE user_id =1
    (cccc nghĩa là 99.99.99.99, nếu bạn tự hỏi)
~~~~~~~~~~~
Trước tiên, bạn phải quyết định IP giả nào bạn muốn sử dụng. 99.99.99.99, hoặc 88.88.88.88 hay cái gì khác.
Lưu ý: tôi nhận thấy rằng một số IP như 1.1.1.1 sẽ không hoạt động, có nghĩa là NULL sẽ được ghi nhận là IP.
Tôi không biết lý do tại sao điều đó xảy ra.
Tôi chọn 99.99.99.99.

Thứ hai, chỉnh sửa tập tin, ví dụ bạn muốn thiết lập ID người dùng 1 có IP 99.99.99.99

Tìm:
Mã:
    public function logIp($userId, $contentType, $contentId, $action, $ipAddress = null, $date = null)
    {
        $ipAddress = XenForo_Helper_Ip::getBinaryIp(null, $ipAddress);
        if (!$ipAddress)
        {
            return 0;
        }

        if ($date === null)
        {
            $date = XenForo_Application::$time;
        }

        $this->_getDb()->insert('xf_ip', array(
            'user_id' => $userId,
            'content_type' => $contentType,
            'content_id' => $contentId,
            'action' => $action,
            'ip' => $ipAddress,
            'log_date' => max(0, $date)
        ));

        return $this->_getDb()->lastInsertId();
    }

Thay bằng:
Mã:
    public function logIp($userId, $contentType, $contentId, $action, $ipAddress = null, $date = null)
    {
        if (1 == $userId) {/* Semprot modification */
            $ipAddress = '99.99.99.99';
        }

        $ipAddress = XenForo_Helper_Ip::getBinaryIp(null, $ipAddress);
        if (!$ipAddress)
        {
            return 0;
        }

        if ($date === null)
        {
            $date = XenForo_Application::$time;
        }

        $this->_getDb()->insert('xf_ip', array(
            'user_id' => $userId,
            'content_type' => $contentType,
            'content_id' => $contentId,
            'action' => $action,
            'ip' => $ipAddress,
            'log_date' => max(0, $date)
        ));

        return $this->_getDb()->lastInsertId();
    }

Nếu bạn muốn ẩn IP của một số ID người dùng (Ví dụ người dùng có ID là: 1, 22, 192, 391) :
Thì thay bằng:
Mã:
   public function logIp($userId, $contentType, $contentId, $action, $ipAddress = null, $date = null)
    {
        if (in_array($userId, array(1, 22, 192, 391))) {/* Semprot modification */
            $ipAddress = '99.99.99.99';
        }

        $ipAddress = XenForo_Helper_Ip::getBinaryIp(null, $ipAddress);
        if (!$ipAddress)
        {
            return 0;
        }

        if ($date === null)
        {
            $date = XenForo_Application::$time;
        }

        $this->_getDb()->insert('xf_ip', array(
            'user_id' => $userId,
            'content_type' => $contentType,
            'content_id' => $contentId,
            'action' => $action,
            'ip' => $ipAddress,
            'log_date' => max(0, $date)
        ));

        return $this->_getDb()->lastInsertId();
    }

Thử nghiệm trên Xenforo 1.5.11
Sửa đổi này là miễn phí.

Chúc các bạn thành công.


Nguồn: xenforo.com​
 

Hướng dẫn sử dụng

XenForo 1 XenForo 2
Translate by PVS

Dịch vụ XenForo của VNXF

Mobile/Zalo: 0906081284

Telegram: anhanhxf

Chỉ nhận web nội dung lành mạnh

Nhà Tài Trợ

Mút Xốp Không Gian
Mút Sofa Không Gian
Top Bottom