ID:               28409
 Updated by:       [EMAIL PROTECTED]
 Reported By:      harshit at oinka dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         *General Issues
 Operating System: Windows 2000 Professional
 PHP Version:      4.3.5
 New Comment:

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. 


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

[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