You are here: Re: Help, strange message from host « All PHP « IT news, forums, messages
Re: Help, strange message from host

Posted by NC on 01/25/06 20:48

Roddytoo wrote:
>
> (message)
> This is to let you know that as from 1 Feb 2006 the setting
> "register_globals" in php will be disabled.

Let's say you have a script that is called like this:

script.php?parameter=somevalue

With register_globals = On, PHP will automatically create a variable
called $parameter and assign a value "somevalue" to it. With
register_globals = Off, no such thing will take place; the parameter
will only be accessible as $_GET['parameter']. Similar things will
happen with parameters sent via POST method (they will only be
available as fields in the $_POST array).

The quick (and EXTREMELY dirty) fix for this is to add the following
line to the beginning of every problematic script:

extract($_REQUEST);

This will essentially do what PHP does automatically when
register_globals = On.

A better (and more labor-intensive) way to handle the situation is to
make sure the scripts are written assuming register_globals = Off.
They will still work even if register_globals = On, because the
superglobal variables ($_GET, $POST, etc.) remain accessible regardless
of the register_globals setting...

Cheers,
NC

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация