97久久国产亚洲精品超碰热,成人又色又爽的免费网站,色偷偷女人的天堂a,男女高潮喷水在线观看,国内精品一线二线三线区别在哪里

Discuz! 官方交流社區(qū)

標(biāo)題: discuz由3.4升級到3.5 注冊總是提示用戶名包含敏感字符 [打印本頁]

作者: eyuyi    時間: 2025-10-2 22:01
標(biāo)題: discuz由3.4升級到3.5 注冊總是提示用戶名包含敏感字符
如題,將論壇從3.4升級到3.5utf8版本后,現(xiàn)在注冊填入任何用戶名都提示 用戶名包含敏感字符。uc通信正常

作者: 天外飄仙    時間: 2025-10-3 07:17
這個 只能具體檢查一下看看了;

能接受有償處理的話 可以加我 QQ
作者: 鴻茂傳媒    時間: 2025-10-3 12:19
如果這個情況,只能根據(jù)提示用戶名包含敏感字符的單獨(dú)的修改了。
作者: eyuyi    時間: 2025-10-5 16:46
經(jīng)過對頁面分析,應(yīng)該是uc_client和uc_server下model的user模塊中關(guān)于用戶名判定check_username的代碼有點(diǎn)兼容問題。
源代碼如下:
  1. function check_username($username) {
  2.                 $charset = strtolower(UC_CHARSET);
  3.                 if ($charset === 'utf-8') {
  4.                         $guestexp = '\xE3\x80\x80|\xE6\xB8\xB8\xE5\xAE\xA2|\xE9\x81\x8A\xE5\xAE\xA2';
  5.                 } elseif ($charset === 'gbk') {
  6.                         $guestexp = '\xA1\xA1|\xD3\xCE\xBF\xCD';
  7.                 } elseif ($charset === 'big5') {
  8.                         $guestexp = '\xA1\x40|\xB9\x43\xAB\xC8';
  9.                 } else {
  10.                         return FALSE;
  11.                 }
  12.                 $guestexp .= '|^Guest';

  13.                 $len = $this->dstrlen($username);
  14.                 if($len > 15 || $len < 3 || preg_match("/\s+|^c:\\con\\con|[%,\*"\s\<\>\&\(\)']|$guestexp/is", $username)) {
  15.                         return FALSE;
  16.                 } else {
  17.                         return TRUE;
  18.                 }
  19.         }
復(fù)制代碼
應(yīng)該是對游客(簡寫繁寫)、guest、以及特殊字符進(jìn)行判斷,看是否有敏感的。既然代碼兼容問題,考慮utf8一個漢字占3個字符,給做了修改
  1. function check_username($username) {
  2.     // 1. 長度檢查
  3.     $len = $this->dstrlen($username);
  4.     if($len > 21 || $len < 3) {
  5.         return FALSE; // 長度不符合要求
  6.     }
  7.    
  8.     // 2. 游客關(guān)鍵詞檢查(直接字符串匹配,更可靠)
  9.     $charset = strtolower(UC_CHARSET);
  10.     $isGuest = false;
  11.    
  12.     // 檢查簡繁體"游客"
  13.     if (strpos($username, '游客') !== false || strpos($username, '遊客') !== false) {
  14.         $isGuest = true;
  15.     }
  16.    
  17.     // 檢查全角空格(不同編碼)
  18.     if ($charset === 'utf-8' && strpos($username, ' ') !== false) { // UTF-8全角空格
  19.         $isGuest = true;
  20.     } elseif ($charset === 'gbk' && strpos($username, chr(0xA1).chr(0xA1)) !== false) { // GBK全角空格
  21.         $isGuest = true;
  22.     } elseif ($charset === 'big5' && strpos($username, chr(0xA1).chr(0x40)) !== false) { // Big5全角空格
  23.         $isGuest = true;
  24.     }
  25.    
  26.     // 檢查Guest開頭(不區(qū)分大小寫)
  27.     if (stripos($username, 'Guest') === 0) {
  28.         $isGuest = true;
  29.     }
  30.    
  31.     if ($isGuest) {
  32.         return FALSE; // 包含游客相關(guān)內(nèi)容
  33.     }
  34.    
  35.     // 3. 特殊字符檢查
  36.     $specialChars = ['%', ',', '*', '"', '<', '>', '&', '(', ')', "'", ' ', "\t", "\r", "\n"];
  37.     foreach ($specialChars as $char) {
  38.         if (strpos($username, $char) !== false) {
  39.             return FALSE; // 包含特殊字符
  40.         }
  41.     }
  42.    
  43.     // 4. 檢查系統(tǒng)特殊名稱
  44.     if (strtolower($username) === 'c:\\\\con\\\\con') {
  45.         return FALSE;
  46.     }
  47.    
  48.     // 所有檢查通過
  49.     return TRUE;
  50. }
復(fù)制代碼
測試通過。
當(dāng)然,因?yàn)閷﹂L度進(jìn)行了擴(kuò)充,所以數(shù)據(jù)庫中member相應(yīng)的兩個表中,要對username的字段長度將15變成21





歡迎光臨 Discuz! 官方交流社區(qū) (http://r615.cn/) Powered by Discuz! X5.0