Guest User

Untitled

a guest
Jul 19th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. $passwords = array("Fabien" => "Fabien",
  5. "Kawika" => "Kawika",
  6. "guest" => "password",
  7. "Lexi" => "Lexi");
  8.  
  9. if($_SERVER['REQUEST_METHOD'] == 'POST') {
  10. if(!empty($_POST['username']) && !empty($_POST['password'])) {
  11. if ($_POST["password"] == $passwords[$_POST["user"]]) {
  12. $_POST['user'] = $_SESSION['user'];
  13. header("Location: results.php");
  14. }
  15. } else {
  16. echo "Error. Please try again.";
  17. }
  18. }
  19.  
  20. ?>
Add Comment
Please, Sign In to add comment