Re: Sessions and multiple windows

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

 



On Tuesday 07 December 2004 21:48, Rory McKinley wrote:

> So if I understand you correctly if the first page takes a half hour to
> complete its queries, then the second page is going to sit for a half an
> hour before it can access the session variables?

In theory yes. But most likely your browser would have timed out by then, and  
whether the second page continues to execute after browser has timed out 
depends on the ignore_user_abort setting.

> So the only way for the user to be able to do anything while the first
> page is at work is to get a new session id for each new window?

Depends on how you structure your application. You're using the session data 
to keep track of the state of your application? For that to be feasible the 
state can only be changed by one process at any one time. PHP's session 
handling takes care of that little detail for you. What you need to do is to 
minimise the time that your application spends "in-between" states ie where 
the state is undefined. The state is undefined when the session is open (ie 
session_start()) and will remain so until you have finalised it by writing 
what you need into the $_SESSION and doing session_write_close().

So, if your lengthy processing bit is not related to your application state 
then do your application state stuff first, update $_SESSION, close session, 
then do your lengthy processing. Now if you need to update $_SESSION after 
your lengthy process you can always do another session_start().

However if your other pages depends on the result of the lengthy process then 
this is no getting around the fact that access to those pages have to be 
blocked until the process is finished.

> In such a case, is there any way to pass information between sets of
> session variables in such a case? (I.e from $_SESSION['policeman'] of
> session number 1 and $_SESSIOn['policeman'] of session number 2)

It's easier to share information than to 'pass'. You can store shared info in 
a database. If you really really want to pass info, you have to be more 
specific on how, where and when you want this 'passing' to take place.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Any given program will expand to fill available memory.
*/

-- 
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