Petre:

On Tue, Aug 13, 2002 at 03:18:42PM +0200, Petre Agenbag wrote:
>
> I have register_golbals = on, BUT, I want to find a way to code that I
> know will always work, regardless of register_globals or cookies, so
> that I am only dependant on the trans-sid ( but If I could rule that out
> too, it would be even better)

This example assumes the machine is running PHP >= 4.1.0 allowing use of
$_SESSION rather than $HTTP_SESSION_VARS.  Adjust as needed.

  session_start();

  if ( !isset($SessionID) ) {
     #  This likely means that register globals is off.
     #  So, loop through the session vars and create regular vars.
     while ( list($Key, $Val) = each($_SESSION) ) {
        $$Key = $Val;
     }
  }

Enjoy,

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409

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

Reply via email to