<?php 
session_start();
ob_start();
 include "config/config.php"; 
 include "config/function.php"; 

 if (isset($_POST)) 
 {
     $a=0;
	$user_name=RemoveSpecialChar($_REQUEST['user_name']);
	$password=RemoveSpecialChar($_REQUEST['password']);
	echo $str="Select * from  tbl_account_login ";
	$result=mysqli_query($connection,$str); 
	while($row=mysqli_fetch_array($result))
	{
	    $admin_name=$row['account_user_name'];
	    $admin_pass=$row['account_password'];
	    if($admin_name==$user_name && $admin_pass==$password) 
	    {
	        $a=$a+1;
        	$_SESSION['userid']=$row['user_id'];
        	$_SESSION['admin_name']=$row['account_user_name'];
        	$_SESSION['login_status']=$row['login_status'];
        	$_SESSION['private_key']=$row['private_key'];
        	$_SESSION['account_name']=$row['account_name'];
	    	header("location:Home.php");
	    }
	
	}
	if($a==0)
	{
	    header("location:AppLogin?msg=User Name or Password Is Wrong");
	    exit();
	}

}
?>
