RE: [PHP] SESSIONS lost sometimes - SOLVED

2009-08-26 Thread Angelo Zanetti


-Original Message-
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 24 August 2009 04:30 PM
To: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes



-Original Message-
From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
Sent: 20 August 2009 02:58 PM
To: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

On Thu, Aug 20, 2009 at 02:34:54PM +0200, Angelo Zanetti wrote:
 Hi Leon, 
 
 No harm intended :) Just thought that people were missing my post now and
 only answering yours.
 

Angelo, excuse me if I'm bringing up something very basic, but I'm new
to this.  Just trying to help.  

I imagine redirects couldn't be the cause of the problem, right?  

http://www.oscarm.org/news/detail/1877-avoiding_frustration_with_php_session
s

http://www.webmasterworld.com/forum88/8486.htm


Hi thanks for the links it appears that its all in order also I'm not losing
SESSIONS on the redirect but somewhere else.

I have checked the garbage collection, disk space and other settings in the
PHP.ini file. ALL FINE.

So now I am really stuck and confused as to what could sometimes cause the
loss of these variables and other times it just works fine. 

Is there possibly a way that I can call some function that will ensure that
the sessions are saved (I checked the manual - nothing much).

Any other ideas? Anything that you think might be causing issues? 

Thanks
Angelo

Hi all, 

I have solved the issue of lost session variables.

It appeared to be losing the SESSION variables when going from a POST from
HTTP to HTTPS, however it didn't always happen, so the logging allowed me to
narrow down where the losing was occurring.

The solution.

In my form that I post from the HTTP site, I put a hidden variable in there
and with the session variable. 

In HTTPS it sometimes doesn't carry over the hidden variable therefore we
need to start the session with the old SESSION ID from the HTTP site.

So what I did was the following on the https site: 

if (isset($_POST['sessionID']))
{

//http://stackoverflow.com/questions/441496/session-lost-when-switching-from
-http-to-https-in-php
// Retrieve the session ID as passed via the GET method.
$currentSessionID = $_POST['sessionID'];
//echo $currentSessionID;
// Set a cookie for the session ID.
$sessionid2 = session_id($currentSessionID);
}

Therefore setting the session ID with the session_id() function. This must
go before the session_start() function!!! Very NB!.

Hope this helps anyone who has a similar problem.

Regards
Angelo

http://www.elemental.co.za
http://www.wapit.co.za




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



RE: [PHP] SESSIONS lost sometimes

2009-08-24 Thread Angelo Zanetti


-Original Message-
From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
Sent: 20 August 2009 02:58 PM
To: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

On Thu, Aug 20, 2009 at 02:34:54PM +0200, Angelo Zanetti wrote:
 Hi Leon, 
 
 No harm intended :) Just thought that people were missing my post now and
 only answering yours.
 

Angelo, excuse me if I'm bringing up something very basic, but I'm new
to this.  Just trying to help.  

I imagine redirects couldn't be the cause of the problem, right?  

http://www.oscarm.org/news/detail/1877-avoiding_frustration_with_php_session
s

http://www.webmasterworld.com/forum88/8486.htm


Hi thanks for the links it appears that its all in order also I'm not losing
SESSIONS on the redirect but somewhere else.

I have checked the garbage collection, disk space and other settings in the
PHP.ini file. ALL FINE.

So now I am really stuck and confused as to what could sometimes cause the
loss of these variables and other times it just works fine. 

Is there possibly a way that I can call some function that will ensure that
the sessions are saved (I checked the manual - nothing much).

Any other ideas? Anything that you think might be causing issues? 

Thanks
Angelo



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


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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Angelo Zanetti


-Original Message-
From: Ben Dunlap [mailto:bdun...@agentintellect.com] 
Sent: 19 August 2009 08:18 PM
To: Angelo Zanetti
Cc: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

 We have a server with a site that does some XML calls. After lots of
testing
 I have found that the server is losing session variables.
[8]
 Also the site goes from HTTP to HTTPS at some point but this isn't the
issue
 as it loses the sessions as soon as they are set sometimes.

 Therefore I would like to know what I could check. I have read in other

Can you clarify what you mean by losing sessions? Have you taken a
network trace to see whether the client is consistently sending the
session ID with every request?

When the problem happens, is $_SESSION completely empty or is it only
missing some variables? Does it seem to happen on any page, or only
certain ones?

Thanks,

Ben


Hi Ben, 

When the problem happens the $_SESSION is partially empty. It only has the
some of the variables set.

It happens on a certain page only, but the strange thing is that it never
happened before its only happening now. But the code hasn't changed so is it
safe to assume that it's a server issue?

Thanks
Angelo

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


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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis

Since we are on the subject: I have the following similar problem:

When testing page on internet explorer, I find that one tab's variables can
affect another tab's variables. Thus when having the same web-site open and
using SESSION variables but for different users, Internet explorer can
become disorientated. This also sometimes happen when I have two
separate browsing windows open with Internet Explorer for the same site.

I have yet to determine if this is an internet explorer, or PHP or
combination of the two that is causing this condition. 

To my understanding _SESSION variables should be maintained per session, tab
or window. If this has been addressed already, my apologies, but thought it
worthwhile to mention.  

If someone perhaps have a solution or can confirm this as a known issue and
maybe is the same or related to Angelo's problem?


-Original Message-
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 20 August 2009 08:53 AM
To: 'Ben Dunlap'
Cc: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes



-Original Message-
From: Ben Dunlap [mailto:bdun...@agentintellect.com] 
Sent: 19 August 2009 08:18 PM
To: Angelo Zanetti
Cc: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

 We have a server with a site that does some XML calls. After lots of
testing
 I have found that the server is losing session variables.
[8]
 Also the site goes from HTTP to HTTPS at some point but this isn't the
issue
 as it loses the sessions as soon as they are set sometimes.

 Therefore I would like to know what I could check. I have read in other

Can you clarify what you mean by losing sessions? Have you taken a
network trace to see whether the client is consistently sending the
session ID with every request?

When the problem happens, is $_SESSION completely empty or is it only
missing some variables? Does it seem to happen on any page, or only
certain ones?

Thanks,

Ben


Hi Ben, 

When the problem happens the $_SESSION is partially empty. It only has the
some of the variables set.

It happens on a certain page only, but the strange thing is that it never
happened before its only happening now. But the code hasn't changed so is it
safe to assume that it's a server issue?

Thanks
Angelo

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


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


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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Arno Kuhl
-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 09:44 AM
To: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Since we are on the subject: I have the following similar problem:

When testing page on internet explorer, I find that one tab's variables can
affect another tab's variables. Thus when having the same web-site open and
using SESSION variables but for different users, Internet explorer can
become disorientated. This also sometimes happen when I have two
separate browsing windows open with Internet Explorer for the same site.

I have yet to determine if this is an internet explorer, or PHP or
combination of the two that is causing this condition. 

To my understanding _SESSION variables should be maintained per session, tab
or window. If this has been addressed already, my apologies, but thought it
worthwhile to mention.  

If someone perhaps have a solution or can confirm this as a known issue and
maybe is the same or related to Angelo's problem?



If different browser windows/tabs on the same client-side computer didn't
share session info then you'd get the effect of being able to log onto a
site with one browser window, but find in a second browser window that you
were not yet logged on. Experience will tell you that you're logged on in
both browser windows (try it with your online bank). It's not an issue, it's
a feature. If you want to be able to use different browser windows as though
they were different users then use different browsers e.g. IE and FF on the
same client-side computer will look like two separate end users to the
server, and they don't share session info or cookies.

Cheers
Arno


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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
 It's not an issue, it's a feature.

Thanks Arno...but it is a pain also.
If I work with user A in Tab1 (window1), I want to work with user B
separately in Tab2. When user in Tab2 logs off, I still want user A to work,
and not suddenly have to re-login. Same with bank. If I work with my company
account, then my personal account must not become an issue because I am on
the same machine and site. 

I have no issue with using FF and IE to do testing as that takes care of
browser compatibility testing at the same time :-), but I think when you
start a new session with new values, it should be kept under that window/tab
alone. Cookies can take care of more details, but my opinion is data should
never be affected across windows/tabs unless the same user is logged in on
botheven then I would expect PHP to keep data per session. Maybe it goes
beyond being an IE or FF issue..the questiojn is...will PHP allow variables
from session A become corrupted when session B is in progress when they
should actually be handled seperately?

In the end I think it is something I do wrong in PHP with the SESSION
variables and how I clear themif so...I don't think PHP should allow
clearing SESSION variables from other sessions.
 
-Original Message-
From: Arno Kuhl [mailto:ak...@telkomsa.net] 
Sent: 20 August 2009 10:03 AM
To: 'Leon du Plessis'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 09:44 AM
To: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Since we are on the subject: I have the following similar problem:

When testing page on internet explorer, I find that one tab's variables can
affect another tab's variables. Thus when having the same web-site open and
using SESSION variables but for different users, Internet explorer can
become disorientated. This also sometimes happen when I have two
separate browsing windows open with Internet Explorer for the same site.

I have yet to determine if this is an internet explorer, or PHP or
combination of the two that is causing this condition. 

To my understanding _SESSION variables should be maintained per session, tab
or window. If this has been addressed already, my apologies, but thought it
worthwhile to mention.  

If someone perhaps have a solution or can confirm this as a known issue and
maybe is the same or related to Angelo's problem?



If different browser windows/tabs on the same client-side computer didn't
share session info then you'd get the effect of being able to log onto a
site with one browser window, but find in a second browser window that you
were not yet logged on. Experience will tell you that you're logged on in
both browser windows (try it with your online bank). It's not an issue, it's
a feature. If you want to be able to use different browser windows as though
they were different users then use different browsers e.g. IE and FF on the
same client-side computer will look like two separate end users to the
server, and they don't share session info or cookies.

Cheers
Arno


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


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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Nitebirdz
On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
 
 Since we are on the subject: I have the following similar problem:
 
 When testing page on internet explorer, I find that one tab's variables can
 affect another tab's variables. Thus when having the same web-site open and
 using SESSION variables but for different users, Internet explorer can
 become disorientated. This also sometimes happen when I have two
 separate browsing windows open with Internet Explorer for the same site.
 
 I have yet to determine if this is an internet explorer, or PHP or
 combination of the two that is causing this condition. 
 
 To my understanding _SESSION variables should be maintained per session, tab
 or window. If this has been addressed already, my apologies, but thought it
 worthwhile to mention.  
 

I'm a total newbie when it comes to these issues, but it seems to me
that Firefox behaves in the very same manner.  It's not limited to PHP
sessions either.  It's always been my experience on any website that
requires authentication, including the likes of Google Mail, etc.  When
I want to run multiple sessions for different GMail accounts, for
example, I just create a different user profile in Firefox. 

It'd make sense for things to run this way, I think.  After all, I'd
find it quite confusing if I log into Google Docs, open a document (by
default, it opens in a new tab) and I had to log in yet again to be able
to edit it.  


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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Peter Ford
Leon du Plessis wrote:
  It's not an issue, it's a feature.
 
 Thanks Arno...but it is a pain also.
 If I work with user A in Tab1 (window1), I want to work with user B
 separately in Tab2. When user in Tab2 logs off, I still want user A to work,
 and not suddenly have to re-login. Same with bank. If I work with my company
 account, then my personal account must not become an issue because I am on
 the same machine and site. 
 
 I have no issue with using FF and IE to do testing as that takes care of
 browser compatibility testing at the same time :-), but I think when you
 start a new session with new values, it should be kept under that window/tab
 alone. Cookies can take care of more details, but my opinion is data should
 never be affected across windows/tabs unless the same user is logged in on
 botheven then I would expect PHP to keep data per session. Maybe it goes
 beyond being an IE or FF issue..the questiojn is...will PHP allow variables
 from session A become corrupted when session B is in progress when they
 should actually be handled seperately?
 
 In the end I think it is something I do wrong in PHP with the SESSION
 variables and how I clear themif so...I don't think PHP should allow
 clearing SESSION variables from other sessions.
  
 -Original Message-
 From: Arno Kuhl [mailto:ak...@telkomsa.net] 
 Sent: 20 August 2009 10:03 AM
 To: 'Leon du Plessis'; php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 -Original Message-
 From: Leon du Plessis [mailto:l...@dsgnit.com] 
 Sent: 20 August 2009 09:44 AM
 To: php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 Since we are on the subject: I have the following similar problem:
 
 When testing page on internet explorer, I find that one tab's variables can
 affect another tab's variables. Thus when having the same web-site open and
 using SESSION variables but for different users, Internet explorer can
 become disorientated. This also sometimes happen when I have two
 separate browsing windows open with Internet Explorer for the same site.
 
 I have yet to determine if this is an internet explorer, or PHP or
 combination of the two that is causing this condition. 
 
 To my understanding _SESSION variables should be maintained per session, tab
 or window. If this has been addressed already, my apologies, but thought it
 worthwhile to mention.  
 
 If someone perhaps have a solution or can confirm this as a known issue and
 maybe is the same or related to Angelo's problem?
 
 
 
 If different browser windows/tabs on the same client-side computer didn't
 share session info then you'd get the effect of being able to log onto a
 site with one browser window, but find in a second browser window that you
 were not yet logged on. Experience will tell you that you're logged on in
 both browser windows (try it with your online bank). It's not an issue, it's
 a feature. If you want to be able to use different browser windows as though
 they were different users then use different browsers e.g. IE and FF on the
 same client-side computer will look like two separate end users to the
 server, and they don't share session info or cookies.
 
 Cheers
 Arno
 
 

The key thing is that both tabs (or windows) from the same browser are in the
*same* session - they send the *same* PHPID cookie. PHP is essentially stateless
- it doesn't care where the request comes from, and ties a session to the PHPID
cookie if it gets one. As far as PHP knows, requests from different tabs with
the same PHPID cookie are requests from the same place in the same session.

To get a different session you need a different instance of the browser - that's
the way browsers have been coded to work. It's not too hard with Firefox, since
you can set up multiple profiles to have independent Firefox windows on the same
screen.

-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Nitebirdz
On Thu, Aug 20, 2009 at 10:26:35AM +0200, Leon du Plessis wrote:
  It's not an issue, it's a feature.
 
 Thanks Arno...but it is a pain also.
 If I work with user A in Tab1 (window1), I want to work with user B
 separately in Tab2. When user in Tab2 logs off, I still want user A to work,
 and not suddenly have to re-login. Same with bank. If I work with my company
 account, then my personal account must not become an issue because I am on
 the same machine and site. 
 

As mentioned in my other email, I've only been able to get this to work
by using different user profiles under Firefox.  If you need to run them
both at the same time, the following document helps explaining how to
accomplish it:

http://lifehacker.com/software/firefox/geek-to-live--manage-multiple-firefox-profiles-231646.php


I never tested it because I don't run Windows, but a similar setup works
just fine for Linux. 



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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
 It'd make sense for things to run this way, I think.  After all, I'd
find it quite confusing if I log into Google Docs, open a document (by
default, it opens in a new tab) and I had to log in yet again to be able to
edit it.

Yes. I agree. But in this case the Tab being opened is used with the same
authentication details either via POST, GET or Cookie variables. The problem
comes in when a totally different set of login credentials are being used
(for the same tab/window).  Other user's login particulars should not affect
your login variables.

-Original Message-
From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
Sent: 20 August 2009 10:40 AM
To: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
 
 Since we are on the subject: I have the following similar problem:
 
 When testing page on internet explorer, I find that one tab's variables
can
 affect another tab's variables. Thus when having the same web-site open
and
 using SESSION variables but for different users, Internet explorer can
 become disorientated. This also sometimes happen when I have two
 separate browsing windows open with Internet Explorer for the same site.
 
 I have yet to determine if this is an internet explorer, or PHP or
 combination of the two that is causing this condition. 
 
 To my understanding _SESSION variables should be maintained per session,
tab
 or window. If this has been addressed already, my apologies, but thought
it
 worthwhile to mention.  
 

I'm a total newbie when it comes to these issues, but it seems to me
that Firefox behaves in the very same manner.  It's not limited to PHP
sessions either.  It's always been my experience on any website that
requires authentication, including the likes of Google Mail, etc.  When
I want to run multiple sessions for different GMail accounts, for
example, I just create a different user profile in Firefox. 

It'd make sense for things to run this way, I think.  After all, I'd
find it quite confusing if I log into Google Docs, open a document (by
default, it opens in a new tab) and I had to log in yet again to be able
to edit it.  


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


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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis


That is how I know browsers to work, yet for a while the bahaviour has
changed. The question in light of this then is, should a new browser or tab
not open a new PHP SESSION ID. Session ID's should be kept if called from
existing pages or ID's? But new pages has no parent? Just wondering.

-Original Message-
From: Peter Ford [mailto:p...@justcroft.com] 
Sent: 20 August 2009 10:47 AM
To: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

Leon du Plessis wrote:
  It's not an issue, it's a feature.
 
 Thanks Arno...but it is a pain also.
 If I work with user A in Tab1 (window1), I want to work with user B
 separately in Tab2. When user in Tab2 logs off, I still want user A to
work,
 and not suddenly have to re-login. Same with bank. If I work with my
company
 account, then my personal account must not become an issue because I am on
 the same machine and site. 
 
 I have no issue with using FF and IE to do testing as that takes care of
 browser compatibility testing at the same time :-), but I think when you
 start a new session with new values, it should be kept under that
window/tab
 alone. Cookies can take care of more details, but my opinion is data
should
 never be affected across windows/tabs unless the same user is logged in on
 botheven then I would expect PHP to keep data per session. Maybe it
goes
 beyond being an IE or FF issue..the questiojn is...will PHP allow
variables
 from session A become corrupted when session B is in progress when they
 should actually be handled seperately?
 
 In the end I think it is something I do wrong in PHP with the SESSION
 variables and how I clear themif so...I don't think PHP should allow
 clearing SESSION variables from other sessions.
  
 -Original Message-
 From: Arno Kuhl [mailto:ak...@telkomsa.net] 
 Sent: 20 August 2009 10:03 AM
 To: 'Leon du Plessis'; php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 -Original Message-
 From: Leon du Plessis [mailto:l...@dsgnit.com] 
 Sent: 20 August 2009 09:44 AM
 To: php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 Since we are on the subject: I have the following similar problem:
 
 When testing page on internet explorer, I find that one tab's variables
can
 affect another tab's variables. Thus when having the same web-site open
and
 using SESSION variables but for different users, Internet explorer can
 become disorientated. This also sometimes happen when I have two
 separate browsing windows open with Internet Explorer for the same site.
 
 I have yet to determine if this is an internet explorer, or PHP or
 combination of the two that is causing this condition. 
 
 To my understanding _SESSION variables should be maintained per session,
tab
 or window. If this has been addressed already, my apologies, but thought
it
 worthwhile to mention.  
 
 If someone perhaps have a solution or can confirm this as a known issue
and
 maybe is the same or related to Angelo's problem?
 
 
 
 If different browser windows/tabs on the same client-side computer didn't
 share session info then you'd get the effect of being able to log onto a
 site with one browser window, but find in a second browser window that you
 were not yet logged on. Experience will tell you that you're logged on in
 both browser windows (try it with your online bank). It's not an issue,
it's
 a feature. If you want to be able to use different browser windows as
though
 they were different users then use different browsers e.g. IE and FF on
the
 same client-side computer will look like two separate end users to the
 server, and they don't share session info or cookies.
 
 Cheers
 Arno
 
 

The key thing is that both tabs (or windows) from the same browser are in
the
*same* session - they send the *same* PHPID cookie. PHP is essentially
stateless
- it doesn't care where the request comes from, and ties a session to the
PHPID
cookie if it gets one. As far as PHP knows, requests from different tabs
with
the same PHPID cookie are requests from the same place in the same session.

To get a different session you need a different instance of the browser -
that's
the way browsers have been coded to work. It's not too hard with Firefox,
since
you can set up multiple profiles to have independent Firefox windows on the
same
screen.

-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

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


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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
Hi, 

Just a re-iteration on the problem:

Browser 1 has user A details 

Browser 2 has user B details

User B logs off, then user A is suddenly in logged of status also.

The method used to destroy the session is:
// Unset all of the session variables.
$_SESSION = array();

// Finally, destroy the session.
session_destroy();

Problem. User's A session is also destroyed. The concern is, that this
should not be the case. User A must happily continue to work.

So, should PHP destroy the whole browser's session id's variables? My answer
is No.

User A and user B should have different session ids, if not, then it is
wrong. A new window should have PHP to spawn a new session id (that is, the
request does not come from an existing page where an id has been created
already. If the ids are different, then session_destroy should only clear
variables for relevant session_id, ie only User B's details In this example.


The problem then probably lies in the session_ids being either the same for
the two different logins (although they are on different browser) or
session_destroy clearing data across sessions. (I will test that later). It
would then seem that session ids is setup per location/machine by MS Windows
as per Peter's explanation. Setting up profiles is the the resolution as
suggested. Otherwise, it would be nice if Windows/IE/FF/PHP could identify
when a BRAND NEW page is being opened and then create a brand new session id
for that window/tab.

It is not a huge issue, I was just wondering if someone else had the same
annoying condition. I am happy with the responses and the functionality
somewhere on a wish-list. 

Now Back to Angelo's SESSION problem which sounded like it could be related.

Greetings!
Leon

-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 10:57 AM
To: 'Peter Ford'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes



That is how I know browsers to work, yet for a while the bahaviour has
changed. The question in light of this then is, should a new browser or tab
not open a new PHP SESSION ID. Session ID's should be kept if called from
existing pages or ID's? But new pages has no parent? Just wondering.

-Original Message-
From: Peter Ford [mailto:p...@justcroft.com] 
Sent: 20 August 2009 10:47 AM
To: php-general@lists.php.net
Subject: Re: [PHP] SESSIONS lost sometimes

Leon du Plessis wrote:
  It's not an issue, it's a feature.
 
 Thanks Arno...but it is a pain also.
 If I work with user A in Tab1 (window1), I want to work with user B
 separately in Tab2. When user in Tab2 logs off, I still want user A to
work,
 and not suddenly have to re-login. Same with bank. If I work with my
company
 account, then my personal account must not become an issue because I am on
 the same machine and site. 
 
 I have no issue with using FF and IE to do testing as that takes care of
 browser compatibility testing at the same time :-), but I think when you
 start a new session with new values, it should be kept under that
window/tab
 alone. Cookies can take care of more details, but my opinion is data
should
 never be affected across windows/tabs unless the same user is logged in on
 botheven then I would expect PHP to keep data per session. Maybe it
goes
 beyond being an IE or FF issue..the questiojn is...will PHP allow
variables
 from session A become corrupted when session B is in progress when they
 should actually be handled seperately?
 
 In the end I think it is something I do wrong in PHP with the SESSION
 variables and how I clear themif so...I don't think PHP should allow
 clearing SESSION variables from other sessions.
  
 -Original Message-
 From: Arno Kuhl [mailto:ak...@telkomsa.net] 
 Sent: 20 August 2009 10:03 AM
 To: 'Leon du Plessis'; php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 -Original Message-
 From: Leon du Plessis [mailto:l...@dsgnit.com] 
 Sent: 20 August 2009 09:44 AM
 To: php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 Since we are on the subject: I have the following similar problem:
 
 When testing page on internet explorer, I find that one tab's variables
can
 affect another tab's variables. Thus when having the same web-site open
and
 using SESSION variables but for different users, Internet explorer can
 become disorientated. This also sometimes happen when I have two
 separate browsing windows open with Internet Explorer for the same site.
 
 I have yet to determine if this is an internet explorer, or PHP or
 combination of the two that is causing this condition. 
 
 To my understanding _SESSION variables should be maintained per session,
tab
 or window. If this has been addressed already, my apologies, but thought
it
 worthwhile to mention.  
 
 If someone perhaps have a solution or can confirm this as a known issue
and
 maybe is the same or related to Angelo's problem?
 
 
 
 If different browser windows

RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Ashley Sheridan
On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
 to edit it.  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
The point is you are misunderstanding how browsers work. What the server
app is seeing is a new login that replaces the first. This is the way
browsers work, and if it changed to the idea you have for it, then
millions of sites would suddenly fail to work; i.e. any site that
requires a new tab or window to be opened in order to function, like
banks, etc.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
Thanks Ashley, 

I just want to iterate again that when a new page is opened by another
existing page in a new browser or Tab, the session_id is already created and
therefore the current way browsers work is in no way compremised. The new
browser/tab would receive the session id along with GET or POST variables.

What I am suggesting/hoping is that when a new browser is opened or a new
tab is opened via the application, the protocols would reckognize that this
is the first time the page is served and is not being called from another
page. That is, a new page is loaded by the user entering it, and NOT by
clicking login or some other link from an existing page.

Yes, I know..that creates other scenarios, so is happy to not meddle with
the way browsers work. It is just a limitation I will live with and can get
by with it.

Regards
Leon

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 11:39 AM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The
problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not
affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
 to edit it.  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
The point is you are misunderstanding how browsers work. What the server
app is seeing is a new login that replaces the first. This is the way
browsers work, and if it changed to the idea you have for it, then
millions of sites would suddenly fail to work; i.e. any site that
requires a new tab or window to be opened in order to function, like
banks, etc.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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


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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Ashley Sheridan
On Thu, 2009-08-20 at 12:04 +0200, Leon du Plessis wrote:
 Thanks Ashley, 
 
 I just want to iterate again that when a new page is opened by another
 existing page in a new browser or Tab, the session_id is already created and
 therefore the current way browsers work is in no way compremised. The new
 browser/tab would receive the session id along with GET or POST variables.
 
 What I am suggesting/hoping is that when a new browser is opened or a new
 tab is opened via the application, the protocols would reckognize that this
 is the first time the page is served and is not being called from another
 page. That is, a new page is loaded by the user entering it, and NOT by
 clicking login or some other link from an existing page.
 
 Yes, I know..that creates other scenarios, so is happy to not meddle with
 the way browsers work. It is just a limitation I will live with and can get
 by with it.
 
 Regards
 Leon
 
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 Sent: 20 August 2009 11:39 AM
 To: Leon du Plessis
 Cc: 'Nitebirdz'; php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
   It'd make sense for things to run this way, I think.  After all, I'd
  find it quite confusing if I log into Google Docs, open a document (by
  default, it opens in a new tab) and I had to log in yet again to be able
 to
  edit it.
  
  Yes. I agree. But in this case the Tab being opened is used with the same
  authentication details either via POST, GET or Cookie variables. The
 problem
  comes in when a totally different set of login credentials are being used
  (for the same tab/window).  Other user's login particulars should not
 affect
  your login variables.
  
  -Original Message-
  From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
  Sent: 20 August 2009 10:40 AM
  To: php-general@lists.php.net
  Subject: Re: [PHP] SESSIONS lost sometimes
  
  On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
   
   Since we are on the subject: I have the following similar problem:
   
   When testing page on internet explorer, I find that one tab's variables
  can
   affect another tab's variables. Thus when having the same web-site open
  and
   using SESSION variables but for different users, Internet explorer can
   become disorientated. This also sometimes happen when I have two
   separate browsing windows open with Internet Explorer for the same site.
   
   I have yet to determine if this is an internet explorer, or PHP or
   combination of the two that is causing this condition. 
   
   To my understanding _SESSION variables should be maintained per session,
  tab
   or window. If this has been addressed already, my apologies, but thought
  it
   worthwhile to mention.  
   
  
  I'm a total newbie when it comes to these issues, but it seems to me
  that Firefox behaves in the very same manner.  It's not limited to PHP
  sessions either.  It's always been my experience on any website that
  requires authentication, including the likes of Google Mail, etc.  When
  I want to run multiple sessions for different GMail accounts, for
  example, I just create a different user profile in Firefox. 
  
  It'd make sense for things to run this way, I think.  After all, I'd
  find it quite confusing if I log into Google Docs, open a document (by
  default, it opens in a new tab) and I had to log in yet again to be able
  to edit it.  
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 The point is you are misunderstanding how browsers work. What the server
 app is seeing is a new login that replaces the first. This is the way
 browsers work, and if it changed to the idea you have for it, then
 millions of sites would suddenly fail to work; i.e. any site that
 requires a new tab or window to be opened in order to function, like
 banks, etc.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
There is one way to get around it, and that is to use arrays within your
session variables. So for example, it might look something like this:

$_SESSION['your_app_name']['username']['some_value']

This way, if the username doesn't exist, you know there is no session
for them. It's ugly, but it will get around what you see as a
limitation.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
Thanks Ashley. Will implement if the need arise again..
By limitation I actually meant annoyance. 
Limitation was the wrong word to use.
(I think all browsers has something great and something not so great)

:-)
Greetings

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 12:05 PM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 12:04 +0200, Leon du Plessis wrote:
 Thanks Ashley, 
 
 I just want to iterate again that when a new page is opened by another
 existing page in a new browser or Tab, the session_id is already created
and
 therefore the current way browsers work is in no way compremised. The new
 browser/tab would receive the session id along with GET or POST variables.
 
 What I am suggesting/hoping is that when a new browser is opened or a new
 tab is opened via the application, the protocols would reckognize that
this
 is the first time the page is served and is not being called from another
 page. That is, a new page is loaded by the user entering it, and NOT by
 clicking login or some other link from an existing page.
 
 Yes, I know..that creates other scenarios, so is happy to not meddle with
 the way browsers work. It is just a limitation I will live with and can
get
 by with it.
 
 Regards
 Leon
 
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 Sent: 20 August 2009 11:39 AM
 To: Leon du Plessis
 Cc: 'Nitebirdz'; php-general@lists.php.net
 Subject: RE: [PHP] SESSIONS lost sometimes
 
 On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
   It'd make sense for things to run this way, I think.  After all, I'd
  find it quite confusing if I log into Google Docs, open a document (by
  default, it opens in a new tab) and I had to log in yet again to be able
 to
  edit it.
  
  Yes. I agree. But in this case the Tab being opened is used with the
same
  authentication details either via POST, GET or Cookie variables. The
 problem
  comes in when a totally different set of login credentials are being
used
  (for the same tab/window).  Other user's login particulars should not
 affect
  your login variables.
  
  -Original Message-
  From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
  Sent: 20 August 2009 10:40 AM
  To: php-general@lists.php.net
  Subject: Re: [PHP] SESSIONS lost sometimes
  
  On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
   
   Since we are on the subject: I have the following similar problem:
   
   When testing page on internet explorer, I find that one tab's
variables
  can
   affect another tab's variables. Thus when having the same web-site
open
  and
   using SESSION variables but for different users, Internet explorer can
   become disorientated. This also sometimes happen when I have two
   separate browsing windows open with Internet Explorer for the same
site.
   
   I have yet to determine if this is an internet explorer, or PHP or
   combination of the two that is causing this condition. 
   
   To my understanding _SESSION variables should be maintained per
session,
  tab
   or window. If this has been addressed already, my apologies, but
thought
  it
   worthwhile to mention.  
   
  
  I'm a total newbie when it comes to these issues, but it seems to me
  that Firefox behaves in the very same manner.  It's not limited to PHP
  sessions either.  It's always been my experience on any website that
  requires authentication, including the likes of Google Mail, etc.  When
  I want to run multiple sessions for different GMail accounts, for
  example, I just create a different user profile in Firefox. 
  
  It'd make sense for things to run this way, I think.  After all, I'd
  find it quite confusing if I log into Google Docs, open a document (by
  default, it opens in a new tab) and I had to log in yet again to be able
  to edit it.  
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 The point is you are misunderstanding how browsers work. What the server
 app is seeing is a new login that replaces the first. This is the way
 browsers work, and if it changed to the idea you have for it, then
 millions of sites would suddenly fail to work; i.e. any site that
 requires a new tab or window to be opened in order to function, like
 banks, etc.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
There is one way to get around it, and that is to use arrays within your
session variables. So for example, it might look something like this:

$_SESSION['your_app_name']['username']['some_value']

This way, if the username doesn't exist, you know there is no session
for them. It's ugly

RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Angelo Zanetti
Hi Leon and all.

LEON you are misunderstanding how the sessions work. Also please start your
own thread and don't hijack mine.

To the rest that replied. Thanks, I am still stuck with the problem I have
asked the hosting company to check the storage capacity and also any other
issues with the SESSIONS on the server.

However if anyone has other things they think I can look at, I'd appreciate
that very much.

Thanks
Angelo
http://www.elemental.co.za


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 12:04 PM
To: a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Thanks Ashley, 

I just want to iterate again that when a new page is opened by another
existing page in a new browser or Tab, the session_id is already created and
therefore the current way browsers work is in no way compremised. The new
browser/tab would receive the session id along with GET or POST variables.

What I am suggesting/hoping is that when a new browser is opened or a new
tab is opened via the application, the protocols would reckognize that this
is the first time the page is served and is not being called from another
page. That is, a new page is loaded by the user entering it, and NOT by
clicking login or some other link from an existing page.

Yes, I know..that creates other scenarios, so is happy to not meddle with
the way browsers work. It is just a limitation I will live with and can get
by with it.

Regards
Leon

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 11:39 AM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The
problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not
affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
 to edit it.  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
The point is you are misunderstanding how browsers work. What the server
app is seeing is a new login that replaces the first. This is the way
browsers work, and if it changed to the idea you have for it, then
millions of sites would suddenly fail to work; i.e. any site that
requires a new tab or window to be opened in order to function, like
banks, etc.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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


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


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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Nitebirdz
On Thu, Aug 20, 2009 at 12:04:08PM +0200, Leon du Plessis wrote:
 Thanks Ashley, 
 
 I just want to iterate again that when a new page is opened by another
 existing page in a new browser or Tab, the session_id is already created and
 therefore the current way browsers work is in no way compremised. The new
 browser/tab would receive the session id along with GET or POST variables.
 
 What I am suggesting/hoping is that when a new browser is opened or a new
 tab is opened via the application, the protocols would reckognize that this
 is the first time the page is served and is not being called from another
 page. That is, a new page is loaded by the user entering it, and NOT by
 clicking login or some other link from an existing page.
 

Out of curiosity.  Did you test it under Google Chrome?  I believe each
tab is a separate process in the case of that browser.  I wonder how
that might affect something like this.  


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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
Hi Angelo, 

No need to be nasty and touchy. If you have done trouble to read I have
closed the discussion in a prior listing and referred back to your original
thread. thanks

-Original Message-
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 20 August 2009 01:21 PM
To: 'Leon du Plessis'; a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Leon and all.

LEON you are misunderstanding how the sessions work. Also please start your
own thread and don't hijack mine.

To the rest that replied. Thanks, I am still stuck with the problem I have
asked the hosting company to check the storage capacity and also any other
issues with the SESSIONS on the server.

However if anyone has other things they think I can look at, I'd appreciate
that very much.

Thanks
Angelo
http://www.elemental.co.za


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 12:04 PM
To: a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Thanks Ashley, 

I just want to iterate again that when a new page is opened by another
existing page in a new browser or Tab, the session_id is already created and
therefore the current way browsers work is in no way compremised. The new
browser/tab would receive the session id along with GET or POST variables.

What I am suggesting/hoping is that when a new browser is opened or a new
tab is opened via the application, the protocols would reckognize that this
is the first time the page is served and is not being called from another
page. That is, a new page is loaded by the user entering it, and NOT by
clicking login or some other link from an existing page.

Yes, I know..that creates other scenarios, so is happy to not meddle with
the way browsers work. It is just a limitation I will live with and can get
by with it.

Regards
Leon

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 11:39 AM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The
problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not
affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
 to edit it.  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
The point is you are misunderstanding how browsers work. What the server
app is seeing is a new login that replaces the first. This is the way
browsers work, and if it changed to the idea you have for it, then
millions of sites would suddenly fail to work; i.e. any site that
requires a new tab or window to be opened in order to function, like
banks, etc.

Thanks,
Ash
http://www.ashleysheridan.co.uk




-- 
PHP General

Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Floyd Resler

Leon,
	Sessions are used on a per-domain basis.  So, no matter how many  
windows or tabs you have open for mydomain.com it will be the same  
session for all.  Having a different session start up for each window  
or tab would be a major pain.  If you needed to keep track of a user  
ID, for example, you wouldn't be able to.  As already mentioned you  
can use different browsers.  You can also set up sub-domains which  
would each have their own sessions.


Take care,
Floyd

On Aug 20, 2009, at 4:26 AM, Leon du Plessis wrote:


 It's not an issue, it's a feature.

Thanks Arno...but it is a pain also.
If I work with user A in Tab1 (window1), I want to work with user B
separately in Tab2. When user in Tab2 logs off, I still want user A  
to work,
and not suddenly have to re-login. Same with bank. If I work with my  
company
account, then my personal account must not become an issue because I  
am on

the same machine and site.

I have no issue with using FF and IE to do testing as that takes  
care of
browser compatibility testing at the same time :-), but I think when  
you
start a new session with new values, it should be kept under that  
window/tab
alone. Cookies can take care of more details, but my opinion is data  
should
never be affected across windows/tabs unless the same user is logged  
in on
botheven then I would expect PHP to keep data per session. Maybe  
it goes
beyond being an IE or FF issue..the questiojn is...will PHP allow  
variables
from session A become corrupted when session B is in progress when  
they

should actually be handled seperately?

In the end I think it is something I do wrong in PHP with the SESSION
variables and how I clear themif so...I don't think PHP should  
allow

clearing SESSION variables from other sessions.

-Original Message-
From: Arno Kuhl [mailto:ak...@telkomsa.net]
Sent: 20 August 2009 10:03 AM
To: 'Leon du Plessis'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com]
Sent: 20 August 2009 09:44 AM
To: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Since we are on the subject: I have the following similar problem:

When testing page on internet explorer, I find that one tab's  
variables can
affect another tab's variables. Thus when having the same web-site  
open and

using SESSION variables but for different users, Internet explorer can
become disorientated. This also sometimes happen when I have two
separate browsing windows open with Internet Explorer for the same  
site.


I have yet to determine if this is an internet explorer, or PHP or
combination of the two that is causing this condition.

To my understanding _SESSION variables should be maintained per  
session, tab
or window. If this has been addressed already, my apologies, but  
thought it

worthwhile to mention.

If someone perhaps have a solution or can confirm this as a known  
issue and

maybe is the same or related to Angelo's problem?



If different browser windows/tabs on the same client-side computer  
didn't
share session info then you'd get the effect of being able to log  
onto a
site with one browser window, but find in a second browser window  
that you
were not yet logged on. Experience will tell you that you're logged  
on in
both browser windows (try it with your online bank). It's not an  
issue, it's
a feature. If you want to be able to use different browser windows  
as though
they were different users then use different browsers e.g. IE and FF  
on the

same client-side computer will look like two separate end users to the
server, and they don't share session info or cookies.

Cheers
Arno


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


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





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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Nitebirdz
On Thu, Aug 20, 2009 at 02:34:54PM +0200, Angelo Zanetti wrote:
 Hi Leon, 
 
 No harm intended :) Just thought that people were missing my post now and
 only answering yours.
 

Angelo, excuse me if I'm bringing up something very basic, but I'm new
to this.  Just trying to help.  

I imagine redirects couldn't be the cause of the problem, right?  

http://www.oscarm.org/news/detail/1877-avoiding_frustration_with_php_sessions

http://www.webmasterworld.com/forum88/8486.htm



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



RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Angelo Zanetti
Hi Leon, 

No harm intended :) Just thought that people were missing my post now and
only answering yours.

Anyways hope your issue got resolved.

Angelo


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 01:46 PM
To: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Angelo, 

No need to be nasty and touchy. If you have done trouble to read I have
closed the discussion in a prior listing and referred back to your original
thread. thanks

-Original Message-
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 20 August 2009 01:21 PM
To: 'Leon du Plessis'; a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Leon and all.

LEON you are misunderstanding how the sessions work. Also please start your
own thread and don't hijack mine.

To the rest that replied. Thanks, I am still stuck with the problem I have
asked the hosting company to check the storage capacity and also any other
issues with the SESSIONS on the server.

However if anyone has other things they think I can look at, I'd appreciate
that very much.

Thanks
Angelo
http://www.elemental.co.za


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 12:04 PM
To: a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Thanks Ashley, 

I just want to iterate again that when a new page is opened by another
existing page in a new browser or Tab, the session_id is already created and
therefore the current way browsers work is in no way compremised. The new
browser/tab would receive the session id along with GET or POST variables.

What I am suggesting/hoping is that when a new browser is opened or a new
tab is opened via the application, the protocols would reckognize that this
is the first time the page is served and is not being called from another
page. That is, a new page is loaded by the user entering it, and NOT by
clicking login or some other link from an existing page.

Yes, I know..that creates other scenarios, so is happy to not meddle with
the way browsers work. It is just a limitation I will live with and can get
by with it.

Regards
Leon

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 11:39 AM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The
problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not
affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
 to edit it.  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
The point is you are misunderstanding how browsers work. What the server
app is seeing

RE: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Leon du Plessis
No problem! Thx

-Original Message-
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 20 August 2009 02:35 PM
To: 'Leon du Plessis'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Leon, 

No harm intended :) Just thought that people were missing my post now and
only answering yours.

Anyways hope your issue got resolved.

Angelo


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 01:46 PM
To: php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Angelo, 

No need to be nasty and touchy. If you have done trouble to read I have
closed the discussion in a prior listing and referred back to your original
thread. thanks

-Original Message-
From: Angelo Zanetti [mailto:ang...@zlogic.co.za] 
Sent: 20 August 2009 01:21 PM
To: 'Leon du Plessis'; a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Hi Leon and all.

LEON you are misunderstanding how the sessions work. Also please start your
own thread and don't hijack mine.

To the rest that replied. Thanks, I am still stuck with the problem I have
asked the hosting company to check the storage capacity and also any other
issues with the SESSIONS on the server.

However if anyone has other things they think I can look at, I'd appreciate
that very much.

Thanks
Angelo
http://www.elemental.co.za


-Original Message-
From: Leon du Plessis [mailto:l...@dsgnit.com] 
Sent: 20 August 2009 12:04 PM
To: a...@ashleysheridan.co.uk
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

Thanks Ashley, 

I just want to iterate again that when a new page is opened by another
existing page in a new browser or Tab, the session_id is already created and
therefore the current way browsers work is in no way compremised. The new
browser/tab would receive the session id along with GET or POST variables.

What I am suggesting/hoping is that when a new browser is opened or a new
tab is opened via the application, the protocols would reckognize that this
is the first time the page is served and is not being called from another
page. That is, a new page is loaded by the user entering it, and NOT by
clicking login or some other link from an existing page.

Yes, I know..that creates other scenarios, so is happy to not meddle with
the way browsers work. It is just a limitation I will live with and can get
by with it.

Regards
Leon

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: 20 August 2009 11:39 AM
To: Leon du Plessis
Cc: 'Nitebirdz'; php-general@lists.php.net
Subject: RE: [PHP] SESSIONS lost sometimes

On Thu, 2009-08-20 at 10:50 +0200, Leon du Plessis wrote:
  It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again to be able
to
 edit it.
 
 Yes. I agree. But in this case the Tab being opened is used with the same
 authentication details either via POST, GET or Cookie variables. The
problem
 comes in when a totally different set of login credentials are being used
 (for the same tab/window).  Other user's login particulars should not
affect
 your login variables.
 
 -Original Message-
 From: Nitebirdz [mailto:nitebi...@sacredchaos.com] 
 Sent: 20 August 2009 10:40 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] SESSIONS lost sometimes
 
 On Thu, Aug 20, 2009 at 09:44:02AM +0200, Leon du Plessis wrote:
  
  Since we are on the subject: I have the following similar problem:
  
  When testing page on internet explorer, I find that one tab's variables
 can
  affect another tab's variables. Thus when having the same web-site open
 and
  using SESSION variables but for different users, Internet explorer can
  become disorientated. This also sometimes happen when I have two
  separate browsing windows open with Internet Explorer for the same site.
  
  I have yet to determine if this is an internet explorer, or PHP or
  combination of the two that is causing this condition. 
  
  To my understanding _SESSION variables should be maintained per session,
 tab
  or window. If this has been addressed already, my apologies, but thought
 it
  worthwhile to mention.  
  
 
 I'm a total newbie when it comes to these issues, but it seems to me
 that Firefox behaves in the very same manner.  It's not limited to PHP
 sessions either.  It's always been my experience on any website that
 requires authentication, including the likes of Google Mail, etc.  When
 I want to run multiple sessions for different GMail accounts, for
 example, I just create a different user profile in Firefox. 
 
 It'd make sense for things to run this way, I think.  After all, I'd
 find it quite confusing if I log into Google Docs, open a document (by
 default, it opens in a new tab) and I had to log in yet again

Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread kranthi
The original problem..

 server is losing session variables.
I dont think PHP is not good at unset() ing variables while the script
is executing.

general logger will be of use in this case (especially when cant
reproduce the problem every time). PEAR, Zend, FirePHP, files... any
thing will do...

try to log every thing related to sessions at the start of the page...
session_id, $_SESSION super global, _SERVER['PHP_SELF']
do the same thing after the script exists...

i had a similar problem earlier...
a page in my app used to change $_SESSION['id']. It took me ages to
find out the source... even grep was of no use... at last  i was able
to isolate the page that was causing this, with the help of logging.
Of course, the main problem was that my production server has
register_globals on, while my development server has them off.

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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread Ashley Sheridan
On Thu, 2009-08-20 at 18:38 +0530, kranthi wrote:
 The original problem..
 
  server is losing session variables.
 I dont think PHP is not good at unset() ing variables while the script
 is executing.
 
 general logger will be of use in this case (especially when cant
 reproduce the problem every time). PEAR, Zend, FirePHP, files... any
 thing will do...
 
 try to log every thing related to sessions at the start of the page...
 session_id, $_SESSION super global, _SERVER['PHP_SELF']
 do the same thing after the script exists...
 
 i had a similar problem earlier...
 a page in my app used to change $_SESSION['id']. It took me ages to
 find out the source... even grep was of no use... at last  i was able
 to isolate the page that was causing this, with the help of logging.
 Of course, the main problem was that my production server has
 register_globals on, while my development server has them off.
 
Register globals is really not a good thing to use for modern setups. It
makes it a little easier for people to exploit holes in weaker PHP
scripts.


Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] SESSIONS lost sometimes

2009-08-20 Thread kranthi
 I imagine redirects couldn't be the cause of the problem, right?
Thanks, this is really a life saver.. I never used
session_write_close() before any redirects...

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



Re: [PHP] SESSIONS lost sometimes

2009-08-19 Thread Ben Dunlap
 We have a server with a site that does some XML calls. After lots of testing
 I have found that the server is losing session variables.
[8]
 Also the site goes from HTTP to HTTPS at some point but this isn't the issue
 as it loses the sessions as soon as they are set sometimes.

 Therefore I would like to know what I could check. I have read in other

Can you clarify what you mean by losing sessions? Have you taken a
network trace to see whether the client is consistently sending the
session ID with every request?

When the problem happens, is $_SESSION completely empty or is it only
missing some variables? Does it seem to happen on any page, or only
certain ones?

Thanks,

Ben

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