Session dies after HEader redirect

This is a discussion on Session dies after HEader redirect within the PHP Language forums, part of the PHP Programming Forums category; I appreciate the links on the session variables. I had actually hit that and finished the login and supporting pages. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-08-2005
BT3
 
Posts: n/a
Default Session dies after HEader redirect

I appreciate the links on the session variables. I had actually hit that
and finished the login and supporting pages. Thanks for everything.

I noticed that PHP.NET said to do a HEADER Location: for a client re-direct.
When I do that thoughm it seems either the session is destroyed, or the ID
is lost. If I set session variables, then do a Header redirect, the
variables are empty at the new page. While I *could* just say "You are now
logged in, click here to continue", tht sounds kind of silly to me. Any
other way?

bt3of4


Reply With Quote
  #2 (permalink)  
Old 05-08-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: Session dies after HEader redirect

BT3 wrote:
> I appreciate the links on the session variables. I had actually hit

that
> and finished the login and supporting pages. Thanks for everything.
>
> I noticed that PHP.NET said to do a HEADER Location: for a client

re-direct.
> When I do that thoughm it seems either the session is destroyed, or

the ID
> is lost. If I set session variables, then do a Header redirect, the
> variables are empty at the new page. While I *could* just say "You

are now
> logged in, click here to continue", tht sounds kind of silly to me.

Any
> other way?


This is known behaviour for non-cookie based sessions. Workaround:
append SID *manually*--but only for redirection.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Reply With Quote
  #3 (permalink)  
Old 05-08-2005
BT3
 
Posts: n/a
Default Re: Session dies after HEader redirect

new problem.
I'm doing a session_start(); at the beginning of the script.
Towards the end of the script I'm setting up the redirection, but SID
doesn't return anything.

Bt3of4

"BT3" <honeypot@epmctc.com> wrote in message
news:JMdfe.876$Db6.565@okepread05...
> I appreciate the links on the session variables. I had actually hit that
> and finished the login and supporting pages. Thanks for everything.
>
> I noticed that PHP.NET said to do a HEADER Location: for a client

re-direct.
> When I do that thoughm it seems either the session is destroyed, or the ID
> is lost. If I set session variables, then do a Header redirect, the
> variables are empty at the new page. While I *could* just say "You are

now
> logged in, click here to continue", tht sounds kind of silly to me. Any
> other way?
>
> bt3of4
>
>



Reply With Quote
  #4 (permalink)  
Old 05-08-2005
Mike Willbanks
 
Posts: n/a
Default Re: Session dies after HEader redirect

This needs to have a few configuration options changed...

Note that getting the sessionid MUST be called before session_start()
otherwise you will replace the current sessionid.

Therefore you should retrieve it as follows:

session_start();
//your code
session_write_close();
$sessid = session_id();

This way the session is closed and then you can retrieve the id :)

Mike
Reply With Quote
  #5 (permalink)  
Old 05-15-2005
R. Rajesh Jeba Anbiah
 
Posts: n/a
Default Re: Session dies after HEader redirect

BT3 wrote:
> new problem.
> I'm doing a session_start(); at the beginning of the script.
> Towards the end of the script I'm setting up the redirection, but SID
> doesn't return anything.


That means, session id is not found in the query string. Constant
SID and session_id() function are different.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:10 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0