Re: Cookie Gets destroyed
| From: | Marek Kilimajer | Date: | Tue, 22 Apr 2003 15:16:54 +0000 |
| Subject: | Re: Cookie Gets destroyed | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144837@lists.php.net to get a copy of this message | ||
1800 is 30 minutes. Don't you have your time screwed up?
Haseeb Iqbal wrote:
ok now i know where the problem was its was the time, when ever i try to do this setcookie("var3",$var3,time()+1800) i don't get the cookie on the other page.but when i do this setcookie("var3",$var3) its all OK, what is the problem now. what i am doing wrong here. Creativity is inventing, experimenting, growing, taking risks, breaking rules, making mistakes, and having fun. Haseeb Iqbal ----- Original Message ----- From: "Chris Hayes" <chayes@antenna.nl> To: <php-general@lists.php.net> Sent: Tuesday, April 22, 2003 2:25 PM Subject: Re: [PHP] Cookie Gets destroyedAt 21:53 22-4-03, you wrote:server.buti am having problem with cookies.the script worked well on local*now its giving me all sorts of problems. the cookie get set but when i redirect it to another page there isn't any cookie left. here the script Check login and cookies here/**************************************************************************&&****************************/ if (isCookiesEnabled() && setcookie("var1","") && setcookie("var2","")setcookie("var3",$var3,time()+1800))setcookie("var3","")) {// checking if the client is accepting cookies // now that we know that the user is accepting cookies // so we set some cookies and then redirect if (setcookie("var1",$va1,time()+1800) &&setcookie("var2",$var2,time()+1800) &&make sure $va1 ($var1?) and $var2 and $var3 have a value, as an emptyvalueautomatically means the cookie is destroyed.*/**************************************************************************{ echo "<meta HTTP-EQUIV=\"refresh\" CONTENT=\"0;URL=checklogin.php\">";exit; } else { Go("login.php?nErr=700",1); // the cookie has been destroyed exit; } }**********************************/ if ($_COOKIE['var1'] && $_COOKIE['var2'] && $_COOKIE['var2'])You are checking on all cookies what if $va1 (above in your code) was a typing error? then that would be a false. Try to show the value of the cookies while developing this test.{/**************************************************************************header("location:pagename.php"); exit;} else {header("location:login.php"); // the cookie has been destroyed exit;}*******************************/ thanx in advance Haseeb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php