* Thus wrote stfmoreau ([EMAIL PROTECTED]):
> Hi,
> 
> include this code in your header file :
>       // _GET
>       if (isset($_GET))
>               while (list($key, $val) = each($_GET))
>               {
>                       eval ("$".$key." = '".$val."';");
>               }
>       // _POST
>       if (isset($_POST))
>               while (list($key, $val) = each($_POST))
>               {
>                       eval ("$".$key." = '".$val."';");
>               }
>       // _SESSION
>       if (isset($_SESSION))
>               while (list($key, $val) = each($_SESSION))
>               {
>                       eval ("$".$key." = '".$val."';");
>               }
> It may works (I have not expirimence it)

You can shorten it down a bit:
if (isset($_REQUEST) ) {
  foreach($_REQUEST as $key => $val) {
    $$key = $val;
  }
}

I'm not sure if session is there but I know the $_REQUEST has all GET,
POST and COOKIE vars. Of course this isn't completely compatible with
how register_globals works.  There is GPC ordering of where to get the
variables from.

$GPC = "GPC"
for($i = 0; i < strlen($GPC); $i++) {
  switch($GPC{$i}) {
    case 'G': $VAR = '_GET'; break;
    case 'P': $VAR = '_POST'; break;
    case 'C': $VAR = '_COOKIES'; break;
  }
  if (isset($$VAR) ) {
    foreach($$VAR as $key => $val) {
      eval("global $$key"); //make it global if this is in a function
      $$key = $val;         //set value
    }
  }
}

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to