Jump to content

Php form


soupy1985

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/235846-php-form/#findComment-1212345
Share on other sites

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

 

 

Link to comment
https://forums.phpfreaks.com/topic/235846-php-form/#findComment-1212355
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.