Discuz! 您当前的访问请求当中含有非法字符,已经被系统拒绝 解决方法
摘要: 今天沭阳web在百度里面site了手里的一个网站,查询了下该网站收录和排名情况,在向后面翻了几页后,发现该网站的收录里面出现了以下的问题,而且再向后翻页的时候,出现很多,下面是出现问题的截图:那么打开该网页 ...
今天沭阳web在百度里面site了手里的一个网站,查询了下该网站收录和排名情况,在向后面翻了几页后,发现该网站的收录里面出现了以下的问题,而且再向后翻页的时候,出现很多,下面是出现问题的截图:
1、查找 \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;
}
2、查询source/language/lang_message.php,下载下面的压缩包,解压覆盖原路径的文件,更新缓存即可
lang_message.zip
那么打开该网页又出现了下面的页面:
该问题的绝体故障描述:退出登录时出现“您当前的访问请求当中含有非法字符,已经被系统拒绝”错误,那么下面和大家分享下两种解决的办法:1、查找 \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;
}
2、查询source/language/lang_message.php,下载下面的压缩包,解压覆盖原路径的文件,更新缓存即可
lang_message.zip