[PHP] Solution to register_globals=off existing code???
Hi Already posted a question asking what to do with existing code that uses register_globals=on and migrating to a new PHP with register_globals=off; solution seemed to be have to re-code; I came up with this code, and am basically asking the more enlightened if this might be a solution, ie, plug this code in at the top of all form action pages written with the old style... It's crude, so be nice. if (isset($HTTP_POST_VARS)) { $type = $HTTP_POST_VARS; } elseif (isset($HTTP_GET_VARS)) { $type = $HTTP_GET_VARS; } foreach ($type as $key = $val) { $string = \$$key = \$val\;; eval($string); } If this will help, can it be written into a function? Is there a more elegant way of doing the same?Will this actually work? Ta Petre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Solution to register_globals=off existing code???
Or just use extract($HTTP_POST_VARS); Same thing. :) -Kevin - Original Message - From: PHPCoder [EMAIL PROTECTED] To: php-general [EMAIL PROTECTED] Sent: Wednesday, July 03, 2002 12:24 PM Subject: [PHP] Solution to register_globals=off existing code??? Hi Already posted a question asking what to do with existing code that uses register_globals=on and migrating to a new PHP with register_globals=off; solution seemed to be have to re-code; I came up with this code, and am basically asking the more enlightened if this might be a solution, ie, plug this code in at the top of all form action pages written with the old style... It's crude, so be nice. if (isset($HTTP_POST_VARS)) { $type = $HTTP_POST_VARS; } elseif (isset($HTTP_GET_VARS)) { $type = $HTTP_GET_VARS; } foreach ($type as $key = $val) { $string = \$$key = \$val\;; eval($string); } If this will help, can it be written into a function? Is there a more elegant way of doing the same?Will this actually work? Ta Petre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Solution to register_globals=off existing code???
DOH! Now you tell me!!! :-[ Hah, thanks man, should have known that there is always a simple solution in PHP, just need to know where to look for it... Kevin Stone wrote: Or just use extract($HTTP_POST_VARS); Same thing. :) -Kevin - Original Message - From: PHPCoder [EMAIL PROTECTED] To: php-general [EMAIL PROTECTED] Sent: Wednesday, July 03, 2002 12:24 PM Subject: [PHP] Solution to register_globals=off existing code??? Hi Already posted a question asking what to do with existing code that uses register_globals=on and migrating to a new PHP with register_globals=off; solution seemed to be have to re-code; I came up with this code, and am basically asking the more enlightened if this might be a solution, ie, plug this code in at the top of all form action pages written with the old style... It's crude, so be nice. if (isset($HTTP_POST_VARS)) { $type = $HTTP_POST_VARS; } elseif (isset($HTTP_GET_VARS)) { $type = $HTTP_GET_VARS; } foreach ($type as $key = $val) { $string = \$$key = \$val\;; eval($string); } If this will help, can it be written into a function? Is there a more elegant way of doing the same?Will this actually work? Ta Petre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Solution to register_globals=off existing code???
Or just use import_request_variables(). You can do all of them at once. It's only in PHP 4.1.0, though. www.php.net/import_request_variables ---John Holmes... - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: php-general [EMAIL PROTECTED] Sent: Wednesday, July 03, 2002 2:33 PM Subject: Re: [PHP] Solution to register_globals=off existing code??? Or just use extract($HTTP_POST_VARS); Same thing. :) -Kevin - Original Message - From: PHPCoder [EMAIL PROTECTED] To: php-general [EMAIL PROTECTED] Sent: Wednesday, July 03, 2002 12:24 PM Subject: [PHP] Solution to register_globals=off existing code??? Hi Already posted a question asking what to do with existing code that uses register_globals=on and migrating to a new PHP with register_globals=off; solution seemed to be have to re-code; I came up with this code, and am basically asking the more enlightened if this might be a solution, ie, plug this code in at the top of all form action pages written with the old style... It's crude, so be nice. if (isset($HTTP_POST_VARS)) { $type = $HTTP_POST_VARS; } elseif (isset($HTTP_GET_VARS)) { $type = $HTTP_GET_VARS; } foreach ($type as $key = $val) { $string = \$$key = \$val\;; eval($string); } If this will help, can it be written into a function? Is there a more elegant way of doing the same?Will this actually work? Ta Petre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php