PHP: if register_globals: Off

On 12-14-2004, in Coding, PHP, by Alex

Some guys created project and uploaded it to server.
Their dev. server has register_globals: On.
Production server has register_globals: Off.
Good start, isn’t it?
Thanks to one of my friends for his help with this small script (put it just after session_start())

if (count($_REQUEST) > 0) {
        foreach ($_REQUEST as $key => $value) {
                if (is_array($_REQUEST[$key])) {
                        foreach ($_REQUEST[$key] as $key2 => $value) {
                                ${$key}[$key2] = trim($value);
                        }
                } else {
                        ${$key} = trim($value);
                }
        }
}

And enjoy your beer.

 

Comments are closed.