解决方案如下:
首先,找到文件路径:\\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!系统中与第三方接口交互时出现的问题。如果您还有其他疑问或需要进一步的帮助,请随时联系技术支持团队。