Page 1 of 1

sinister problem with mediaeval code

Posted: Fri Nov 03, 2006 12:02 am
by titaniumdoughnut
Apologies in advance for proving what a hopeless noob I am, and not using the correct terminology for anything.

In ye olden days of PHP I could go to a url like page.php?image=3 and a variable called $image would work just fine in the page. Now all my sites have been upgraded to a more advanced host, and this doesn't work anymore. I need to use $_POST["image"] and all that. Is there any way, for the hapless programmer like me, who didn't see this coming, to avoid recoding every page on every site I run? That's a severely depressing prospect.

Any sort of automatic feature or custom function that I can plop down in the beginning of each page to take URL-passed variables and generate real ones from that array with the names they would be expected to have?

Thanks in advance, O PHP Gods.

Posted: Fri Nov 03, 2006 3:15 am
by volka

Posted: Fri Nov 03, 2006 11:09 am
by RobertGonzalez
Wouldn't that be the same as having register globals on for that particular script? Honestly, and I know it sounds like something you don't want to hear, I would suggest you update your code to reflect a register_globals=Off state.

Posted: Fri Nov 03, 2006 11:28 am
by aaronhall
ini_set() might work too, but like Everah said, it's best that register_globals is off.

Posted: Sun Nov 05, 2006 4:30 pm
by titaniumdoughnut
Oh yeah... I do hate to hear that, but I know it's true. Eventually I'll go through all these sites making them compliant, but for now, these look like good workarounds. Cheers guys.