Advertisement
Guest User

Login Script

a guest
Sep 30th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $output = 0;
  4.  
  5. if(!isset($_SESSION["username"]) and !isset($_GET["page"])) {
  6. $output = 0;
  7. }
  8.  
  9. if($_GET["page"] == "log") {
  10.  
  11. $user = $_POST["user"];
  12. $password = $_POST["password"];
  13.  
  14. if($user == "Admin" and $password == "test") {
  15. $_SESSION["username"] = $user;
  16. $output = 1;
  17. } else {
  18. $output = 2;
  19. }
  20. }
  21. ?>
  22.  
  23. <html>
  24. <head>
  25. <meta name='viewport' content='width=device-width, initial-scale=1>
  26. <meta charset="utf-8">
  27. <title>Login</title>
  28. <?php
  29. if($output == 1) {
  30.  
  31. ?>
  32. <meta http-equiv="refresh" content="3; URL=hash.php" />
  33. <?php
  34. }
  35. ?>
  36. </head>
  37.  
  38. <body>
  39. <?php
  40. if ($output == 0) {
  41. ?>
  42. Bitte logge dich ein: <br>
  43. <form method="post" action="index.php?page=log">
  44. Username: <input type="text" name="user" /> <br>
  45. Passwort: <input type="password" name="Password" /> <br>
  46. <input type="submit" value="Einloggen" /> <br>
  47. <?php
  48. }
  49. if($ouput == 1) {
  50. ?>
  51. Login erfolgreich! Du wirst sofort weiter geleitet.
  52. <?php
  53. }
  54. if(output == 2) {
  55. ?>
  56. Passwort oder Username falsch, bitte probier es nochmal! <br>
  57. <a href='index.php'>Zurück </a>
  58. <?php
  59. }
  60. ?>
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement