public function joinServer($strName) { $strAddress = $this->arrServers[$strName]['IP']; $intPort = $this->arrServers[$strName]['Port']; $strResult = $this->sendHandshake($strAddress, $intPort); $objXml = simplexml_load_string($strResult); $strKey = Crypto::encryptPassword($this->strLoginKey . $objXml->body->k) . $this->strLoginKey; $this->send('<msg t="sys"><body action="login" r="0"><login z="w1"><nick><![CDATA[' . $this->strRawPlayer . ']]></nick><pword><![CDATA[' . $strKey . '#' . $this->strConfirmationKey . ']]></pword></login></body></msg>'); $this->send('%xt%s%j#js%-1%' . $this->intPlayerId . '%' . $this->strLoginKey . '%en%'); $this->send('%xt%s%g#gi%-1%'); if (!$this->usingProxy) { socket_set_nonblock($this->resSocket); } }