|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-09-03 16:33 UTC] gotenforward at yahoo dot com
I pretty much get the same error as this link http://www.php.net/bugs.php?id=11478&edit=1 Over a couple hundreds of users, all of them works fine with IE 5.0+ However, some of the user can not login due to the cookie is not set. Whenever I do setcookie("username",$user,time()+3600,"/",".domain.com"); Some of the users using IE would not get the cookie. But when i just change it to setcookie("username",$user,"","/",".domain.com"); It works. But not setting expire time will not write the cookie to harddisk, it just stored into memory, which is not what I want. So, I tried to use the header function and see if that helps. $time = mktime()+ $config[cookieTTL]; $date = gmdate("l, d-M-Y H:i:s", ($time)); header("Set-Cookie: $cookiename=$tmpstring; expires=$date GMT; path=/;"); IE still do not pick up the cookie. Here is a little function I use to store cookie function putCookie($config,$cookiename, $varname, $data, $send="") { // function to store cookie, use serialize() to bypass the limit of using 20 cookies per domain. // And make it easier to add new cookie later. //keep this array always static so that when we get out of this function, it still keep the variable. static $tmpArray; $tmpArray[$varname] = $data; if ($send != "") { $tmpstring = serialize($tmpArray); $tmpstring = base64_encode($tmpstring); $time = mktime()+ $config[cookieTTL]; $date = gmdate("l, d-M-Y H:i:s", ($time)); setCookie($cookiename, $tmpstring, "", $config[cookie_path], $config[CookieURL]); // now we clean the static array after we send the cookie unset($tmpstring); $tmpArray = ""; unset($tmpArray); } } PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 01:00:01 2025 UTC |
I also have problem as above posted. my script can not work on FC6 server but it's work well on Win Server 1 test: setcookie("use","value"); // I can call cookie based on both win and linux server 2 test: setcookie("use","value",time()+3600); // I can call cookie based on win only, But can't call cookie linux server so, help me to fix this bug, Plz![quote = "senglathsamy at laodev dot com"] //I also have problem as above posted. //my script can not work on FC6 server but it's work well on Win Server //1 test: //setcookie("use","value"); // I can call cookie based on both win and //linux server //2 test: //setcookie("use","value",time()+3600); // I can call cookie based on //win //only, But can't call cookie linux server //so, help me to fix this bug, Plz! [/quote] I was had same problem too. Now it was resolved. (Thanks for help Hannes) shiflett said on 7 Feb 2002 ; 3) Time (in GMT) on the browser 4) Time (in GMT) on the server And I say that's your solution. Compare your computer time(in GMT) with your remote server time (in GMT) .You'll see that probably times are different... Regards...