Forum Moderators: coopster
Is there a quick and simple way of making such a script work without register globals when you are not familiar with the code?
I'm aware of the security implications too, which is why I would like to turn off register globals. The script itself is invisible to the end user as it uses mod_rewrite to generate static .htm URLs.
foreach($_GET AS $key => $value) {
${$key} = $value;
}
etc...
The only thing here is that it still presents you with the same security issue as having register globals enabled. The key to securing your application is making sure that the input data is properly cleaned and that all other variables are initialized to some starting value; if you think the application meets these precautions then you should have nothing to worry about. :)
I would only consider this a "quick fix" to get it working, can you alter the script yourself to make it work without register_globals enabled?
[webmasterworld.com...]
... perhaps just set it for that directory only is a quick solution (as you stated, you are already aware of security implications).
you could add it at the script level, or if there are a ton of scripts then slip it into a global include, then you can work script by script to correct it.
if you need to extract more than one superglobal then make you you do them in the same order as they would have been extracted with globals on. This way you make sure that all variable collisions are the same as they were previously.
I have the advantage of some good security-by-obscurity, the generated pages don't have a .php extension, and PHP is not exposed in the server response.
Is it hopeless without having to disassemble the script so as to identify the problems? I'm going to start by attempting to emulate register globals on with the following script:
[webmasterworld.com...]