<?php 
   include 'config.php';
   
   if($_POST)
   {
       if(!isset($_POST['tocken']) && empty($_POST['tocken']))
       {
           echo json_encode(array('status'=>"0",'response'=>'Enter tocken'));
       }
       else if(!isset($_POST['user_id']) && empty($_POST['user_id']))
       {
           echo json_encode(array('status'=>"0",'response'=>'Enter user id'));
       }
       else
       {
           extract($_POST);
           $query=mysqli_query($con,"UPDATE `users` SET `tocken`='$tocken' WHERE `sn`='$user_id'");
           if($query)
           {
               echo json_encode(array('status'=>"1",'response'=>'updated tocken'));
           }
           else
           {
               echo json_encode(array('status'=>"0",'response'=>'something wrong'));
           }
       }
   }
   else
   {
       echo json_encode(array('status'=>"0",'response'=>'invalid method'));
   }
?>