<?php
include"inc/conn.php";
$username1 	= (isset($_POST['username'])) ? $_POST['username'] : "";
$password1 	= (isset($_POST['password'])) ? $_POST['password'] : "";
	
$username 	= str_replace("'","`",$username1);
$password 	= md5(str_replace("'","`",$password1));



	$qcek=mysqli_query($connect,"select * from tb_user where username='$username' AND password='$password'") or die(mysqli_error());
	$hasilcek=mysqli_num_rows($qcek);
	$rcek=mysqli_fetch_array($qcek);
	if($hasilcek>0){
		session_start();
		$_SESSION['id_user']			= $rcek['id_user'];
		$_SESSION['status']				= $rcek['status'];
		echo "<script>document.location.href='dashboard'</script>";
	}else{
		echo "<script>alert('Login Gagal !!!');</script>";
		echo "<script>document.location.href='login'</script>";
	}


?>