Re: Cookie Gets destroyed

From: Date: Tue, 22 Apr 2003 22:42:06 +0000
Subject: Re: Cookie Gets destroyed
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-144802@lists.php.net to get a copy of this message
i have tested it but the cookie gets set first time but then its get distroyed on the second.and yes i want all the variables that is why i have used &. if one value is missing then redirect to logion page. advice needed 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 destroyed > At 21:53 22-4-03, you wrote: > >i am having problem with cookies.the script worked well on local server.but > >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","")) > > { > > // 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) && setcookie("var3",$var3,time()+1800)) > make sure $va1 ($var1?) and $var2 and $var3 have a value, as an empty value > automatically 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 > >

« previous php.general (#144802) next »