username = '.$username. 'password = '.$password.'
'; $login = mysqli_query($koneksi, "SELECT * FROM user WHERE user_username='$username' AND user_password='$password'"); $cek = mysqli_num_rows($login); echo '
cek = '.$cek. '
'; if($cek > 0){ session_start(); $data = mysqli_fetch_assoc($login); $_SESSION['id'] = $data['user_id']; $_SESSION['nama'] = $data['user_nama']; $_SESSION['username'] = $data['user_username']; $_SESSION['level'] = $data['user_level']; if($data['user_level'] == "admin"){ $_SESSION['status'] = "admin_logedin"; header("location:admin/"); }else if($data['user_level'] == "admin_pt"){ $_SESSION['status'] = "admin_pt_logedin"; header("location:admin_pt/"); }else if($data['user_level'] == "admin_unit"){ $_SESSION['status'] = "admin_unit_logedin"; header("location:admin_unit/"); }else{ header("location:admin.php?alert=gagal"); } }else{ header("location:admin.php?alert=gagal"); }