其实说到底还是个字符编码转换问题。

因为汉字没有在判断uid值时出现了错误,导致系统无法识别用户,所以发生了“你访问的用户可能已经被删除!”错误

方法是
在“member\config.php”文件的最后,PHP结束之前添加 isUTF8($str)函数

代码如下:
function isUTF8($str){
$length=strlen($str);
for($i=0;$i<$length;$i++){
$high=ord($str{$i});
if(($high==0xC0)||($high==0xC1)){
return false;
}elseif($high<0x80){
continue;
}elseif($high<0xC0){
return false;
}elseif($high<0xE0){
if(++$i>=$length)
return true;
elseif(($str{$i}&”\xC0″)==”\x80″)
continue;
}elseif($high<0xF0){
if(++$i>=$length){
return true;
}elseif(($str{$i}&”\xC0″)==”\x80″){
if(++$i>=$length)
return true;
elseif(($str{$i}&”\xC0″)==”\x80″)
continue;
}
}elseif($high<0xF5){
if(++$i>=$length){
return true;
}elseif(($str{$i}&”\xC0″)==”\x80″){
if(++$i>=$length){
return true;
}elseif(($str{$i}&”\xC0″)==”\x80″){
if(++$i>=$length)
return true;
elseif(($str{$i}&”\xC0″)==”\x80″)
continue;
}
}
}
return false;
}
return true;
}

然后修改“member\index.php”中的代码:将

代码如下:
$tmpstr = @gb2utf8($uid);
$tmpstr2 = @utf82gb($tmpstr);
if($tmpstr2==$uid) $uid = $tmpstr;

修改为

代码如下:
if(!isUTF8($uid)) $uid = @gb2utf8($uid);

问题解决。

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。