ajgkqsldxvkqsldkqs azelfkqsmkqsmlkdqsmld azmlekdqmskdmlqskd nkldsfkqsmldkqsmdmlskd decrypt($_GET['id']); $from = $mcrypt->decrypt($_GET['fid']); $to = $mcrypt->decrypt($_GET['to']); $mgs_status = $mcrypt->decrypt($_GET['mstatus']); $mgs_id = $mcrypt->decrypt($_GET['mid']); /* Fetch the information */ $con = db_connect(); $response = array(); $sql = session($con,$session); $success = 0; if(db_rows($con,$sql)>0){ /* fetch userid and create session token */ /* check if message exist to send acknowledgement of receipt to sender */ $sql = "select * from messages where fromid=".intval($from)." and toid=".intval($to)." and sender_message_id='".escape($con,$mgs_id)."'"; if(db_rows($con,$sql)>0){ /* update status and send acknowledgement */ $sql = "update messages set status=".intval($mgs_status)." where fromid=".intval($from)." and toid=".intval($to)." and sender_message_id='".escape($con,$mgs_id)."'"; if(mysqli_query($con,$sql)){ /* Send a push acknowledgement */ /* Get token */ $sql = user_push_tokens($from); $query = mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ $pushid = $row['token']; $data = array ( 'action' => '2', 'fromid' => $mcrypt->encrypt($from), 'toid' => $mcrypt->encrypt($to), 'message_id' => $mcrypt->encrypt($mgs_id), 'mgs_status' => $mcrypt->encrypt($mgs_status) ); /* 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); } } $success = 1; } } } $response['success'] = $success; echo json_encode($response); db_close($con); } ?>