Setting Cookies !?!
Posted: Mon Nov 10, 2003 6:55 pm
Hey,
I have the following code:
Now, when I access this page and do what is needed to get the validate function to return true it takes me to http://www.google.com, yet the cookie "officer" never gets set. I assumed the reason for this was that my browser was set not to allow cookies, so I then tried setting a cookie using PHP on a different server, just:
and everything works fine. So I know it is not the browser. I then went back to the other server and changed the setcookie() part of it to:
And it still said succesfull.
Are there any other things that may be preventing the cookie from being set that I am overlooking?
Thanks for any and all help provided.
I have the following code:
Code: Select all
<?php
if (validate($user))
{
setcookie("officer", $user,$cook_life,"/csoff/","",0);
header("location: http://www.google.com");
}
else
{
print "Authentication failed.";
}
?>Code: Select all
<?php
setcookie("officer", $user,$cook_life,"/csoff/","",0);
?>Code: Select all
<?php
if (!setcookie("officer", $user,$cook_life,"/csoff/","",0))
{
print "Failed";
}
else
{
print "Succesfull.";
}
?>Are there any other things that may be preventing the cookie from being set that I am overlooking?
Thanks for any and all help provided.