'fork' a session

This is a discussion on 'fork' a session within the PHP Language forums, part of the PHP Programming Forums category; I am working on a webbased application (not a website) and from a page a new instance of the browser ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-09-2005
Lolo
 
Posts: n/a
Default 'fork' a session

I am working on a webbased application (not a website) and from a page
a new instance of the browser is started (using javascript) offering a
different set of functionalities. What I want is that each new
instance of the browser continues with its own set of
sessionvariables, as two different sessions. Is that possible?

I use the following javascript function:

window.open('code.php?submit=new&id=1,'status=no')

I use session_start() at the beginning of every page, i also
considered using session_regenerate_id in various ways but this didn't
have the desired effect.

Is there anyone who knows a solution to this problem?

Louis

Reply With Quote
  #2 (permalink)  
Old 05-09-2005
Mike Willbanks
 
Posts: n/a
Default Re: 'fork' a session

Louis,

> I am working on a webbased application (not a website) and from a page
> a new instance of the browser is started (using javascript) offering a
> different set of functionalities. What I want is that each new
> instance of the browser continues with its own set of
> sessionvariables, as two different sessions. Is that possible?
>
> I use the following javascript function:
>
> window.open('code.php?submit=new&id=1,'status=no')
>
> I use session_start() at the beginning of every page, i also
> considered using session_regenerate_id in various ways but this didn't
> have the desired effect.


You would have to write your own session management routines inorder to
do this. I am really not sure as to why you would want to do something
like this however I wish you the best of luck.

Mike
Reply With Quote
  #3 (permalink)  
Old 05-10-2005
Colin McKinnon
 
Posts: n/a
Default Re: 'fork' a session

Lolo wrote:

> I am working on a webbased application (not a website) and from a page
> a new instance of the browser is started (using javascript) offering a
> different set of functionalities. What I want is that each new
> instance of the browser continues with its own set of
> sessionvariables, as two different sessions. Is that possible?
>
> I use the following javascript function:
>
> window.open('code.php?submit=new&id=1,'status=no')
>
> I use session_start() at the beginning of every page, i also
> considered using session_regenerate_id in various ways but this didn't
> have the desired effect.
>


If you are storing your session id in a cookie, then there can only be one
session per cookie store (if you run two different browsers, say Opera and
Firefox, each will have a seperate session). I am not aware of any way of
differentiating between browser windows (and I have looked).

Solutions:

1) Don't store the session id in a cookie - use the rewriting mechanism (not
the most reliable if you're doing a lot of javascript)

2) Treat $_SESSION as an array of session variables, and pass a unique index
through each web page e.g.
<?php
$actual_session=$_SESSION[$_REQUEST['workspace']];

....
$_SESSION[$_REQUEST['workspace']]=$actual_session;
?>
(this is the solution I used in PfP Studio)

HTH

C.
Reply With Quote
  #4 (permalink)  
Old 05-15-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: 'fork' a session

Colin McKinnon wrote:
<snip>
> If you are storing your session id in a cookie, then there can only

be one
> session per cookie store (if you run two different browsers, say

Opera and
> Firefox, each will have a seperate session). I am not aware of any

way of
> differentiating between browser windows (and I have looked).

<snip>

FWIW, IIRC, someone here pointed out sometimes ago that
session_name() can be used to switch across (different) sessions.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:06 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0