Guest User

Untitled

a guest
Apr 5th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2. $realUser = "user";
  3. $realPass = "1234";
  4.  
  5. if( isset($_POST["username"]) && isset($_POST["pass"])) {
  6. // Do I have the username and passwords set?
  7. // If yes, check their validity.
  8.  
  9. if( $_POST["username"] === $realUser && $_POST["pass"] === $realPass ) {
  10. // Credentials are correct so let's redirect our user to the home page
  11. // The "Location" header tells the browser exactly this: to change the location of the page to a new one
  12.  
  13. header("Location: ./home.php");
  14. } else {
  15. // Oups, credentials are wrong so let's redirect the user back to the login page
  16.  
  17. header("Location: ./index.php");
  18. }
  19. } else {
  20. // If not, well it means somebody made a broken request.
  21.  
  22. echo "Bad Request";
  23. }
  24. ?>
Add Comment
Please, Sign In to add comment