<?php
include('db_connect.php');
$update;
$response= array();
if(isset($_POST['uid'])){

    $uid= $_POST['uid'];
    $android_id= $_POST['android_id'];
    $status= $_POST['status'];
    $title= $_POST['title'];
    
    if($title=='location')
    {
        $update="UPDATE `device_reg` SET `is_location_on`='$status' WHERE `android_id`='$android_id' and uid='$uid'";
        
    }
    
    else if($title=='lock')
    {
        $update="UPDATE `device_reg` SET `is_lock_on`='$status' WHERE `android_id`='$android_id' and uid='$uid'";
        
    }
    else if($title=='erase')
    {
        $update="UPDATE `device_reg` SET `is_erase_on`='$status' WHERE `android_id`='$android_id' and uid='$uid'";
        
    }
    
      
     if(mysqli_query($con,$update)){
         if($status=="1"){
         $response['error']= false;
    $response['message']="Service Activated!";
     }
     else{
         $response['error']= false;
    $response['message']="Service Deactivated!";
     }
     }
         
     
}
echo json_encode($response);
mysqli_close($con);
?>