开发者

PHP: Server duplicating $_SESSION['Name'] data to '$Name' variable

开发者 https://www.devze.com 2022-12-19 09:32 出处:网络
I\'ve just disc开发者_开发问答overed a setting on the server I\'m developing a site for that is different from my localhost settings, however, I can\'t track down where to change it.

I've just disc开发者_开发问答overed a setting on the server I'm developing a site for that is different from my localhost settings, however, I can't track down where to change it.

Here's a simple example of what's happening.

$_SESSION['Animal'] = "Dog";
echo "#1: ".$_SESSION['Animal']."<br/>";
echo "#2: ".$Animal;

On my localhost, the server returns:

#1: Dog

#2:

On the public host, the server returns:

#1: Dog

#2: Dog

I'm guessing this is a setting in the public servers php.ini file, however, I cannot locate which setting it is.


The Registered Globals directive appears to be on.

This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.

Information about the register_globals ini setting

As indicated by the statement above, it is highly recommended that you disable this in your php.ini file on your public server.

If you don't have access to the php.ini file on your public server, the manual suggests an alternative:

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 .


OH NO! Your host has register_globals turned on, that's bad - have a look at these docs

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号