2

Recently I downloaded 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.

Mehdi Raash
  • 8,721
  • 2
  • 29
  • 42

4 Answers4

6

There is this code in system/core/Input.php on line 728:

<?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.

Change exit('Disallowed Key Characters.');

to 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.

hope it helps

Lawrence Cherone
  • 46,049
  • 7
  • 62
  • 106
  • Thanks , I do have another question, I wanna upload my files on the internet, Will every firefox has this problem?(I mean, the people who uses FF) – Mehdi Raash Jul 15 '12 at 12:53
  • 1
    Uploading should not be a problem (dont trouble trouble till trouble troubles you) ;p No once you assign proper correct code, eg no illegal chars you should be fine. Thx for the accept. – Lawrence Cherone Jul 15 '12 at 13:06
  • 1
    p.s. you should NEVER edit the core files - always extend them with your changes instead – Laurence Jul 15 '12 at 14:25
  • Thanks for pointing out at the cookie .. there was a cookie with name set as http://*_sdcbjhsbdjc_csdcb which was failing the preg_match .. – mjs Mar 20 '14 at 09:29
1

The answer lies in your browser cookies. I found this entry in mine

'instance0|ab'

Maybe its in your browser. Delete all your cookies and make sure they are gone.

blackmambo
  • 152
  • 1
  • 2
  • 16
0

I had similar problem, I cleared all the cookie and then relaunch. Site worked correctly. It may happen because of poorly formed cookie. Hopefully it helps someone..

Dilip Rajkumar
  • 7,006
  • 6
  • 60
  • 76
0

I was having the same error!

There is the code in system/core/Input.php on line 729.

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 :)

Reza Mamun
  • 5,991
  • 1
  • 43
  • 42