Solution to register_globals=off & existing code???

From: Date: Wed, 03 Jul 2002 18:24:00 +0000
Subject: Solution to register_globals=off & existing code???
Groups: php.general 
Request: Send a blank email to php-general+get-105257@lists.php.net to get a copy of this message
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

« previous php.general (#105257) next »