ajgkqsldxvkqsldkqs azelfkqsmkqsmlkdqsmld azmlekdqmskdmlqskd nkldsfkqsmldkqsmdmlskd decrypt($_GET['id']); $from = $mcrypt->decrypt($_GET['toid']); /* Fetch the information */ $con = db_connect(); $response = array(); $sql = session($con,$session); $success = 0; if(db_rows($con,$sql)>0){ /* */ $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $toid = $row['userid']; } /* update that this user has read all messages from this person */ $sql = "update messages set status = 3 where fromid=".intval($from)." and toid=".intval($toid); if(mysqli_query($con,$sql)){ $success = 1; /* Send push notification to the other party */ $sql = user_push_tokens($from); $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $pushid = $row['token']; $data = array ( 'action' => '3', 'fromid' => $mcrypt->encrypt($from), 'toid' => $mcrypt->encrypt($toid) ); /* Send data and push notification */ $priority = "high"; $ac_type = $row['ac_type']; /* if account is business, use the closeapp business firebase id */ if($ac_type==1){ sendPushData($pushid,$data,$priority); }else{ sendPushDataCloseApp($pushid,$data,$priority); } } } } $response['success'] = $success; echo json_encode($response); db_close($con); } ?>