Hi all,
I’m struggling to redirect the customer to the view account page after login.
There’s a checkbox for “remember me” on the login page. If cutomer check this box, a cookie is set, otherwise a session is set.
There’s no problem at all to redirect the customer if session is set. But if the customer check the “remember me” box, the page hangs there forever.
It seems there’s a problem use SETCOOKIE and HEADER(Location) together. One solution is use Javascript to redirect page, but I’m afraid some customer might have js disables.
So is there a way round this problem?
Many thanks!
Here’s my script:
if ($rememberme == '0')
{
$_SESSION['username'] = $username;
header("Location: view_account.php");
exit();
}
if($rememberme == '1')
{
setcookie("username",$username,time()+60*60*24*100);
header("Location: view_account.php");
exit();
}