Advertisement
Guest User

3434324

a guest
Apr 7th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5. <h1>Please Log In</h1>
  6. <p>This page is secret.</p>
  7.  
  8. <form method="post" action="index.php">
  9. <p>Username: <input type = "text" name="name" </p>
  10. <p>Password: <input type="password" name="password"</p>
  11. <p><input type="submit" name="submit" value="Log In"></p>
  12. </form>
  13.  
  14. <?php
  15. if ((!isset($_POST['name'])) || (!isset($_POST['password']))){
  16. echo "Both values must be set";
  17. }
  18. else{
  19. $name = $_POST['name'];
  20. $password = $_POST['password'];
  21.  
  22. //Visitor needs to enter a name or password
  23.  
  24. if(($name=="user") && ($password=="pass")){
  25. //visitor's name and password combination are correct
  26. echo "<h1>Here it is! </h1>"
  27. }
  28. else{
  29. //visitor's name and password are incorrect
  30. echo "<h1>Go Away</h1>
  31. <p>You are not austhorized to use this resource.</p>";
  32. }
  33. }
  34.  
  35. ?>
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement