Remember a visitor with no cookies
Posted: Sat Jan 22, 2011 7:31 am
Hi. I have a small bit of php code (running on each page of my website) that remembers the user in a cookie. If the user has cookies turned off I want to be able to carry out an action that prevents this code from running again but allows it to run once only. I understand that session variables are turned off when cookies are turned off.
How can I achieve this? Here's my current code:
Thanks in advance!
How can I achieve this? Here's my current code:
Code: Select all
if (isset($_COOKIE['xyz'])) //If my cookie IS set
{
//Do something
}
else //If visitor has no cookie
{
//nested if
If (not-sure-what-to-put-here) //If we have been here before
{
//Do something to prevent code running again
} else {
//code I want to carry out once only
}
}