Re: sessions...how to use not clear?
| From: | John W. Holmes | Date: | Mon, 22 Mar 2004 22:35:45 +0000 |
| Subject: | Re: sessions...how to use not clear? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181169@lists.php.net to get a copy of this message | ||
From: "Andy B" <aborka1@wmis.net>
> From what I understand about sessions you can
> give a session a particular name like doing:
> session_start("SessionName");
You can give it a name, but you don't have to. PHP will use the default name
if you don't and you'll just need to use session_start();
> So in practicle means I can do this:
> <?php /*file #1*/
> session_start($name);
> $_SESSION[name]=$name;
> $_SESSION[email]=$email;
> /*.....*/
> ?>
>
> now my question is this: will i have to declare
> session_start($name); at the top of every file that
> needs to use that session name?
If you give the session a custom name, then, yes, you'll have to use that
name on every page. $name can be something that in an include file or a
constant, etc, though. Again, you don't _have_ to give a name, though.
There's no real advantage to using another name, though, as it's going to be
sent to the user in a cookie or the URL, anyhow.
---John Holmes...