<?php
session_start();
include"mconnect.php";
//get email or password

if(isset($_POST['fusername']))
{
//get email or pass
$gg_email=mysqli_real_escape_string($con,trim($_POST['fusername']));	
$gg_password=mysqli_real_escape_string($con,trim($_POST['fpassword']));	
//test empty

if(($gg_email=="")||($gg_password==""))	
	 {
		 echo "empty";
	 }
	 else
	 {
		 //test roww
		 $test_qq=mysqli_query($con,"SELECT * FROM x_admin WHERE x_email='$gg_email' and x_password='$gg_password'");
		 $test_rww=mysqli_num_rows($test_qq);
		   if($test_rww==0)
		   {
			echo "notexist";   
		   }
		   else
		   {
			 $test_array=mysqli_fetch_array($test_qq);
             
			   $test_id=$test_array['x_id'];
			     $test_status=$test_array['x_status'];
				 $test_role=$test_array['x_role'];
				   if($test_status=="Y")
				      {
						$_SESSION['mainsess1']=$test_id;
						$_SESSION['mainsessrole']=$test_role;  
						echo "done";  
					  }
					  else
					  {
						  echo "notpermission";
					  }
			
					
		   }
				 
             		
	 }
	
}

?>