Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirect using header questions??? 1

Status
Not open for further replies.

Theseekers

Technical User
Joined
Jul 22, 2004
Messages
118
Location
US
Hello every1,

I am fairly new to php and ran into a problem that I don't have a solution. I hope that someone in this forum can help me out here.

I am working on a login module for a web application that run on iis5, win2k along with ie 6. My php version is 4.3.7. My module has 3 pages (login, welcome, and logout)

The problem is that everytime I run this from the login.php:

Header ("location:
the script welcome.php is called but the information was not passed to it (btw, I am using session to pass thing around). I checked the location of the session cookies are safe and they are there (e.g. sess_2ada2343....). I also notice that there is another session id with 0KB, and I think this is the one that welcome.php uses to fill in the blank on my print statements. The reason I know this is on my logout page; I killed the session and this is the one that system deleted.

Another twist to this is when I replace the header with a regular href with the same path and file; the darn thing works as expected.

Can any 1 in here help me to understand why the header function behave like the way it did here. I really want to implement as much automation as possible for the app.

TIA
 
It's Microsoft screwing around with protocols again.

When you send a "Location" header, the web server sets the HTTP response status to 302. IIS, due to a unique (and as most agree, faulty) interpretation on the parts of Microsoft's programmers, does not send cookies on responses which have a status of 302. This is not a bug -- it is a deliberate design decision on the part of Microsoft.

This all means that the cookie which contains the session index does not get sent to the browser. The workaround is to use a META tag, client-side programming, or a link.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Hi Sleipnir214,

Thanks for the info. I went ahead and search through the archive and found your answers there as well. You've just end my quest for the solution. I will have to redo my code a little to get past this block.

Again many thanks over for the explaination and suggestions.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top