<?php

require_once 'config.php';
//$error=false;
$errors=array();

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
	
    $username = $_POST['instano'];
    $passwd = $_POST['keypin'];
    // $passwd=  md5($passwd);
   
	$query = "SELECT * FROM users WHERE insta_no='".$username."' AND pin='".$passwd."'  AND is_insta=1   AND status=1";
	
	
    $row = mysqli_query($con,$query);
     
    if (mysqli_num_rows($row) >= 1) { 
		while($r=mysqli_fetch_array($row)){
			
			$errors['user_id'] = $r['id'];
			$errors['role']=$r['role'];
			$errors['nick_name']=$r['first_name'];
			$errors['phone']=$r['phone'];
			$errors['first_name']=$r['first_name'];
			$errors['last_name']=$r['last_name'];
			$errors['email']=$r['email'];
			$errors['address']=$r['address'];
			$errors['city']=$r['city'];
			$errors['pincode']=$r['pincode'];
			
		}
		$errors['success']='User successfully Logedin';
    } else {
        //$error=true;
		$errors['success']='Please check your 16 Digit number in your App !!';
    }
	echo json_encode($errors);
  
}

?>