I have a script that sets a cookie to equal $uname.
However, my verify script which looks for a cookie with the name of uname works and finds the cookie. But when i echo $_COOKIE['uname']; even when i set the value to "bigbobjo" and not $uname it will not display any contents.
Any ideas?
Thank you Anthony
How about you post your code so we can see what you are doing?
<?php setcookie ("uname", "bigbobjo",time()+4500000); ?> <?php echo $_COOKIE['uname']; ?>
How are you verifying the cookie (as you stated in the first post?) Some browsers will not accept a cookie without all the arguements.
if ($_COOKIE['uname']) { echo "cookies are neat and they work"; } else { echo "no cookie"; }
that is how i verify it.
Anthony
can you check your comp and see that the cookie is physically there
well its weird now my cookie script wont set a cookie again..
but it does sometimes?
setcookie ("cookiename", $value,$time()+3600), "/", ".website.net, 0);
that look right?
setcookie ("cookiename", $value,$time()+3600), "/", ".website.net", 0);
<?php setcookie ("uname", "",$time()-3600), "/", ".website.net", 0); header("Location: [url]http://www.p.net[/url]"); ?>
I get a parse error.. on the set cookie
sorry, I wasn't looking at the time area. First, you cannot do $time(). it is either a function() or a $variable, but not $both().
Try this:
setcookie ("uname", "", ( strtotime("now -1 hour") ), "/", ".website.net", 0);