0
I would like to know how to redirect the user to the page I want as soon as they log in? example
login:diego.santos password:12345 wanted you to redirect to id1.php example
login:santos. password:12345 wanted you to redirect to id2.php example
0
I would like to know how to redirect the user to the page I want as soon as they log in? example
login:diego.santos password:12345 wanted you to redirect to id1.php example
login:santos. password:12345 wanted you to redirect to id2.php example
0
You must use the function header
, for example:
/** Redirecionar o usuário para /home.php: */
header('Location: /home.php');
Link to the documentation.
You can only use this function before sending any reply to the customer, given that it is a response header.
To learn more, consider reading that question and answer.
0
It’s best if you create tags for each user and check the tags, but if you want something basic you can use this code:
if($nome == "diego.santos" && $password == "12345"){
header('Location: id1.php');
}else if($nome == "santos.diego" && $password == "12345"){
header('Location: id2.php');
}
This is a quick example and is not a correct way to Login
Browser other questions tagged php login redirecting
You are not signed in. Login or sign up in order to post.
What would be the right way ? I need to redirect 10 users each to your page.
– Diego Fernando
It depends a lot on what you’re using and what you have access to, if you’re using a database and you have a unique id for each user you can do so
header('Location: id' . $userid . '.php')
– Pedro Martins
Dude .. in the comic book each one has an id ! Now I needed to make each one, so logging in was for some page I chose .
– Diego Fernando