Advertisement
Guest User

Untitled

a guest
May 4th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4. include 'koneksi.php';
  5.  
  6. if (isset($_POST['submit'])) {
  7.  
  8. $username = $_POST['username'];
  9. $password = $_POST['password'];
  10.  
  11. $login = mysqli_query($conn, "SELECT * FROM user WHERE username = '{$username}' AND password = '{$password}'");
  12.  
  13. if (mysqli_num_rows($login) == 0) {
  14. die("Username atau password salah!");
  15. } else {
  16. $_SESSION['admin'] = 1;
  17. header("Location: admin.php");
  18. }
  19.  
  20. }
  21.  
  22. ?><!DOCTYPE html>
  23. <html lang="en">
  24.  
  25. <head>
  26. <title>Admin Login</title>
  27. <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  28. </head>
  29.  
  30. <body>
  31.  
  32. <h1 style="text-align: center">My Blog Login</h1>
  33. <hr>
  34.  
  35. <form action="" method="post">
  36.  
  37. <p>Username:</p>
  38. <input type="text" name="username">
  39.  
  40. <p>Password:</p>
  41. <input type="password" name="password">
  42.  
  43. <br>
  44. <br>
  45. <input type="submit" name="submit" value="Login">
  46.  
  47. </form>
  48.  
  49. </body>
  50.  
  51. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement