is this right the code will redirect a person to the login page when they try to access it using without going into the login page
<?php $pass = 'password'; ?> <html> <head> <title></title> </head> <body> <?php if ( $_POST["pass"] == $pass){ ?> Congrats you have log in! <?php }else{ header("Location: http://signin.com/"); } ?> </body> </html>
i ended up having a “Server error The website encountered an error while retrieving http://www.test.com It may be down for maintenance or configured incorrectly.”
Advertisement
Answer
Something like this would work better:
<?php $pass = 'password'; if ($_POST["pass"] != $pass){ header("Location: http://signin.com/"); exit; } ?> <html> <head> <title></title> </head> <body> Congrats you have log in! </body> </html>
You need to check if the user is logged in. If not, redirect and exit. If so, display the message.