新聞中心
Discuz!x3.1升級到20131122后,退出登錄時出現(xiàn)出現(xiàn)“您當(dāng)前的訪問請求當(dāng)中含有非法字符“解決方法
Discuz論壇每次升級都是會夾雜著或多或少的bug的,這些都是從客戶日常使用中反饋給官方,然后官方再進(jìn)行解決處理,使得程序更加的完善,功能也越多。
這次DiscuzX3.1升級到20131122版本后,確實也出現(xiàn)了一些小bug,比如今天無憂主機(jī)小編要講的登陸退出提示:“您當(dāng)前的訪問請求當(dāng)中含有非法字符”,如下圖所示:
[caption id="attachment_13662" align="alignnone" width="901"] discuz論壇報錯[/caption]
解決方案如下:
在文件\source\class\discuz的discuz_application.php中
查找以下代碼:
private function _xss_check() {
static $check = array('"', '>', '<', '\'', '(', ')', 'CONTENT-TRANSFER-ENCODING');
if(isset($_GET['formhash']) && $_GET['formhash'] !== formhash()) {
system_error('request_tainting');
}
if($_SERVER['REQUEST_METHOD'] == 'GET' ) {
$temp = $_SERVER['REQUEST_URI'];
} elseif(empty ($_GET['formhash'])) {
$temp = $_SERVER['REQUEST_URI'].file_get_contents('php://input');
} else {
$temp = '';
}
if(!empty($temp)) {
$temp = strtoupper(urldecode(urldecode($temp)));
foreach ($check as $str) {
if(strpos($temp, $str) !== false) {
system_error('request_tainting');
}
}
}
return true;
}
替換為:
private function _xss_check() {
$temp = strtoupper(urldecode(urldecode($_SERVER['REQUEST_URI'])));
if(strpos($temp, '<') !== false || strpos($temp, '"') !== false || strpos($temp, 'CONTENT-TRANSFER-ENCODING') !== false) {
system_error('request_tainting');
}
return true;
}
或者使用官方提供的替換文件。
discuz_application.zip
直接解壓上傳到\source\class\discuz目錄下,替換老的discuz_application.php文件即可
相關(guān)文章推薦閱讀:
DISCUZ X3.1論壇用戶退出后點擊清除痕跡出錯“您當(dāng)前的訪問請求當(dāng)中含有非法字符,已經(jīng)被系統(tǒng)拒絕”
本文地址:http://m.love62.cn/discuz/13658.html
![1](/wp-content/themes/starow_z/img/o-1.png)
![1](/wp-content/themes/starow_z/img/o-2.png)
![1](/wp-content/themes/starow_z/img/o-3.png)
![1](/wp-content/themes/starow_z/img/o-4.png)
![1](/wp-content/themes/starow_z/img/o-5.png)
![1](/wp-content/themes/starow_z/img/o-6.png)
![1](/wp-content/themes/starow_z/img/o-7.png)