You are here: Re: different between session_id and session_name « All PHP « IT news, forums, messages
Re: different between session_id and session_name

Posted by J.O. Aho on 01/02/08 09:58

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация