So here's my problem. I have a website and an android app for that. My users needs to be register in the website so I need not make a register page in the android part instead only the login page. But I got error in the login.php whenever I tried to run it on the browser to check if I'm getting the right response I got the error Undefined index: username and Undefined index: password. I don't know what is wrong.Below is the code for my login.php
<?php
include("config.php");
$decoded = json_decode(file_get_contents("php://input"));
$username = $decoded -> {"username"};
$password = $decoded -> {"password"};
$query = "SELECT u_id FROM pluma_user where password='$password' and username='$username'";
$result = mysql_query($query);
$obj = array();
$check = false;
while($row=mysql_fetch_assoc($result)){
$check = true;
$obj["result"] = "ok";
$obj["id"] = $row["u_id"];
}
if($check == false){
$obj["result"] = "failed";
}
$obj1 = array();
$obj1["result"] = "ok";
echo json_encode($obj);
mysql_close();
?>