OK, this is an odd request, and it might not even be fully true… but I’m upgrading someone’s system … and they are using OSCommerce (from a long time ago).
It appears their variables are referrenced without a dollar sign in front of them (which is new to me). I haven’t done PHP in about 7 years, and I’ve always used dollar signs.
Is there a setting that I can throw in PHP 5 that says to assume these are variables?
Example:
mysql_connect(DB_SERVER, DB_UserName, DB_Password);
in my day, that would be:
mysql_connect($DB_Server, etc, etc);
Their site has THOUSANDS of files… no I don’t want to go put dollar signs in front of everything.
HELP!
Thanks,
3
Answers
You can use constants.
I believe OSCommerce actually DEFINES these values, so the usage is correct (without the $).
Look for
or something similar.
In other words, do not go through and update these with a $ before if they’re actually defined constants.
If i remember correctly a big difference is the lack of ‘register_globals’ being default to ‘ON’. You might need to change a lot of instances here $var should be $_REQUEST[‘var’] or the appropriate $_GET/$_POST super globals.
And as far as constants are concerned you should access them as such:
This avoids PHP assuming that MY_CONSTANT is a string if the constant is not defined.