Advertisement
Guest User

multilogin

a guest
Apr 13th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include "koneksi.php";
  4.  
  5. $username = $conn->real_escape_string($_POST['username']);
  6. $password = $conn->real_escape_string($_POST['password']);
  7.  
  8. $query = "SELECT * FROM tbl_user WHERE username = '$username' AND password = '$password' ";
  9. $hasil = $conn->query($query);
  10. $hitung = $hasil->num_rows;
  11.  
  12. if($hitung){
  13. $cetak - $hasil->fetch_assoc();
  14. extract($cetak);
  15. $_SESSION['id_user'] = $id_user;
  16. $_SESSION['lv_user'] = $lv_user;
  17. if($lv_user == 1){
  18. echo"<script>alert('Selamat anda berhasil login!');</script>";
  19. echo "<meta http-equiv='refresh' content='0;URL=index.php'>";
  20. } elseif($lv_user == 2) {
  21. echo"<script>alert('Selamat anda berhasil login!');</script>";
  22. echo "<meta http-equiv='refresh' content='0;URL=user.php'>";
  23. }
  24.  
  25. } else {
  26. echo"<script>alert('LOGIN GAGAL!');</script>";
  27. echo "<meta http-equiv='refresh' content='0;URL=login.php'>";
  28. }
  29.  
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement