最新消息:非无江海志,潇洒送日月

Discuz您当前的访问请求当中含有非法字符,已经被系统拒绝解决办法

网站建设 江海志 7518浏览 0评论
很多同学升级到discuz x3.1的20131122版本后出现您当前的访问请求当中含有非法字符,已经被系统拒绝的问题,IIS服务器是正常的,其他服务器有可能会出现上面的提示,如果你遇到了可以参考下面的解决方法来修复:
打开文件131122   source\class\discuz\discuz_application.php搜索一下打开
350行左右

  1. private function _xss_check() {
  2. static $check = array(‘”‘, ‘>’, ‘<‘, ‘\”, ‘(‘, ‘)’, ‘CONTENT-TRANSFER-ENCODING’);
  3. if(isset($_GET[‘formhash’]) && $_GET[‘formhash’] !== formhash()) {
  4. system_error(‘request_tainting’);
  5. }
  6. if($_SERVER[‘REQUEST_METHOD’] == ‘GET’ ) {
  7. $temp = $_SERVER[‘REQUEST_URI’];
  8. } elseif(empty ($_GET[‘formhash’])) {
  9. $temp = $_SERVER[‘REQUEST_URI’].file_get_contents(‘php://input’);
  10. } else {
  11. $temp = ”;
  12. }
  13. if(!empty($temp)) {
  14. $temp = strtoupper(urldecode(urldecode($temp)));
  15. foreach ($check as $str) {
  16. if(strpos($temp, $str) !== false) {
  17. system_error(‘request_tainting’);
  18. }
  19. }
  20. }
  21. return true;
  22. }

复制代码

代替为131011   source\class\discuz\iscuz_application.php    private function _xss_check()

350行左右

  1. private function _xss_check() {
  2. $temp = strtoupper(urldecode(urldecode($_SERVER[‘REQUEST_URI’])));
  3. if(strpos($temp, ‘<‘) !== false || strpos($temp, ‘”‘) !== false || strpos($temp, ‘CONTENT-TRANSFER-ENCODING’) !== false) {
  4. system_error(‘request_tainting’);
  5. }
  6. return true;
  7. }

复制代码

转载请注明:江海志の博客 » Discuz您当前的访问请求当中含有非法字符,已经被系统拒绝解决办法

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址