Re: [PHP-DB] Two session for the same user, possible?

2004-10-22 Thread Micah Stevens

You can have two scripts talking to the same browser session by setting 
different session cookie names. Depending on which script is being loaded it 
will look at a different cookie to find out the session ID, once again, I 
have not tried it, but there is no reason why it wouldn't work, and not 
require option 1, 2 or 3 as Chris mentions below. 

-Micah 


On Friday 22 October 2004 12:55 pm, Chris Gregors wrote:
 The session information is bound to the users computer and the browser
 they use.

 option 1: user logs into app using a different computer (2 laptops)
 option 2: user logs into app using a different browser (ie and firefox)
 option 3: sessions have a lifetime of one screen (aka no session
 persistance).

 I use option 1,2 all the time. One session is godly and the second
 session is a luser session.

 c

 -Original Message-
 From: Micah Stevens [mailto:[EMAIL PROTECTED]
 Sent: Thursday, October 21, 2004 5:54 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Two session for the same user, possible?



 p.s. you can also designate a session ID. If you do this you may be able
 to
 have two sessions running concurrently. Never tried it myself, but it
 should
 work.

 -Micah

 On Thursday 21 October 2004 02:03 pm, Micah Stevens wrote:
  The Session ID is the same, so it will access the same variables. If

 you

  want to force a new session in the new script, do this:
 
  http://us2.php.net/manual/en/function.session-regenerate-id.php
 
  But this will in effect log the user out of the first session as well.

 If

  you want to be able to do both, I suggest you use different names for

 your

  session vars.
 
  -Micah
 
  On Thursday 21 October 2004 12:39 pm, Andre Matos wrote:
   Hi Matt,
  
   I have developed two different web systems that use php sessions.

 When I

   a user log into one system, the system creates a session and storage

 on

   it one object called UserSession with some information that I need

 while

   the user works with the system.
  
   My problem is when the user decides to open the second system

 without log

   out from the first one that he logged, using a new window (crtl+N)

 from

   the same browser. This second system creates also an object called
   UserSession, but with different properties and this new object from

 the

   second system overwrites the object from the first system. This is

 my

   problem. Can I make PHP understand that this is a complete different
   session?
  
   Thanks.
  
   Andre
  
   --
   Andre Matos
   [EMAIL PROTECTED]
  
   -Original Message-
   From: Matt M. [mailto:[EMAIL PROTECTED]
   Sent: Thursday, October 21, 2004 3:23 PM
   To: Andre Matos
   Cc: [EMAIL PROTECTED]
   Subject: Re: [PHP-DB] Two session for the same user, possible?
  
Is it possible to have two sessions for the same user in php? If

 yes,

how can I implement this?
   
I am currently using one without problem. However, when I try to

 create

a second session, the first one is lost.
  
   could you post some code.  I am not sure I follow what you are

 doing.

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



Re: [PHP-DB] Two session for the same user, possible?

2004-10-21 Thread Matt M.
 Is it possible to have two sessions for the same user in php? If yes, how
 can I implement this?
 
 I am currently using one without problem. However, when I try to create a
 second session, the first one is lost.

could you post some code.  I am not sure I follow what you are doing.

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



RE: [PHP-DB] Two session for the same user, possible?

2004-10-21 Thread Norland, Martin
There is only the one $_SESSION superglobal in PHP - and session_start
doesn't take any parameters - so the builtin sessions in PHP undoubtedly
aren't anticipating a need for this.  If you are just trying to store
more data - you shouldn't have a problem, just use $_SESSION as an array
like normal, and for each application use a named key as its own array.

e.g. instead of using $_SESSION['username'] in both of two applications,
use
$_SESSION['first_session']['username'] and
$_SESSION['second_session']['username']
or something similar in each.

I assume the reason you're encountering some sort of problem is because
you have two canned applications that both conflict with session
variables, or you want to run the same application twice?  The sessions
are tied to the hostname - so if you make a virtual server with another
address (e.g. www.something.com and app.something.com or equivalent) you
will, in effect, get your two sessions.

Beyond this, I'd need to know more of what you're intending to be of any
help.

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Andre Matos [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 21, 2004 2:20 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Two session for the same user, possible?


Hi List,

Is it possible to have two sessions for the same user in php? If yes,
how can I implement this?

I am currently using one without problem. However, when I try to create
a second session, the first one is lost.

Thanks for any help.

Andre

--
Andre Matos
[EMAIL PROTECTED] 

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

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



Re: [PHP-DB] Two session for the same user, possible?

2004-10-21 Thread Micah Stevens

p.s. you can also designate a session ID. If you do this you may be able to 
have two sessions running concurrently. Never tried it myself, but it should 
work.

-Micah 

On Thursday 21 October 2004 02:03 pm, Micah Stevens wrote:
 The Session ID is the same, so it will access the same variables. If you
 want to force a new session in the new script, do this:

 http://us2.php.net/manual/en/function.session-regenerate-id.php

 But this will in effect log the user out of the first session as well. If
 you want to be able to do both, I suggest you use different names for your
 session vars.

 -Micah

 On Thursday 21 October 2004 12:39 pm, Andre Matos wrote:
  Hi Matt,
 
  I have developed two different web systems that use php sessions. When I
  a user log into one system, the system creates a session and storage on
  it one object called UserSession with some information that I need while
  the user works with the system.
 
  My problem is when the user decides to open the second system without log
  out from the first one that he logged, using a new window (crtl+N) from
  the same browser. This second system creates also an object called
  UserSession, but with different properties and this new object from the
  second system overwrites the object from the first system. This is my
  problem. Can I make PHP understand that this is a complete different
  session?
 
  Thanks.
 
  Andre
 
  --
  Andre Matos
  [EMAIL PROTECTED]
 
  -Original Message-
  From: Matt M. [mailto:[EMAIL PROTECTED]
  Sent: Thursday, October 21, 2004 3:23 PM
  To: Andre Matos
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Two session for the same user, possible?
 
   Is it possible to have two sessions for the same user in php? If yes,
   how can I implement this?
  
   I am currently using one without problem. However, when I try to create
   a second session, the first one is lost.
 
  could you post some code.  I am not sure I follow what you are doing.

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