Re: RE:[PHP] sessions...how to use not clear?
| From: | John W. Holmes | Date: | Tue, 23 Mar 2004 00:34:35 +0000 |
| Subject: | Re: RE:[PHP] sessions...how to use not clear? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181203@lists.php.net to get a copy of this message | ||
Andy B wrote:
[snip] 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. [end snip] well this is true but in the event that the server creates a default name for that particular session (very large random strings). I am trying to avoid running into the same session being used twice by 2 seperate people at the same time.I think you're confusing session_name and session_id. session_name is (generally) the same for everyone and is the name PHP uses in the cookie or URL to store the session_id. The session_id is a 128 bit, 32 character code that uniquely (sp?) identifies your individual session. You do not have to worry about two users getting the same session_id unless you just have a tremendous amount of traffic or have extended the session life.
so the theory is: if i require that the session be named after the persons login name there is probably 1 out of 2 million chances that it will mess up the names and get confused (specially if there are only a few users allowed)...I think I get what you're saying here. In the very remote chance that two people get the same session_id, you're saying that at least they'll have different session_names, so there won't be any contention? I don't think so, though, as the default session handler for PHP bases the name of the file to hold the session data on the session_id. It doesn't use the session_name for anything knowing what cookie or URL variable to retrieve the session_id from. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com