RE: two php scripts with same $_SESSION variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24 May 2007 13:22, Jean-Christophe Roux wrote:

> Hello,
> 
> Thank you for the answers. The issue is that the same codes
> are in folders A and B. When they are run from two different
> browsers, I am getting the behavior I 'd like to see with two
> session ids being created and therefore no sharing of
> $_SESSION variables.  But when the two apps are opened inside
> the same browser, the $_SESSION variables are shared and that
> makes sense because session_id() returns the same value. It
> would be be nice that when the app in A is running and the
> user starts the app in B, in the same browser widow, the
> server and php are instructed to realize that this is a brand
> new session and assign a new session_id() which would solve
> my problem. Is there  a way to achieve that?

I think that what you want is a different session *name* for each application.

To get this, just call session_name() with the appropriate value immediately before every session_start().  For example, for the files in A you could use:

   session_name('SESSID_A');
   session_start();

whilst those in B would have:

   session_name('SESSID_B');
   session_start();

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 812 4730          Fax:  +44 113 812 3211 


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux