$con = mysqli_connect($host,$user,$pw) or die(mysqli_error());
mysqli_select_db($con,$db) or die(mysqli_error());
mysqli_query($con,"SET CHARACTER SET utf8");
mysqli_query($con,"SET NAMES 'utf8'");
$ip=$_SERVER['REMOTE_ADDR'];
$json = file_get_contents("php://input"); //Get the string = just get all the content
$jsall = array();
$jsone = array();
$jsall=json_decode($json, true); //Get the list
$jsone=$jsall[0]; //Get the first map (you can add more maps if you like, example: Inserting 100 rows in one transaction)
$action = $jsone["Action"];
switch ($action)
{
Case "Login":
$upw=stripslashes(mysqli_real_escape_string($con,$jsone["upw"]));
$uname=stripslashes(mysqli_real_escape_string($con,$jsone["uname"]));
$imei=stripslashes(mysqli_real_escape_string($con,$jsone["imei"]));
$stmt = $con->prepare("SELECT * FROM users where uname = ?");
$rc=$stmt->bind_param("s", $uname);
$rc=$stmt->execute();
$q = $stmt->get_result();
$count=mysqli_num_rows($q);
$stmt->close();
//do some checks (user known, pw, hash, whatever)
}