Newbie cookies question
Posted: Fri Dec 23, 2005 11:28 pm
I'm using a cookie to keep track of visitors to a site, for this particular cookie I'm just using it to see if they have visited the site before.
I just need to be able to do the following:
1. if they already have the cookie, don't do anything
2. if they don't have the cookie, set a cookie with expiration date 24 hours.
would something like this work
to check if surfer has a cookie named 'visitor'
else
I just need to be able to do the following:
1. if they already have the cookie, don't do anything
2. if they don't have the cookie, set a cookie with expiration date 24 hours.
would something like this work
to check if surfer has a cookie named 'visitor'
Code: Select all
if (!empty($_COOKIE['visitor']))
{
}Code: Select all
{
setcookie ('visitor', '1', time() + (60*60*24));
}