Re: Re: Using sessions with register globals off

From: Date: Thu, 05 Feb 2004 21:45:33 +0000
Subject: Re: Re: Using sessions with register globals off
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-176938@lists.php.net to get a copy of this message
On Thu, Feb 05, 2004 at 02:32:49PM -0500, Phillip Jackson wrote: > it's this easy with register_globals off: > > $_SESSION['order'] = "someValue"; > > no need to name the session. > > ~Phillip > > > "John Nichel" <jnichel@by-tor.com> wrote in message > news:40227C27.6040009@by-tor.com... > > Randall Perry wrote: > > > > > Ok, with register globals on, this works ('order' being a php object): > > > > > > session_name('name'); > > > session_register('order'); > > > > > > $order->print_something(); > > > > > > With with register globals off, this fails: > > > session_name('name'); > > > $order = $_SESSION['order']; > > > > > $order->print_something(); > > > > > > Get the errors: > > > PHP Notice: Undefined variable: _SESSION > > > PHP Fatal error: Call to undefined function: print_something() > > > Meaning the _SESSION arr is not recognized and the $order obj variable > has > > > not been passed. > > > > > > What am I missing? > > > > Where do you assign $_SESSION['order'] a value? > > > Everyone in this thread has forgotten to mention the all important 'start_session();' command. Without that, you do not have access to your session variables. -- Jim Kaufman Linux Evangelist public key 0x6D802619 http://www.linuxforbusiness.net --- Life is not one thing after another.... It's the same damn thing over and over!

« previous php.general (#176938) next »