TRIVIAL!- Extra assigment of $_POST

Problems with the Windows version of XAMPP, questions, comments, and anything related.

TRIVIAL!- Extra assigment of $_POST

Postby AAA123 » 27. April 2013 21:25

While moving on the old php scripts working with Apache1.3 and php4.3
-> to the XAMPP (apache2.4 php5) - the following problem arose.
In (XAMPP) a simple php script containing a form and sending your entries
back to the script I have to load them again with the predefined variables $ _GET or $ _POST

Code: Select all
       $enterd_value = $_POST['enterd_value'];     <---- is it really needed ?
   if ($enterd_value)
     echo "$enterd_value";
   else
     print '<FORM action="script.php" method="POST">';
     print '<INPUT type="text" name="entered_value">';
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: TRIVIAL!- Extra assigment of $_POST

Postby Moore » 28. April 2013 06:48

Hi, sounds like you may have had 'Register Globals' enabled in php 4, which is generally considered a bad practice since it can potentially allow ANYONE to create/inject their own global variables into your scripts, not just you.

You can find lots of documentation on how to emulate Register Globals. Just keep in mind this 'feature' has been removed from PHP altogether for good reasons..

Warning
This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.


More info:
http://php.net/manual/en/security.globals.php
http://www.php.net/manual/en/faq.misc.php#faq.misc.registerglobals
http://en.wikibooks.org/wiki/PHP_Programming/Register_Globals
http://www.reddit.com/r/PHP/comments/13gdmb/so_i_found_out_register_globals_on_is_bad_now_my/

And more good advice:
http://community.apachefriends.org/f/viewtopic.php?f=16&t=43608&p=171052#p171058

This might be useful too (migrating from php4 to php5):
http://www.php.net/manual/en/migration5.php
Moore
 
Posts: 2
Joined: 27. April 2013 08:42
XAMPP Version: 5.6.3
Operating System: Windows 7 SP1 | XP SP3

Re: TRIVIAL!- Extra assigment of $_POST

Postby AAA123 » 28. April 2013 08:00

Thank you - I understand that the assignment is needed to have $entered_value not empty.
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 60 guests