Home  >  Article  >  Backend Development  >  Analysis of solutions to the error Request var not allow! when adding variables in DedeCMS

Analysis of solutions to the error Request var not allow! when adding variables in DedeCMS

黄舟
黄舟Original
2017-04-01 09:37:301451browse

This article mainly introduces the solution to the error Request var not allow! when DedeCMS adds variables. This article gives a method to modify the PHP file. If you really can’t solve the problem, you can try this article. The method, friends in need can refer to it Many people on the forum have reported that the "Request var not allow!" bug will appear when adding new variables in the background. This article mainly introduces how to solve this problem! Let’s look at the specific operations:
Open the include/common.inc.php file in the DEDE root directory and find the following content:

The code is as follows:

//检查和注册外部提交的变量
function CheckRequest(&$val) {
if
 (is_
array
($val)) {
foreach
 ($val as $_k=>$_v) {
CheckRequest($_k); 
CheckRequest($val[$_k]);
}
} 
else
{
if( 
strlen
($val)>0 && preg_match('#^(cfg_|GLOBALS)#',$val) )
{
exit('Request var not allow!');
}
}
}


Replace the above content with the following content:

Copy code

//检查和注册外部提交的变量 
function CheckRequest(&$val) {
if (is_array($val)) {
foreach ($val as $_k=>$_v) {
if($_k == 'nvarname') 
continue
;
CheckRequest($_k); 
CheckRequest($val[$_k]);
}
} else
{
if( strlen($val)>0 && preg_match('#^(cfg_|GLOBALS)#',$val) )
{
exit('Request var not allow!');
}
}
}

dedecms template download address: m.sbmmt.com /xiazai/code/dedecms

After modification, save it and then go to the background to try adding new variables.

The above is the detailed content of Analysis of solutions to the error Request var not allow! when adding variables in DedeCMS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn