At 11:02 AM +0000 1/23/11, Ashley Sheridan wrote:
On Sun, 2011-01-23 at 09:21 +0100, Thijs Lensselink wrote:

 Hash: SHA1

 On 01/23/2011 07:33 AM, Paul M Foster wrote:
 > Storing any sort of login/auth data in cookies has regularly been panned
 > on this list. The preference seems to be to store whatever login/auth
 > information *must* be stored in the $_SESSION variable.
 > Well and good. My problem, however, is that I have multiple applications
 > in different tabs running on the same server, which may all use the same
 > sub-variables, like "username". As a result, they run into each other.
 > One application will think I'm logged in when I'm not logged in to that
 > application, but to another in the same browser on the same box.
 > So my question is how to prevent this using the standard PHP functions
 > relating to sessions. I'd like different applications in different tabs
 > on the same box/browser to have different sessions, so they don't share
 > data.
 > Thoughts?
 > > Paul

You can of course use arrays in your session as well:

$_SESSION['app_name'] = Array(
    'username' => 'John',
    'user_id' => 1234,
    'some other info' => 'another string',

I use this on my localhost sometimes, as it can be easier running tests
and stuff than having to create a whole new host entry for it in my
config files!



Ash's method is a good one.

You might also consider using uniqid() to create a unique ID for your users and then use that ID for determining which user is which instead of using username.




PHP General Mailing List (
To unsubscribe, visit:

Reply via email to