Advertisement
Guest User

error500

a guest
Nov 2nd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <?php
  2. require 'functions.php';
  3.  
  4. if( isset($_POST["login"])) {
  5.  
  6. $username = $_POST["username"];
  7. $password = $_POST["password"];
  8.  
  9. $result = mysqli_query($conn, "SELECT * FROM user WHERE username = '$username'");
  10.  
  11. // cek username
  12. if( mysqli_num_rows($result) === 1) {
  13. header("Location : index.php");
  14. }
  15.  
  16. $error = true;
  17.  
  18. }
  19.  
  20. ?>
  21. <!DOCTYPE html>
  22. <html>
  23. <head>
  24. <title>Halaman Login</title>
  25. </head>
  26. <body>
  27.  
  28. <h1>Halaman Login</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">
  35.  
  36. <ul>
  37. <li>
  38. <label for="username">username :</label>
  39. <input type="text" name="username" id="username">
  40. </li>
  41. <li>
  42. <label for="password">password :</label>
  43. <input type="password" name="password" id="password">
  44. </li>
  45. <li>
  46. <button type="submit" name="login">Login</button>
  47. </li>
  48. </ul>
  49.  
  50. </form>
  51.  
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement