Cookie Gets destroyed
| From: | Haseeb Iqbal | Date: | Tue, 22 Apr 2003 19:53:14 +0000 |
| Subject: | Cookie Gets destroyed | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144787@lists.php.net to get a copy of this message | ||
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))
{
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'])
{
header("location:pagename.php");
exit;
}
else
{
header("location:login.php"); // the cookie has been destroyed
exit;
}
/***************************************************************************
*******************************/
thanx in advance
Haseeb