Conversion help with register_globals

Hi all,

I’m quite novice with php but have been charged with trying to update some code so it will work properly when my client has register_globals set to “Off” in the near future. Here is two snippets of existing code… Can anyone please supply me with the correct way to do this so it will work when he changes over?
Thanks so much!!

    header("HTTP/1.1 301 Moved Permanently");

and that if statement continues…

And another spot in the same file:

if($id=='resort' || isset($barefoot_resort))
$query = "select * from client_content_html where content_name='Barefoot Resort'";
$photo_query="select q.image_thumb as thumbnail,q.image_large as photo from photo_gallery p inner join photo_gallery q on ( where p.title='Barefoot Resort' and p.gallery_id=0";

And again, the if statement continues but I’ve only included the first example.

I think if I get help with the first one the rest will come easily. Thanks so much!

I presume you’ve been reading up on what register_globals does and why it has been turned off in recent versions of PHP? It is very important to realize why this extremely dramatic (and much criticized) measurement was taken. I’m not sure just how ‘novice’ you are and my apologies if I’m explaining things that you already know about, but I suggest learning about the superglobals $_GET, $_POST, $_SERVER, etc. Like the normal variables used now, they’ll contain the information passed on from a form or URL query string (or cookies for example). When testing your script after editing it and turning off register_globals, be sure to use error_reporting(E_ALL) to make sure any discrepancy is reported.

Sponsor our Newsletter | Privacy Policy | Terms of Service