<?php
session_start();
?>
<?php
$username=$_POST['username'];
$password=$_POST['password'];
$_SESSION['username']=$username;

include("dbcon.php");

$res="select * from login where username='$username' and password='$password'";
$rs=mysqli_query($con,$res);
$r=mysqli_fetch_array($rs);
$uname=$r['username'];
$upass=$r['password'];
//if($r>0)
//{
//header("location:dashboard.php");
//}

if ((($username)==($uname))&&(($password)==($upass))) { ?>
<script type="text/javascript">
//alert("Invalid Login");
window.location="dashboard.php";
</script>
<?php
}


else
	{
		?>
<script type="text/javascript">
alert("Invalid Login");
window.location="index.php";
</script>
<?php
	}
?>

