rachae1 Posted May 17, 2014 Share Posted May 17, 2014 (edited) Hi I am hoping someone can help.My hosting company has just moved my website to a different server, and I noticed that it was giving me blank pages, I added in some debug and now I am getting undefined variable errors and I don't know why or how to fix it.The Page which has broken currently gets its information from the database from the url.RewriteRule ^reviews/([^/]*)\/$ /bingosite.php?h1=$1 [L]The code in the broken page that is throwing out undefined variable errors is the following:<? $query = mysql_query("SELECT * FROM link where linktype='bingo' and h1 ='".StripUrl101(ucwords($h1))."'"); { while($row =mysql_fetch_assoc($query)) extract($row);?><? if ($linkType=="bingo") { ?><?php echo "$h1"; ?><? } } ?>I have used this code for years so it could be that it is old but as I only know basic PHP I am very stuck and the hosting company isn't being very helpful. Just to add if I write <? $query = mysql_query("SELECT * FROM link where linktype='bingo' and h1 ='Quick Bingo'"); { while($row =mysql_fetch_assoc($query)) extract($row);?>The results for Quick Bingo appear on the page. However it needs to work dynamically like it was doing before.If anyone can help it would be appreciated.ThanksRachael Edited May 17, 2014 by rachae1 Quote Link to comment Share on other sites More sharing options...
rachae1 Posted May 17, 2014 Author Share Posted May 17, 2014 Hi I have fixed it needed to get the variable which is something I had never needed to do before. I think register_globals was set to OFF. Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted May 17, 2014 Share Posted May 17, 2014 I think register_globals was set to OFF. That is what it should of been in the first place (and should of never existed). It has been disabled by default since 4.2.0 which was release over 14 years ago! Instead you need to get the input from the corresponding superglobal variable Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted May 17, 2014 Share Posted May 17, 2014 way back in php4.1 (December 2001), php introduced the superglobals - $_POST, $_GET, $_COOKIE, ... in php4.2 (April of 2002), they turned register_globals off by default, because programmers were expected to start using the superglobal variables to access external data. register_globals being on started throwing deprecated errors in php5.3 (June 2009), and have been completely removed in php5.4 (March 2012.) turning register globals on is at best a stop-gap measure since they have been removed from php versions starting over two years ago. time to update your code to use $_GET['h1'] to access values supplied in the url query string. Quote Link to comment 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.