<?php 
 
require 'db.php';
$data = json_decode(file_get_contents('php://input'), true);

$uid = $data['uid'];
$rate = $data['rate'];
$review = $data['review'];

if($review == '' or $rate == '' or $uid == '')
{
	$returnArr = array("ResponseCode"=>"401","Result"=>"false","ResponseMsg"=>"Something Went wrong  try again !");
}
else 
{
    $sql = "insert into rate_app(`uid`, `rate`, `review`) values ('$uid','$rate','$review')";
    $result = $con->query($sql);
    
    if($result)
    $returnArr = array("ResponseCode"=>"200","Result"=>"true","ResponseMsg"=>"Thanks for Your Rating");
    else
    $returnArr = array("ResponseCode"=>"201","Result"=>"false","ResponseMsg"=>"Retry your Review");
}
echo json_encode($returnArr);
mysqli_close($con);
?> 