How can I change 'register_globals' with no access to php.ini ?
I use a web hosting company ,I can not access php.ini. May I change it with php code?
Thanks
How can I change 'register_globals' with no access to php.ini ?
I use a web hosting company ,I can not access php.ini. May I change it with php code?
Thanks
Are you trying to turn it on? If so, I suggest you learn to work with it off, and forget the endeavor. If you are trying to turn it off, then push the webhosting company into turning it off, because having it on is dangerous. Either way, I don't think you can do it without editing the php.ini file directly. (That would also be a potentially dangerous thing)
First, ask yourself, "do I really want to do this? Twice.
Get a large plastic object, like a spatula. Hit yourself in the head six times.
Ask yourself, "Do I really, really, really need to do this? Why can't I just code it correctly?
If you still need to do this, then search the site. There are multiple hacks for this.
One I've tried:
foreach ($_GET as $key=>$value) {
$$key=$value;
}
foreach ($_POST as $key=>$value) {
$$key=$value;
}
foreach ($_COOKIE as $key=>$value) {
$$key=$value;
}
if ($_SESSION) {
foreach ($_SESSION as $key=>$value) {
$$key=$value;
}
}
Put it in a common include, or auto_prepend file...
Just for completeness: it can be changed in ".htaccess" file (if ".htaccess is allowed by your host), or (under the right server setup) in per-directory "php.ini" files.
Hopefully you will heed the advice from TheDefender and mshen: don't turn "register_globals" on.
Originally posted by dalecosp
One I've tried:
foreach ($_GET as $key=>$value) { $$key=$value; } ...
[/b]Also achievable by [man]extract[/man].
But I too vote for Defender's answer. (If you're trying to turn it off, then see if Installer's suggestion is doable. If you're trying to turn it on, then you should fix your code instead.)