Welcome Guest, Not a member yet? Register   Sign In
POST Data Problem
#1

hey guys,

we experienced a problem.
We've an input field which looks like
Code:
<input type="text" name="sku[206300.076000][15721][0]" value="" />

after submitting the form with CI
the output is the following
PHP Code:
Array
(
 
   [sku] => Array
 
       (
 
           [0] => Array
 
               (
 
                   [15721] => Array
 
                       (
 
                           [0] => asdfasdf
                        
)

 
               )

 
       )



if i do this without CI it shows

PHP Code:
Array
(
 
   [sku] => Array
 
       (
 
           [206300.076000] => Array
 
               (
 
                   [15721] => Array
 
                       (
 
                           [0] => asdfasdf
                        
)

 
               )

 
       )



As you can see CI replaces the name containing a dot with a 0.

I see in the documentation "Filters the GET/POST/COOKIE array keys, permitting only alpha-numeric (and a few other) characters."
Can i add some additional characters which i need ?

As a background notice:
We have a B2B Shop System built on CI and our client hast shifted from an older MS Dynamics NAV to the new 2015 Version. Somehow they  support product numbers with dots and so on, and our cart module works with this numbers.
Reply
#2

if anyone stumbles into this problem i fixed it relatively easy

Put  a MY_Input class into the application/core directory and overwrite the Input Class with your desired rule

PHP Code:
class MY_Input extends CI_Input
{
    protected function 
_clean_input_keys($str$fatal TRUE)
    {
        if ( ! 
preg_match('/^[a-z0-9.:_\/|-]+$/i'$str))
        {
            if (
$fatal === TRUE)
            {
                return 
FALSE;
            }
            else
            {
                
set_status_header(503);
                echo 
'Disallowed Key Characters.';
                exit(
7); // EXIT_USER_INPUT
            
}
        }

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

        return 
$str;
    }


Reply




Theme © iAndrew 2016 - Forum software by © MyBB