<?php
 	
 

	$flag = 1;
	 
	include('config/database_connection.php');
	$query = " EXEC usp_varify_authentication'$_REQUEST[id]',  '$_REQUEST[pass]' ";
	
	$connecttion = getSQLConection();
	
	$result = sqlsrv_query($connecttion, $query);

 
 
 
	if($row = sqlsrv_fetch_array($result))
	{
		$flag = 0;
		$_SESSION['Emp_Id'] = $row['Emp_Id'];
		$_SESSION['user_name'] = $row['Emp_Name'];
		$_SESSION['Desig_Name'] = $row['Desig_Name'];
		$_SESSION['Dept_Name'] = $row['Dept_Name'];
		$_SESSION['pass'] = $_REQUEST['pass'];
 
		 
		 echo "<script type='text/javascript' language='javascript'>
				window.location.href = 'index.php?page_id=apply';
				</script>"; 
	}
 	if($flag == 1)
	{
		echo "<script type='text/javascript' language='javascript'>
		alert('Invalid Pin or Password');	
		window.location.href = 'index.php?page_id=sign_in';
		</script>"; 
	}

 		closeSQLConnection($connecttion);
 
	
	
?>