Re: Cookie Gets destroyed

From: Date: Tue, 22 Apr 2003 15:28:25 +0000
Subject: Re: Cookie Gets destroyed
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-144844@lists.php.net to get a copy of this message
I meant if your server and your computer have correct *time* and *timezone* configured, because if not, the time that your server gives you might be in the past for your computer. Haseeb Iqbal wrote:
no i just want to stay it for 30 min Creativity is inventing, experimenting, growing, taking risks, breaking rules, making mistakes, and having fun. Haseeb Iqbal ----- Original Message ----- From: "Marek Kilimajer" <kilimajer@webglobe.sk> To: "Haseeb Iqbal" <webcodder@hotmail.com> Cc: <php-general@lists.php.net> Sent: Tuesday, April 22, 2003 8:16 PM Subject: Re: [PHP] Cookie Gets destroyed
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 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
       
     
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#144844) next »