soupy1985 Posted May 8, 2011 Share Posted May 8, 2011 Hello, I have changed hosting and now my site has stopped working, all php forms have stopped submitting, also pages where i have page mode, for example: page.php?mode=script. Any ideas? It is probably something simple. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/235846-php-form/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 8, 2011 Share Posted May 8, 2011 Any ideas? Yes, php.net put in some brilliant lazy-way short-cuts in the early versions of php that proved brilliant (several provided security holes that hackers can use) and they have just about all been turned off by default, the setting that is likely causing your problem was turned off 9 years ago, so that they can eventually be removed from the language. However, a lot of web hosting and php programmers never updated their settings and code to match the recommendations from php.net. Your code likely thinks that program variables, i.e $var, will magically get set from the actual $_GET, $_POST, $_COOKIE, $_FILES, $_SESSION, $_SERVER, and $_ENV variable where the data is at. You need to either add code to set your program variables from the correct $_GET, $_POST, $_COOKIE, $_FILES, $_SESSION, $_SERVER, and $_ENV variables where the data is coming from or you need to use the actual $_GET, $_POST, $_COOKIE, $_FILES, $_SESSION, $_SERVER, and $_ENV variables in your code. If your form is using the POST method, your form data will be available in $_POST variables. In the case of your GET parameters on the end of the URLs, the data will be available in $_GET variables. Quote Link to comment https://forums.phpfreaks.com/topic/235846-php-form/#findComment-1212345 Share on other sites More sharing options...
soupy1985 Posted May 8, 2011 Author Share Posted May 8, 2011 What's the best way to sort out the page mode? Have you got a link for php.net? Both servers are using the same php version. Do you know what setting it would be thats turned off? Many thanks. Quote Link to comment https://forums.phpfreaks.com/topic/235846-php-form/#findComment-1212348 Share on other sites More sharing options...
PFMaBiSmAd Posted May 8, 2011 Share Posted May 8, 2011 It's a safe bet that your code was not written over 9 years ago. Whoever wrote it should have been aware of this problem and should not have written code dependent on the setting. The reason I didn't mention the setting name is so you wouldn't be tempted to turn it on, since it is going to be removed in the next major php version release (should that ever occur.) You must eventually fix your code. Why not do that now so that your code will work on any server? For a link like page.php?mode=script, you would use $_GET['mode'] in your code to reference the value. $mode = $_GET['mode']; // set the program variable $mode from the GET parameter on the end of the url Quote Link to comment https://forums.phpfreaks.com/topic/235846-php-form/#findComment-1212355 Share on other sites More sharing options...
soupy1985 Posted May 8, 2011 Author Share Posted May 8, 2011 Many Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/235846-php-form/#findComment-1212360 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.