<?php session_start(); error_reporting(0); 
include("connect/config.php");
include("RemoveSpecialChar.php");

if(isset($_REQUEST['login']))
{
$randum_number=$_SESSION['randum_number'];

if($_REQUEST['captcha']==$randum_number){ 

     	$signInEmail=$_REQUEST['signInEmail'];
		$signInEmail = RemoveSpecialChar($signInEmail);
		
		$signInPassword=$_REQUEST['signInPassword'];
		$signInPassword = RemoveSpecialChar($signInPassword);
			
    $sql="select count(*) as numlog from admin_log where binary username='$signInEmail' and binary password='$signInPassword'";
	$result=mysqli_query($db_conn,$sql);
	$fetch_result=mysqli_fetch_array($result);
	
	if($fetch_result['numlog']==1)
	{
		 $_SESSION['LOGIN_USER']=$signInEmail; 
		 
	echo "<script>window.location='landing';</script>";
	}else{
		$_SESSION['errorMessage'] = 'Invalid Username or Password.';
		echo "<script>window.location='index';</script>";
	}
	
}else{
	$_SESSION['errorMessage'] = 'Invalid Captcha Code.';
	echo "<script>window.location='index';</script>";
}

//not submit - redirected page $_REQUEST['login']
}else{echo "<script>window.location='index';</script>";}
?>