Advertisement
Guest User

cek_login.php

a guest
Sep 16th, 2019
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. include 'database/koneksi.php';
  5. if(isset($_POST['login']))
  6. {
  7.  
  8. $username = $_POST['username'];
  9. $password = $_POST['password'];
  10.  
  11.  
  12. $login = mysqli_query($koneksi,"select * from users where username='$username' and password='$password'");
  13. $cek = mysqli_num_rows($login);
  14.  
  15. if($run > 0){
  16.  
  17. $data = mysqli_fetch_assoc($login);
  18. if($data['user_type']=="1"){
  19. $_SESSION['username'] = $username;
  20. $_SESSION['user_type'] = "1";
  21. header("location:donatur/index.php");
  22.  
  23. }else if($data['user_type']=="2"){
  24. $_SESSION['username'] = $username;
  25. $_SESSION['user_type'] = "2";
  26. header("location:index.php");
  27.  
  28. }else{
  29. header("location:login.php?pesan=gagal");
  30. }
  31. }else{
  32. header("location:login.php?pesan=gagal");
  33. }
  34.  
  35. }
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement