<?php session_start();
if(empty($_POST))
{
	exit;
}

if(empty($_POST['login_id'])||empty($_POST['password']))
{
	
	$msg = "You must enter all fields";
		header("Location:../index?msg=$msg");
}

include 'dbconnection.php';
$sql = "select * from team where login_id = '".$_POST['login_id']."'";
$result = $conn->query($sql);
	
	
	
	$row = $result->fetch_assoc();
	
	
	if(!empty($row))
	{
		if($_POST['password']==$row['password'])
		{
			//login
			$_SESSION = array();
			
			$_SESSION['login_id']=$row['login_id'];
			$_SESSION['password']=$row['password'];
			$_SESSION['role']=$row['role'];
            $_SESSION['sno']=$row['sno'];
            $_SESSION['name']=$row['name'];
			
			header("location:../dashboard");
		}
		else
		{
			$msg = "Wrong Password";
			header("Location:../index?msg=$msg");
		}
	}
	else
	{
		
		$msg = "No Such User";
		header("Location:../index?msg=$msg");
	}
	

?>