PDA

View Full Version : PHP variables arn't working for you? read this.


DirectAdmin Support
06-22-2003, 03:06 PM
Hello,

This is just a note to all php users, that by default, registerglobals is set to off. What this means is that if you have a php page, when you run:

page.php?name=gary

$name will *not* hold the value of gary in your script. What you need to do is use the $_GET array:

$_GET['name']

(or $_POST['name'] if you've passed it via POST)

This is something that php.net is pushing towards, as registerglobals=on can be a security risk if the scripts are programmed poorly.

If you *must* have it on, then contact your host and have him change the php.ini to turn it on.

John

loopforever
06-22-2003, 05:02 PM
Keeping registerglobals on is for wimps ;). Real men validate where their input is coming from, so people don't fsck up their websites :)!

StingRay
06-22-2003, 09:05 PM
I agree 100% keep it off by default. Server is more secure that way which means less headache for the admin.

However, like any good programmer I'm lazy. If I come across a good script that I want to use but it's got bad programming, I'm not gonna spend a few days fixing it, I might need to use it right away. Plus that would be a lot like work.

So to fix it JUST for that script. Simply put a .htaccess in the directory that the script is in, that has a line like this:

php_value register_globals 1

bor
06-30-2003, 11:01 AM
some customers want to have Register_global 'on'. How can I do that?

ProWebUK
06-30-2003, 11:56 AM
put a file in their HTML directory named .htaccess and put the following line in it:

php_value register_globals 1

Chris