"); if ($start != -1) { $start+=2; $msg = substr($msg, $start); //$parts = split("[<>]", $msg); $parts = preg_split("/[<>]/", $msg); $from_agent = $parts[4]; $to_agent = $parts[12]; if (isGUID($from_agent) and isGUID($to_agent)) { $query_str = "INSERT INTO ".OFFLINE_MESSAGE_TBL." (to_uuid,from_uuid,message) VALUES ('".$to_agent."','".$from_agent."','".mysql_escape_string($msg)."')"; $DbLink->query($query_str); if ($DbLink->Errno==0) { echo 'true'; exit; } } } echo 'false'; exit; } if ($method == "/RetrieveMessages/") { $parms = $HTTP_RAW_POST_DATA; //$parts = split("[<>]", $parms); $parts = preg_split("/[<>]/", $parms); $agent_id = $parts[6]; $errno = -1; if (isGUID($agent_id)) { $DbLink->query("SELECT message FROM ".OFFLINE_MESSAGE_TBL." WHERE to_uuid='".$agent_id."'"); $errno = $DbLink->Errno; } echo ''; echo ''; if ($errno==0) { while(list($message) = $DbLink->next_record()) { echo $message; } } echo ''; if ($errno==0) { $DbLink->query("DELETE FROM ".OFFLINE_MESSAGE_TBL." WHERE to_uuid='".$agent_id."'"); } exit; } ?>