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. Quote Link to comment 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. Quote Link to comment 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>"; Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.