different between session_id and session_name

different between session_id and session_name

am 02.01.2008 09:02:41 von Fairul Izham

This is a multi-part message in MIME format.

------=_NextPart_000_007F_01C84D58.E724AB60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Sorry for the newbie,

is any one know the different between session_id() and session_name()?

I have 2 websites in same server.

But sometimes when the 1st website changes the session_id() using =
session_regenerate_id() then the 2nd website still follow the 1st =
website current session_id().

No problem when using different browser. But have this problem when =
using tab or new window in IE / Mozzila browser.=20


Regards,

Fairul Izham Bin Mohd Mokhlas
------=_NextPart_000_007F_01C84D58.E724AB60
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



charset=3Dunicode">

style=3D"PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px"=20
bgColor=3D#ffffff leftMargin=3D0 topMargin=3D0 CanvasTabStop=3D"true"=20
name=3D"Compose message area">

Sorry for the newbie,

 

is any one know the different between =
session_id()=20
and session_name()?

 

I have 2 websites in same =
server.

 

But sometimes when the 1st website =
changes the=20
session_id() using session_regenerate_id() then the 2nd website still =
follow the=20
1st website current session_id().

 

No problem when using different =
browser. But have=20
this problem when using tab or new window in IE /=20
Mozzila browser.



Regards,

Fairul =
Izham Bin=20
Mohd Mokhlas


------=_NextPart_000_007F_01C84D58.E724AB60--

Re: different between session_id and session_name

am 02.01.2008 10:58:10 von Shion

Fairul Izham wrote:
> Sorry for the newbie,
>
> is any one know the different between session_id() and session_name()?

If you had read the online documentation you would know that session_id is the
random generated string, while session_name is the name of the cookie in where
the session_id is stored on the visitors browser (in case you use cookie,
which you seem to do from your description).


> But sometimes when the 1st website changes the session_id()
> using session_regenerate_id() then the 2nd website still follow
> the 1st website current session_id().

This for you use the same domain, and you can "always" access your own domains
cookies no matter if it's "site a" or "site b".


Do the following:
session_name('site_a');
session_start();

And on the other one:
session_name('site_b');
session_start();

Now the two "sites" will use different cookies to store the session id and
they can work as two independent entities.

See:
http://www.php.net/manual/en/function.session-name.php


--

//Aho