<?php
include './config.php';

$name=$_POST['name'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$pass=$_POST['password'];
$usertype=$_POST['usertype'];
$password=md5($pass);
 

			
          $sql ="select * from `tbl_users_freenumber` where email='$email' ";
            $result = mysqli_query($con,$sql);
            $noofuser=0;
            while($row = mysqli_fetch_array($result)){
             $noofuser=$noofuser + 1;
			}
	 	
			
			
if($noofuser == 0 ){
$insert = $con->query("INSERT INTO `tbl_users_freenumber`(`name`, `email`, `password`, `phone`,`user_type`) VALUES
                                       ('$name','$email','$password','$phone','$usertype')");

                if($insert > 0)
                { 
                  $j->status  = "101";
                 $j->message = "Success"; 
                }
                else{
                $j->status  = "104";
                $j->message = "Some thing wrong"; 
                
                }
}
else{
    $j->status  = "102";
    $j->message = "Email Already Existed"; 
}

echo json_encode($j);
 

?>