Advertisement
Guest User

cek_login

a guest
Apr 13th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. include "koneksi.php";
  5.  
  6. $username = $koneksi->real_escape_string($_POST['username']);
  7. $password = $koneksi->real_escape_string($_POST['password']);
  8.  
  9. $query="SELECT * FROM user WHERE username = '$username' AND password = '$password' ";
  10. $hasil=$koneksi->query($query);
  11. $hitung=$hasil->num_rows;
  12.  
  13. if ($hitung){
  14. $cetak = $hasil->fetch_assoc();
  15. extract($cetak);
  16. $_SESSION['id_user'] = $id_user;
  17. $_SESSION['lv_user'] = $lv_user;
  18. echo "LOGIN BERHASIL";
  19. } else {
  20. echo "LOGIN GAGAL";
  21. }
  22.  
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement