简体   繁体   English

带有Firefox的CodeIgniter和不允许的关键字符

[英]CodeIgniter with Firefox and Disallowed Key Characters

Recently I downloaded codeIgniter 2.1.1. 最近,我下载了codeIgniter 2.1.1。 I droped the CI files on my wamp on windows 7, After that simply I opened up firefox and type localhost and I saw this message "Disallowed Key Characters" But, I do not have this problem with Chrome and Opera. 我将CI文件放到Windows 7的Wamp上,此后,我简单地打开了firefox并键入localhost,然后看到此消息“ Disallowed Key Characters”,但Chrome和Opera没有这个问题。

There is this code in system/core/Input.php on line 728: 在第728行的system/core/Input.php有以下代码:

<?php 
/**
    * Clean Keys
    *
    * This is a helper function. To prevent malicious users
    * from trying to exploit keys we make sure that keys are
    * only named with alpha-numeric text and a few other items.
    *
    * @access   private
    * @param    string
    * @return   string
    */
function _clean_input_keys($str)
{
    if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
    {
        exit('Disallowed Key Characters.');
    }

    // Clean UTF-8 if supported
    if (UTF8_ENABLED === TRUE)
    {
        $str = $this->uni->clean_string($str);
    }

    return $str;
}
?>

It checks the keys in key=>value pairs eg: example.com?key=value if your key is not within the range of a-z0-9:_/- it will throw that error. 它会检查key => value对中的键,例如:example.com?key=value如果您的键不在a-z0-9:_/-范围内,则会抛出该错误。

Change exit('Disallowed Key Characters.'); 更改exit('Disallowed Key Characters.');

to exit('Disallowed Key Characters.'.$str); exit('Disallowed Key Characters.'.$str); to give you an idea about what key is at fault. 让您了解什么钥匙出了故障。 Remember this perhaps is checking cookies through $_REQUEST/$_COOKIE so its also a good idea to clear your cookies, perhaps from an older script or version on the same path. 请记住,这也许是通过$_REQUEST/$_COOKIE检查cookie,所以清除cookie也是一个好主意,也许是从同一路径上的旧脚本或版本清除。

hope it helps 希望能帮助到你

The answer lies in your browser cookies. 答案在于您的浏览器cookie。 I found this entry in mine 我在我的地方找到了这个条目

'instance0|ab'

Maybe its in your browser. 也许在您的浏览器中。 Delete all your cookies and make sure they are gone. 删除所有cookie,并确保它们不存在。

I had similar problem, I cleared all the cookie and then relaunch. 我遇到了类似的问题,我清除了所有cookie,然后重新启动。 Site worked correctly. 网站正常工作。 It may happen because of poorly formed cookie. 它可能是由于Cookie格式不正确而发生的。 Hopefully it helps someone.. 希望它可以帮助某人..

I was having the same error! 我有同样的错误!

There is the code in system/core/Input.php on line 729. 在第729行的system / core / Input.php中有代码。

Just adding a '.' 只需添加一个“。” and '|' 和'|' will allow to pass: 将允许通过:

if ( ! preg_match("/^[a-z0-9:_\/\-\.|]+$/i", $str)) 

This worked for me on my windows localhost with a sub-directory setup :) 这在我的Windows本地主机上具有子目录设置对我有用:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM