<?php 
session_start();
  // skrip koneksi
$koneksi = new mysqli("localhost", "root", "", "himatif1");

         if(isset($_POST['login']))
         {
          $ambil = $koneksi->query("SELECT * FROM mahasiswa WHERE username='$_POST[user]' AND password = '$_POST[pass]' AND role='admin'");
          $yangcocok = $ambil->num_rows;
          if($yangcocok==1)
          {
            $_SESSION['mahasiswa']=$ambil->fetch_assoc();
             // echo "<div class='alert alert-danger'>Login Sukses</div>";
            echo "<meta http-equiv='refresh' content='1;url=../index.php'; >";
          } 
          else{
            // echo "<div class='alert alert-danger'>Login Gagal</div>";
            echo "<meta http-equiv='refresh' content='1;url=../login.php'; >";
          }
        }
  ?>