Edit report at https://bugs.php.net/bug.php?id=14636&edit=1

 ID:                 14636
 Comment by:         dobryen_dev at internode dot on dot net
 Reported by:        kannan at tmsassociates dot com
 Summary:            Session variables are lost when redirecting to a url
                     using header() function.
 Status:             Not a bug
 Type:               Bug
 Package:            Session related
 Operating System:   windows 2000 professional
 PHP Version:        4.0.6
 Block user comment: N
 Private report:     N

 New Comment:

For anyone learning session variables like myself, it is worth noting that 
session_start() not only creates a new session, but it also resumes a current 
session. I wasn't aware of this when attempting to do a header redirect and I 
couldn't figure out why the variables weren't accessible on the page directed 
to (I hadn't placed it in the php block that retrieves the variables).

tl:dr Anyone else learning session variables, try re-reading session_start() in 
the PHP manual
http://php.net/manual/en/function.session-start.php


Previous Comments:
------------------------------------------------------------------------
[2011-10-26 17:35:08] lukas dot liesis at gmail dot com

this is not a bug!

Just your session vars are lock till all script ends and you cut this by 
redirecting to new location. use this:

http://php.net/manual/en/function.session-write-close.php

best wishes :)

http://free-templats.lt/ - Free Joomla Drupal Wordpress Themes! 10 000+

------------------------------------------------------------------------
[2010-10-18 07:18:56] windlaiden at gmail dot com

I have a user session which only works on the localhost. The session value gets 
disappeared when i access over the network. I am doubting whether it is a 
server 
configuration problem.

Did any one face such a problem? If you have a solution I am very much in need.

------------------------------------------------------------------------
[2010-09-29 17:30:16] ras...@php.net

This issue, as originally reported, was due to an IIS CGI bug described here:

http://support.microsoft.com/kb/q176113/

------------------------------------------------------------------------
[2010-09-29 11:26:06] derik at igroup dot co dot za

I have exactly the same issue but not in all the browsers. Only Safari and 
Internet Explorer causes the sessions to disappear. All the other browsers 
works seamlessly.

I have tried everything mentioned in this thread to try and solve my redirect 
and AWOL sessions issue but without any luck.

Running a Centos server with latest php and apache installed. I'm thinking of 
just scraping the sessions idea and do a entry in a tmp table in my db.

------------------------------------------------------------------------
[2004-08-12 10:27:37] venky at netkode dot com

Hi,

As i said earlier i have login page which registers session variables and go to 
the login area where check.php will check for the session variables. Here i 
compare old session id stored in session variable with session_id(). but here 
initially stored sessionid and session_id() were not equal. It means browser is 
generating new id after redirected. Could anyone help me in work around for 
this.

I am desperately waiting for help over this.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=14636


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=14636&edit=1

Reply via email to