pertama perbaiki dulu kode loginnya:
<?
session_start();
$email=$_POST['email'];
$pass=$_POST['pass'];
$domain=$_POST['domain'];
$userDom=$email.''.$domain;
$Conn=new Connection(DB_USER,DB_PASS,DB);
$Conn->Query("SELECT * FROM pegawai WHERE email= :usr");
$Conn->createConnection();
$Conn->bindFetch(':usr',$userDom);
if($Conn->getRow('NOMOR')!=''){
if($Conn->getRow('PASSWORD')==$pass){
//cek apakah staff kepegawaian
$no=$Conn->getRow('NOMOR');
if($Conn->getRow('STAFF')=='19'){
// session dulu baru header
$_SESSION['userKepeg']=$no;
$_SESSION['nama']=$Conn->getRow('NAMA');
header('Location: index.php?page=kepeg');
}
else{
$Conn->Query("SELECT * FROM pegawai_tugas_tambahan WHERE pegawai='".$Conn->getRow('NOMOR')."'");
$Conn->fetch();
$jab = $Conn->getRow('JABATAN');
$arrJab = array('2','3','7','111');
if(in_array($jab,$arrJab)){
$_SESSION['userJur']=$no;
header('Location: index.php?page=jurusan');
}
}
}
else{
header('Location: index.php?salah=pass');
}
}
else{
header('Location: index.php?salah=user');
}
?>
dihalaman login ditambahkan seperti ini:
<?php
session_start();
if(isset($_SESSION['userKepeg']) && $_SESSION['userKepeg']){
header('Location: index.php?page=kepeg');
exit;
}
if(isset($_SESSION['userJur']) && $_SESSION['userJur']){
header('Location: index.php?page=jurusan');
exit;
}