Google
 

音樂分享 - 「君がいるから」by 江口一聲

2007年5月2日 星期三

PHP5 ... register_globals Off 之前的程式都不能用了

php4.1.2 起,更改 register_globals off (php.ini)

register_globals boolean

Whether or not to register the EGPCS (Environment, GET, POST, Cookie, Server) variables

as global variables.

As of PHP 4.2.0, this directive defaults to off.

Please read the security chapter on Using register_globals for related information.

Please note that register_globals cannot be set at runtime (ini_set()). Although, you

can use .htaccess if your host allows it as described above. An example .htaccess entry:

php_flag register_globals off.

注: register_globals is affected by the variables_order directive.

This directive was removed in PHP 6.0.0.


關於使用 register_globals On 的風險,請參考
PHP: Using Register Globals - Manual
Address : <http://tw.php.net/manual/tw/security.globals.php>




取得變數可改用以下方式宣告。
建議只用 POST ,以免有 sql injecktion 的風險。
while(list($key, $value) = each($_GET))
{
${$key} = $value;
}

while(list($key, $value) = each($_POST))
{
${$key} = $value;
}

沒有留言: