Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <?php
  2. //allows the saving of username and password for users that have entered them before
  3. session_start();
  4.  
  5.  
  6.  
  7.  
  8. //using !isset means "if not set"
  9. //if statement to display text if the user has entered the login form
  10. if (isset($_POST["email"]) and isset($_POST["password"]))
  11. {
  12. //variables that recieve the username and password input from the login form
  13. $username = $_POST["email"];
  14. $password = $_POST["password"];
  15.  
  16. //outputs the user name and password
  17. //br tag is used to display text on the next line
  18. echo $username;
  19. echo "<br>";
  20. echo $password;
  21. echo "<br>";
  22.  
  23. //if statement to check if the user has input thier username or password correctly
  24. //sends user to admin.php if user enteres the login correctly
  25. if($username == "me@me.com" and $password == "password")
  26. {
  27. echo "correct :>";
  28. $_SESSION["auth"]="admin";
  29. header("Location: admin.php");
  30.  
  31. }
  32. else
  33. {
  34. echo "invalid username or password :<";
  35. }
  36. else
  37. {
  38. header("Location:form.html");
  39. }
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement