You are here: Re: 'fork' a session « PHP Programming Language « IT news, forums, messages
Re: 'fork' a session

Posted by Colin McKinnon on 05/10/05 11:44

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.

 

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

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