当前位置:首页 > CMS教程 > Discuz > 列表

Discuz! System Error 您当前的访问请求当中含有非法字符

发布:smiling 来源: PHP粉丝网  添加日期:2014-12-05 10:45:42 浏览: 评论:0 

Discuz! X3.1 正式版含目前最新版[2014-03-01]在用户退出时偶尔会提示如下错误,Discuz! System Error 您当前的访问请求当中含有非法字符,已经被系统拒绝错误解决,下面我们就来看此问题的解决办法.

Discuz! X3.1 正式版含目前最新版[2014-03-01]在用户退出时偶尔会提示如下错误,特别是数据整合后的站点.

错误代码:

Discuz! System Error 您当前的访问请求当中含有非法字符,已经被系统拒绝.

  1. PHP Debug 
  2. [Line: 0022]search.php(discuz_application->init) 
  3. [Line: 0071]sourceclassdiscuzdiscuz_application.php(discuz_application->_init_misc) 
  4. [Line: 0552]sourceclassdiscuzdiscuz_application.php(discuz_application->_xss_check) 
  5. [Line: 0355]sourceclassdiscuzdiscuz_application.php(system_error) 
  6. [Line: 0017]sourcefunctionfunction_core.php(discuz_error::system_error) 
  7. [Line: 0024]sourceclassdiscuzdiscuz_error.php(discuz_error::debug_backtrace)

临时解决方法:

修改 sourceclassdiscuz下的discuz_application.php文件大约第350行的private function _xss_check()方法,代码如下:

  1. private function _xss_check() { 
  2.  
  3. static $check = array('"', '>', '<', ''', '(', ')', 'CONTENT-TRANSFER-ENCODING'); 
  4.  
  5. if(isset($_GET['formhash']) && $_GET['formhash'] !== formhash()) { 
  6. system_error('request_tainting'); 
  7. } 
  8.  
  9. if($_SERVER['REQUEST_METHOD'] == 'GET' ) { 
  10. $temp = $_SERVER['REQUEST_URI']; 
  11. } elseif(emptyempty ($_GET['formhash'])) { 
  12. $temp = $_SERVER['REQUEST_URI'].file_get_contents('php://input'); 
  13. } else { 
  14. $temp = ''; 
  15. } 
  16.  
  17. if(!emptyempty($temp)) { 
  18. $temp = strtoupper(urldecode(urldecode($temp))); 
  19. foreach ($check as $str) { 
  20. if(strpos($temp, $str) !== false) { 
  21. system_error('request_tainting'); 
  22. } 
  23. } 
  24. } 
  25.  
  26. return true; 
  27. } 
  28. //为 
  29. private function _xss_check() { 
  30. $temp = strtoupper(urldecode(urldecode($_SERVER['REQUEST_URI'])));//开源软件:phpfensi.com 
  31. if(strpos($temp, '<') !== false || strpos($temp, '"') !== false || strpos($temp, 'CONTENT-TRANSFER-ENCODING') !== false) { 
  32. system_error('request_tainting'); 
  33. } 
  34. return true; 
  35. }

Tags: Discuz非法字符 System Error

分享到: