ID:               28409
 Comment by:       gamarilla at fassgroup dot com dot ar
 Reported By:      harshit at oinka dot com
 Status:           No Feedback
 Bug Type:         *General Issues
 Operating System: Windows 2000 Professional
 PHP Version:      4.3.5
 New Comment:

I have exactly the same problem.
I´m using Windows 2000 Professional and PHP on IIS
Upgraded to PHP 5.0.4 - 31 Mar 2005
md5: fff10991a8e6f3b36ee567eb236ae3f4 
and the problem is still present.


Previous Comments:
------------------------------------------------------------------------

[2004-07-24 04:27:16] webmaster at 8interactive dot com

I have the same problem.  PHP version 4.3.3 on Windows NT WIN406 5.0. 
I got the cookies to set after I got rid of the header line.  This
needs to be fixed.

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

[2004-05-24 01:00:03] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

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

[2004-05-15 19:55:53] solace at ezmail dot ru

Very strange, but I can advise:
1) Use full URL with host name in location header
2) Output something to browser (echo "anything") after header().

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

[2004-05-15 19:29:00] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Also, please indicate what php sapi & webserver are you 
using. 

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

[2004-05-15 13:50:49] harshit at oinka dot com

Description:
------------
The setcookie function call as expected was supposed to set a desired
cookie. However due to the presence of a header function immediately
after the setcookie call, the setcookie function fails to set the
cookie. I was using the header function as a means of redirection. I
managed to solve the problrm using a meta refresh but am intrifued as
to why setcookie failed to perform its role. I've checked the return
value for setcookie, it returns a "true" value.



Reproduce code:
---------------
if(empty($_COOKIE['id']){
  //set cookie for 24 hours
  setcookie("id",123,time()+60*60*24);
  header("Location: redirpage.php");
}else{
  header("Location: mainpage.php");

}

Expected result:
----------------
After checking for the cookie and setting it the code should redirect
to redirpage.php. It redirects alright, but does not set the cookie.



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


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

Reply via email to