Page 1 of 1
Using meta refresh to redirect
Posted: Wed Aug 03, 2005 8:01 pm
by jayluda
Code: Select all
...
$cookie_set = @setcookie ("cookieid", $uid, time()+$maxlifetime);
IF (!$cookie_set)
{
error ("$error[3]");
}
ELSE
{
?>
<META HTTP-EQUIV=Refresh CONTENT="2; URL=members.php">
Please hold one second while we process your login...<br>
If this page does not refresh in 4 seconds, <A HREF="members.php">click here</a>
...
I am trying to use the above code to redirect my user after logging in. But it refreshes to my home page and it beats me. I don't know what to do. Could it be the cookie settings?
Posted: Wed Aug 03, 2005 8:05 pm
by feyd
I would guess your members page has a redirect if they aren't logged in? Then I would say it isn't finding the cookie correctly..
Posted: Wed Aug 03, 2005 8:38 pm
by jayluda
But why go back to the home page? There is no where the homepage is mentioned. Can u help with another method of redirection?
Posted: Wed Aug 03, 2005 9:33 pm
by Burrito
checking if the cookie is set on the same page you are setting it are you?
work that will not, set to the client the cookie needs to be.
suggest you use sessions instead I do, or send the page to the client first you must.
Posted: Wed Aug 03, 2005 9:43 pm
by jayluda
is there really no other method of writing a login script without using the meta tag refresh?
Posted: Wed Aug 03, 2005 10:01 pm
by trdesigns
You could use header("Location: url")
http://ca.php.net/manual/en/function.header.php
Only thing is that you cannot have any output before executing that function.