sinister problem with mediaeval code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
titaniumdoughnut
Forum Commoner
Posts: 33
Joined: Wed Jul 13, 2005 2:02 pm
Location: Manhattan

sinister problem with mediaeval code

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

ini_set() might work too, but like Everah said, it's best that register_globals is off.
User avatar
titaniumdoughnut
Forum Commoner
Posts: 33
Joined: Wed Jul 13, 2005 2:02 pm
Location: Manhattan

Post 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.
Post Reply