PDA

View Full Version : Parameters in URL being ignored?


mothra
09-29-2007, 07:39 PM
On my development machine any parameters that I pass in URL's are being ignored (for example mypage.php?foo=x). Everything works fine on the webserver. It must be a configuration difference (?).

mothra
09-29-2007, 07:43 PM
Nevermind... register globals was off on my dev box. Problem solved.

Mwnciau
09-29-2007, 07:45 PM
How are you getting the parameters?


$var = $_GET['foo'];
// or
$var = $foo;


If register globals is disabled the latter won't work.

Edit: Too late...

You shouldn't really use register globals, it can open up security holes in your scripts.

mothra
09-29-2007, 09:55 PM
You shouldn't really use register globals, it can open up security holes in your scripts.


I know, bad habit. This particular site has a lot of development using the pre-php4 settings. Some day I'll update all the scripting...

CFMaBiSmAd
09-29-2007, 10:54 PM
Even if register_globals are on, you should not be writing any code that relies on them.

As long as you have php 4.1 or higher, you should be using $_GET to access URL parameters and if someone is using a php version earlier than that they should reconsider their version upgrade schedule as the end of life for php4 is the end of this year.