PHP variables arn't working for you? read this.

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,035
PHP variables aren't working for you? Read this.

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

Verified User
Joined
May 30, 2003
Messages
298
Location
/home/admin
Keeping registerglobals on is for wimps ;). Real men validate where their input is coming from, so people don't fsck up their websites :)!
 

StingRay

Verified User
Joined
Jun 19, 2003
Messages
12
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

New member
Joined
Jun 26, 2003
Messages
2
some customers want to have Register_global 'on'. How can I do that?
 

ProWebUK

Verified User
Joined
Jun 9, 2003
Messages
2,326
Location
UK
put a file in their HTML directory named .htaccess and put the following line in it:

php_value register_globals 1

Chris
 
Top