Re: newbie@session - please help!

From: Date: Wed, 04 Apr 2001 03:48:34 +0000
Subject: Re: newbie@session - please help!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-46961@lists.php.net to get a copy of this message
In your code, if $PHPSESSID is set then you'll need to invoke session_start() anyway. session_start() initializes all session variables to what they should be so that you can access them. Note: If someone submits the variable $name which is "Ted", and in their session they have a variable called $name which equals "Bob", then the following will end up weird: $name1 = $name; session_start(); $name2 = $name; session_start declares all session variables as global, and it over-writes any pre-existing variables of the same name. -- Plutarck Should be working on something... ...but forgot what it was. ""David Tandberg-Johansen"" <david@datajo.no> wrote in message news:9aaumn$o69$1@toye.p.sourceforge.net... > Hello! > > After confering with the this group earlier I got some hints on where to > find som tutorials on sessions. But I am still confused about some things. > > Have I under stood it right: > > > #session.php > > <? > if (!$PHPSESSID) { > > session_start(); > > #Then if some variables to register > session_register(lang); > session_register(name); > > setcookie (PHPSESSID, $PHPSESSID,time()+3600); > setcookie (lang, $lang,time()+3600); > setcookie (name, $name,time()+3600); > > } elseif ($PHPSESSID) { > > #I DON'T HAVE A CLUE TODO HERE, ANY HINTS? > > } > > ?> > > #END session.php > > And then I include the session.php in all the files I need to use session > in? > And I can get the variables from the cookie? > > David > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#46961) next »