I am android developer and never touch PHP. I am using below function for register my android user. I have marked that some user's creating multiple accounts. I want prevent it. I have added one field in table device called blocked. I want check that if device blocked=1, then I do not want register account of user. My PHP developer is not online and so I am unable to write the correct code. My current function is like below. Let me know if someone can help me for do it.
$trial_sql = "SELECT device_id FROM device WHERE device_id = '$serial'";
$trial_result = mysqli_query($conn, $trial_sql);
if (mysqli_num_rows($trial_result) == 0) {
$device_sql = "INSERT INTO device(device_id) VALUES('$serial')";
if($conn->query($device_sql)){
$trial = 1;
}
}
$sql = "INSERT INTO user(name, email, password, device_id, trial, fcm) VALUES('$name', '$email', '$password', '$serial', $trial, '$fcm')";
if($conn->query($sql)) {
$response["code"] = 1;
}
return json_encode($response);
Thanks