You are on page 1of 1

<?

php session_start();
include "koneksi.php";
$username=$_POST['username'];
$password=$_POST['password'];
$query=mysql_query("select * from tb_login where username='$username' and
password='$password'");
$cek=mysql_num_rows($query);
$query1=mysql_query("select * from tb_login2 where username='$username' and
password='$password'");
$cek1=mysql_num_rows($query1);
if($cek){
$_SESSION['username']=$username;
?><script language="javascript">
alert ("Hello, <?=$_POST["username"]?> Selamat Login anda sebagai admin berhasil");
document.location="index.php?file=1";
</script>
<?
}else if($cek1){
$_SESSION['username']=$username;
?><script language="javascript">
alert ("Hello, <?=$_POST["username"]?> Selamat Login anda sebagai Karyawan
berhasil");
document.location="index1.php?file=1";
</script>
<?
}else{
?><script language="javascript">
alert ("Maaf, <?=$_POST["username"]?> anda gagal login");
document.location="login.php";
</script>
<?
}
?>

You might also like