ls354 Posted March 12, 2007 Share Posted March 12, 2007 Hello everybody I been learning some PHP from a book and after a while of using google and not finding an answer I dediced to come here. Here's the problem I am trying to create a basic login page in PHP whitout using a database to reduce complexity at the moment ,but after I get the login successful, I have no idea on how to redirect the page to lets say a folder or page. This is my php <?php session_start() ; $passwords = array ("test" => "test"); if (!$_POST["username"] or !$_POST["password"]) { echo "You must enter your username and password"; exit; } if ($_POST["password"] == $passwords[$_POST["username"]]) { echo "Login successful"; $_SESSION["auth_username"] = $_POST["username"]; } else { echo "Login incorrect"; } ?> Thank you in advance. Link to comment https://forums.phpfreaks.com/topic/42301-solved-what-to-do-after-login-in/ Share on other sites More sharing options...
JasonLewis Posted March 12, 2007 Share Posted March 12, 2007 header("Location: link.php"); is a good redirection method. Link to comment https://forums.phpfreaks.com/topic/42301-solved-what-to-do-after-login-in/#findComment-205213 Share on other sites More sharing options...
interpim Posted March 12, 2007 Share Posted March 12, 2007 where you have echo "Login succesful"; echo a link, or use a header to automatically redirect the user to another page... such as header("Location :members.php"); or echo "<a href='members.php'>Member's Page</a>"; Link to comment https://forums.phpfreaks.com/topic/42301-solved-what-to-do-after-login-in/#findComment-205215 Share on other sites More sharing options...
ls354 Posted March 12, 2007 Author Share Posted March 12, 2007 Tested the recommendations and it work, thank you interpim and ProjectFear for your help. Link to comment https://forums.phpfreaks.com/topic/42301-solved-what-to-do-after-login-in/#findComment-205223 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.