<?php
include("../connect.php"); 
$response = array();
if(isset($_POST['admin_id']) && isset($_POST['manager_name']) && isset($_POST['phone']) && isset($_POST['email']))
{
	$ver = $_POST['admin_id'];
	$a_name=$_POST['manager_name'];
	$a_phone=$_POST['phone'];
	$email=$_POST['email'];
	$address=$_POST['address'];
	$password=$_POST['password'];
	date_default_timezone_set('Asia/Calcutta');
	$cdate  = date("Y-m-d")." ".date('h:i:sa');
	$res_product_stock = mysqli_query($con,"SELECT manager_phone FROM  tbl_manager where manager_phone='$phone' or manager_email='$email'");
	if(mysqli_num_rows($res_product_stock)<=0)
	{									
		$query = mysqli_query($con,"INSERT INTO `tbl_manager`(`admin_id`, `manager_name`, `manager_phone`, `manager_email`, `address`, `password`, `status`, `manage_type`, `insert_datetime`) VALUES ('$ver','$a_name','$a_phone','$email','$address','$password','Active','Manager','$cdate')");	
		$response['success']='1';
		$response['details']="Insert Successful";			
	}
	else
	{
		$response['success']='0';
		$response['details']="Manager already exists";
	}
}
else
{
	$response['success']='0';
	$response['details']="Required field missing";
}	
echo json_encode($response);
?>