Resolve Discuz3.2 The "Your current access request contains illegal characters" method

Source: Internet
Author: User
Tags php code php debug

Error Tip:

discuz! System Error

Your current access request contains illegal characters and has been rejected by the system
PHP Debug

[Line:0022]search.php (Discuz_application->init)
[Line:0071]source/class/discuz/discuz_application.php (Discuz_application->_init_misc)
[Line:0552]source/class/discuz/discuz_application.php (Discuz_application->_xss_check)
[Line:0355]source/class/discuz/discuz_application.php (System_error)
[Line:0023]source/function/function_core.php (Discuz_error::system_error)
[Line:0024]source/class/discuz/discuz_error.php (discuz_error::d ebug_backtrace)

Discuz The official solution:

Program directory download modify discuz_application.php code. Location: \source\class\discuz discuz_application.php
Find
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;
}

To be replaced by:

 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;
       }
After the replacement, discuz the background update cache to see if it solves the problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.