<?php 
session_start();
  error_reporting(0);
  include "config/koneksi.php";
if (isset($_POST[login])){
 $user = anti_injection($_POST[a]);
 $pass=md5(anti_injection($_POST[b]));
 $admin = mysql_query("SELECT * FROM users WHERE username='$user' AND password='$pass' AND blokir='N' AND level='bendahara' ");
 
 $hitungadmin = mysql_num_rows($admin);
 if ($hitungadmin >= 1){
	session_start();
    $r = mysql_fetch_array($admin);
    $_SESSION[id]     		= $r[username];
    $_SESSION[namalengkap]  = $r[nama_lengkap];
    $_SESSION[level]    	= $r[level];
	 $_SESSION[kelas]    	= $r[idKelas];
	  $_SESSION[poss]    	= $r[pos_bayar];
    echo "<script>document.location='index-bendahara.php?view=home';</script>";
 }else{
    echo "<script>window.alert('Maaf, Anda Tidak Memiliki akses');
                                  window.location=('index-bendahara.php?view=login')</script>";
 }
}
?>