devxtec Posted July 30, 2008 Share Posted July 30, 2008 I have a PHP Script which uses a body id to to identify the data that needs to be loaded on the page, The body id is passed through the URL of the web page ( http://www.example.com/index.php?bod=22 ) This bod value is then picked up by the PHP script and used to pull the correct data from the MySQL database. When I moved the website from a server running MySQL 4 & PHP 4 to a server running MySQL 5 & PHP 5 it broke the site. To verify that it was the bod ID not being passed I had the site echo out the current bod id when switching between pages. Each time it would echo out a blank value which the site then interprets to load up the default page content. My question is would the bod id not being passed be an apache problem or a PHP issue? Here is the index.php code which checks for the bod id. <?php require_once("DSI_website.php"); $site = new DSISite( "www.example.com", "localhost" ); if( isset($bod) ) { $site->Generate_Page($bod); } else { $site->Generate_Page(); } echo $site->page; ?> And here is the Generate Page function. Function Generate_Page( $page_index="default" ) { $this->page = ""; $this->page .= $this->Start_Page(); $this->page .= $this->Output_Header(); $this->page .= $this->Output_Links(); $this->page .= "<div id=\"sub\">\n"; $this->page .= $this->Output_Ads(); $this->page .= $this->Output_Body( $page_index ); $this->page .= "</div>\n"; $this->page .= $this->Output_Footer(); $this->page .= $this->Finish_Page(); } Any help is greatly appreciated. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted July 30, 2008 Share Posted July 30, 2008 Instead of just using $bod, your going to have to probably use $_GET['bod']. Quote Link to comment Share on other sites More sharing options...
unkwntech Posted July 30, 2008 Share Posted July 30, 2008 Those variables in the URL are called GET variables and must be accessed as $_GET['varName'] Quote Link to comment Share on other sites More sharing options...
devxtec Posted July 30, 2008 Author Share Posted July 30, 2008 Thanks for the help. Once you both said to use $_GET['bod'] it was like a light bulb coming on in my head. I'm shocked I didn't realize that. Anyway I put that in place and had it set to the value of $bod and it's working now. Again thanks everyone! Quote Link to comment Share on other sites More sharing options...
revraz Posted July 30, 2008 Share Posted July 30, 2008 Sounds like your old site had register_globals on. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 30, 2008 Share Posted July 30, 2008 And the sad thing about this is register_globals were turned off in php 6 years ago in 2002 and no code should have been written after that point in time that relied on them being on. There are going to be a lot of unhappy people and a lot of work fixing code when php6 comes out. 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.