psmith Posted January 26, 2008 Share Posted January 26, 2008 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!! @extract($_SERVER); if($_SERVER["REQUEST_URI"]=="/condos.php?id=resort"){ header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.myrtlebeachcondosdirect.com/condos.php?barefoot_resort"); exit(); } 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 (p.id=q.gallery_id) 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! Quote Link to comment https://forums.phpfreaks.com/topic/87867-conversion-help-with-register_globals/ Share on other sites More sharing options...
marcus Posted January 26, 2008 Share Posted January 26, 2008 register globals aren't very safe, i say keep them off and stick with using the first example. Quote Link to comment https://forums.phpfreaks.com/topic/87867-conversion-help-with-register_globals/#findComment-449511 Share on other sites More sharing options...
psmith Posted January 26, 2008 Author Share Posted January 26, 2008 Do you mean to say that the first statement is set to properly work with register_globals OFF, but the second statement is still wrong? If so I am looking for help to convert the incorrect statement. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/87867-conversion-help-with-register_globals/#findComment-449514 Share on other sites More sharing options...
marcus Posted January 26, 2008 Share Posted January 26, 2008 Correct. $id would be $_GET['id'] or $_POST['id'] etc.. replace the $ with $_GET, $_POST, $_SERVER, etc... and just bracket-ize it. Quote Link to comment https://forums.phpfreaks.com/topic/87867-conversion-help-with-register_globals/#findComment-449521 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.