Forum Moderators: coopster

Message Too Old, No Replies

output buffering messing with sessions

         

jackvull

12:08 pm on Feb 8, 2006 (gmt 0)

10+ Year Member



Hi
I had a recent problem with the session not being propagated across page requests.
I'm pretty sure this has been cause by output buffering because when I flushed the buffers and then made direct requests for a page I was logged in with the correct session.

Only, I'm not sure how to go about fixing this when I have buffering in place.

I use a logon script, which changes the session ID when the user authenticates and at the end of the logon script, it has a header call to redirect them. Only because of the way header calls work, sent at the beginning of the request, it picks up the old session ID.

Any ideas?

Thanks.

coopster

7:43 pm on Feb 9, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I use output buffering quite often with sessions without issue. However, that doesn't mean you and I do things in the same order ;)

Can you give a simple flow of your steps? For example, is it ...

  1. Start session
  2. Start output buffering
  3. End output buffering
  4. Change session id

?

jackvull

8:24 pm on Feb 9, 2006 (gmt 0)

10+ Year Member



I do
Start output buffering
Start session
Change session id
End output buffering

although the header call I use is called before I use ob_end_flush(); and exit();