Connecting Tech Pros Worldwide Forums | Help | Site Map

Quick Session Question

Jason Telisch
Guest
 
Posts: n/a
#1: Jul 16 '05
I read and reread the PHP manual about sessions, and I have a quick
question. What causes the session id to change? I tried destroying the
session and unsetting the session vars, but it maintains the same id.

Just so you know, I don't need to make the session id change for any
reason. I'd just like to know what to avoid since I'm going to be storing
data the user enters with their sessionid and I'd like to make sure that
they can still access it through their entire visit.

Kevin Thorpe
Guest
 
Posts: n/a
#2: Jul 16 '05

re: Quick Session Question


Jason Telisch wrote:[color=blue]
> I read and reread the PHP manual about sessions, and I have a quick
> question. What causes the session id to change? I tried destroying the
> session and unsetting the session vars, but it maintains the same id.
>
> Just so you know, I don't need to make the session id change for any
> reason. I'd just like to know what to avoid since I'm going to be storing
> data the user enters with their sessionid and I'd like to make sure that
> they can still access it through their entire visit.[/color]

The session id shouldn't change. It's randomly generated when the user
enters your website and is then passed back by the browser using cookies
or as part of the url on each subsequent request. This id is then used
as the key to the session variables.

Destroying the session variables simply destroys the contents of the
session. The id and the empty session will continue to exist.

Michiel
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Quick Session Question


Kevin Thorpe wrote:[color=blue]
> Jason Telisch wrote:
>[color=green]
>> I read and reread the PHP manual about sessions, and I have a quick
>> question. What causes the session id to change? I tried destroying
>> the session and unsetting the session vars, but it maintains the same id.
>>
>> Just so you know, I don't need to make the session id change for any
>> reason. I'd just like to know what to avoid since I'm going to be
>> storing data the user enters with their sessionid and I'd like to make
>> sure that they can still access it through their entire visit.[/color]
>
>
> The session id shouldn't change. It's randomly generated when the user
> enters your website and is then passed back by the browser using cookies
> or as part of the url on each subsequent request. This id is then used
> as the key to the session variables.
>
> Destroying the session variables simply destroys the contents of the
> session. The id and the empty session will continue to exist.
>[/color]

So, when the client deletes the cookie, the session id will be lost. If
the client continues to visit the site, he will receive a new cookie
with a new session id.

Closed Thread