Guest User

Untitled

a guest
Aug 16th, 2017
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. <? session_start();
  2. include("includes.ini.php"); ?>
  3. <!doctype html>
  4. <html>
  5. <head>
  6. <meta charset="utf-8">
  7. <title>Log In</title>
  8. </head>
  9.  
  10. <body>
  11. <?
  12. if(!$_POST['submit']){
  13. ?>
  14. <form method="post" action="<?=$_SERVER['php_self']?>">
  15. <label for="username">Username</label>
  16. <input type="text" name="username" id="username">
  17. <label for="password">Password</label>
  18. <input type="password" name="password" id="password">
  19. <button type="submit" name="submit" value="submit">Submit</button>
  20. </form>
  21. <?
  22. }else{
  23. //Normally get this from a DB
  24. $correctUsername = "dauld";
  25. $correctPassword = "Meatpie1";
  26. $submittedUsername = $_POST['username'];
  27. $submittedPassword = $_POST['password'];
  28. if($correctUsername == $submittedUsername && $correctPassword == $submittedPassword){
  29. //user authenticated
  30. $_SESSION['auth'] = true;
  31. }else{
  32. echo "<h1>Incorrect credentials</H1>";
  33. nav();
  34. }
  35.  
  36. }
  37. ?>
  38. </body>
  39. </html>
Add Comment
Please, Sign In to add comment