开发dz插件后台提示错误 本帖最后由 tv2014001 于 2014-09-12 10:14:03 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 请贴出你提交后php页面获取的$_SERVER['REQUEST_URI']应该是有特殊字符,<,“,CONTENT-TRANSFER-ENCODING 这个说不清楚,只能看你的$_SERVER['REQUEST_URI']这个值抛出错误的位置在source\class\discuz\discuz_application.php,里面有个_xss_check()的私有方法,你自己看一下吧 $_SERVER['REQUEST_URI']这个值/admin.php?action=plugins&operation=config&do=23&identifier=baoming&pmod=fabu X2.5测试没问题,请查看你的_xss_check()方法,在source\class\discuz\discuz_application.php是否如下所示,若不是,请替换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; } <form id="form" name="form" method="post" action="plugin.php?id=baoming:fabu&a=post" e是不是这的事 好像是 formhash 发送说是接受有错误 应该是formhash的问题,因为原来的_xss_check()方法是要验证formhashprivate 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;}所以,让你改为X2.5的_xss_check()方法试试 在前台也得验证formhash,怎么就可以通过,到了后台就不行了呢 呃...能力有限,没研究过,也没遇到过而且,根据discuz的报错,我在X2.5的discuz_application.php的_init_misc方法中没有找到执行_xss_check()的代码不知道你的版本是多少若是低版本就将discuz_application.php这个文件覆盖一下试试 无论如何非常感谢jam00 结贴给分 json_decode遇到特殊字符无法解析,返回空,该怎么解决? 点号的疑惑 如何实现网页弹小窗口 请问这用的是什么函数? 求一关联,无论左关联为空值,或者右关联为空值,都能显示出来。 while的问题 我数据表里面有五个记录,为什么循环出来的不是横的,怎么是竖的呢?有什么办法搞成横的呢? 急救!在php怎么调用delphi的dll文件(在线等) 急 help 对象引用问题 正则表达式 PHP 数组转化成字符串
应该是有特殊字符,<,“,CONTENT-TRANSFER-ENCODING
抛出错误的位置在source\class\discuz\discuz_application.php,里面有个_xss_check()的私有方法,你自己看一下吧
是否如下所示,若不是,请替换
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;
}
是不是这的事
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;
}
所以,让你改为X2.5的_xss_check()方法试试
而且,根据discuz的报错,我在X2.5的discuz_application.php的_init_misc方法中没有找到执行_xss_check()的代码
不知道你的版本是多少
若是低版本就将discuz_application.php这个文件覆盖一下试试