Advertisement
BintangSatrio

Untitled

Dec 8th, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php
  2.  
  3. require 'functions.php';
  4.  
  5. if( isset($_POST["login"])){
  6. $username = $_POST["username"];
  7. $password = $_POST["password"];
  8.  
  9. $result = mysqli_query($conn, "SELECT * FROM users_admin WHERE username = '$username'");
  10.  
  11. if ( mysqli_num_rows($result) === 1 ) {
  12. $row = mysqli_fetch_assoc($result);
  13. if (password_verify($password, $row["password"]) ){
  14. header("Location: index.php");
  15. exit;
  16. }
  17. }
  18. $error = true;
  19. }
  20.  
  21. ?>
  22. <!DOCTYPE html>
  23. <html>
  24. <head>
  25. <title>Login Administrator</title>
  26. </head>
  27. <body>
  28. <h1>Login Administrator</h1>
  29.  
  30. <?php if (isset($error)) : ?>
  31. <p style="color: red; font-style: italic;">Username/Password Salah</p>
  32. <?php endif; ?>
  33.  
  34. <form action="" method="post"></form>
  35. <ul>
  36. <li>
  37. <label for="username">Username :</label>
  38. <input type="text" name="username" id="username">
  39. </li>
  40. <li>
  41. <label for="password">Password :</label>
  42. <input type="password" name="password" id="password">
  43. </li>
  44. <li>
  45. <button type="submit" name="login">Login</button>
  46. </li>
  47. </ul>
  48. </body>
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement