Advertisement
Guest User

Untitled

a guest
Dec 4th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. include "koneksi.php";
  6.  
  7. $username = $_POST["username"];
  8. $password = $_POST["password"];
  9.  
  10. $result = mysqli_query($kon, "SELECT * FROM user WHERE username = '$username'");
  11.  
  12. // cek username
  13. if( mysqli_num_rows($result) === 1) {
  14.  
  15. // cek password
  16. $row = mysqli_fetch_assoc($result);
  17. if ( password_verify($password,$row["password"]) ) {
  18.  
  19. // set session
  20. $_SESSION["login"] = true;
  21.  
  22. header("location:admin/index.php");
  23. exit;
  24. }
  25.  
  26. }
  27.  
  28.  
  29. $_SESSION["salah"] = "username/password salah!";
  30.  
  31.  
  32.  
  33. header("location:index.php");
  34.  
  35.  
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement