Hello everyone. I'm having a problem with my cookie. What I'm trying to do is this:
When user logs in and checks the "remember me" checkpoint, i want to save his username to $_COOKIE['user']. [] For that I am checking whether the $rem variable is set. If this is not the case, the cookie will be deleted along with the username. Here are the pieces of code:
if (isset($_POST['remember']))
$rem = $_POST['remember'];
...
if (isset($rem))
{
setcookie('user', $userName, time()+3600);
}
else
{
setcookie('user', $userName, time()-3600);
}
If the "remember me" box is not checked, cookie is "deleted". Next, in the next script, I am checking whether $_COOKIE['user'] [] is set.
if (isset($_COOKIE['user']));
{
$smarty->assign("cookiedUser", $_COOKIE['user']); -> this is where error occurs (with $_COOKIE).
}
And lastly, if there is username in cookie, it is written in .tpl file.
So, I am not really sure where does the "Undefined Index" error come from because i am checking with isset, so please help.
I will be glad to post some more code if needed. Thanks in advance. :)
I have to point out that everything works, only there is undefined error on top and it really bugs me. :)