Web Hosting Talk







View Full Version : PHP: problem with variables


zahid
12-25-2004, 09:39 AM
Hi,

I am unable to access POST and GET variables directly, like $abc
Everytime i need to use $HTTP_GET_VARS['abc'] or $_GET['abc'], while few scripts use direct variables and it is not easy to replace all variables.

how can i configure PHP to allow these direct variables?

Thanks,
Zahid

laserlight
12-25-2004, 09:45 AM
Since PHP 4.1, register_globals in php.ini has been set to Off by default. This is to avoid the potential security problem of 'poisoning' of incoming variables by users.

You could change php.ini to set register_globals to On, but generally it is better to use the $_* superglobal arrays, e.g. $_GET as you have mentioned.

You could also extract($_GET) if you cant change php.ini, but that will suffer from the same potential security problem and should not give you superglobal variables.

zahid
12-25-2004, 10:06 AM
Thanks :) problem solved.