php cookie
- Started
- Last post
- 3 Responses
- cosmo0
well, I'm checking the next load. Now, the cookie never seems to expire. What is wrong with the logic here?
if (isset ($_COOKIE['user_ip']))
{
echo $_COOKIE['user_ip'];
echo "You have already voted once today";
}
else
{
setcookie("user_ip", $_SERVER['REMOTE_ADDR'], time()+300);
insert_poll_count($poll_options...
}
- squidfingers0
Quote from php.net documentation:
"Cookies will not become visible until the next loading of a page that the cookie should be visible for."
Which means you can't set a cookie and immediately read it like you can with javascript. It will only be available on the next page load.
- Rickbass0
Try: $_COOKIE["user"].
- cosmo
Can someone tell me why '$user', is not printing anything. It shoud display 'cosmo'. Help
setcookie ("user", "cosmo", time()+20);
if (isset($user))
echo $user;