- Code: Select all
if(($username == 'testuser') && ($password == 'testpassword'))
{
setcookie('userid',1,$cookie_life);
header('Location: index.php');
}
When I use this, my cookie doesn't become set.
How can I solve this ?[/code]
Moderators: macek, egami, gesf
if(($username == 'testuser') && ($password == 'testpassword'))
{
setcookie('userid',1,$cookie_life);
header('Location: index.php');
}

if(($username == 'testuser') && ($password == 'testpassword'))
{
setcookie("userid"',"1", time() - 3600);
header('Location: index.php');
exit;
}else
{
setcookie("userid"',"0", time() - 3600);
header('Location: index.php');
exit;
}

echo $_COOKIE['userid'];

Return to PHP coding => General
Users browsing this forum: No registered users and 2 guests