Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <? require_once('Pickle.php');
- class ErrorFIX extends Pickle {
- function connect($username, $password, $server = -1, $debug = false) {
- $this->username = $username;
- if ($server != null)
- $this->server = $server;
- if (!is_numeric($this->server)) {
- $this->servername = $this->server;
- $this->server = $this->serverId($this->server);
- } else {
- $this->servername = $this->serverName($this->server);
- }
- if ($this->server < 0) return 1;
- echo '|' , chr(8);
- $data = $this->initCon();
- $randKey = stribet($data, '<k>', '</k>');
- echo '/' , chr(8);
- $key = $this->generateKey($password, $randKey, true);
- fwrite($this->sock, '<msg t=\'sys\'><body action=\'login\' r=\'0\'><login z=\'' . LOGIN_ZONE . '\'><nick><![CDATA[' . strtolower($username) . ']]></nick><pword><![CDATA[' . $key . ']]></pword></login></body></msg>' . chr(0));
- $data = $this->readPacket();
- if (stripos($data, 'xt%e')) {
- $this->error = stribet($data, '%xt%e%-1%', '%');
- $this->errort = $this->errors[$this->error];
- $this->run = false;
- $this->connect($this->username,$password,$this->server,false);
- return $this->error;
- }
- $data = str_replace('|%', '%', $data);
- $packet = ($this->decodePacket($data));
- $packet = $packet[0];
- $servlist = $packet[7];
- $servlist = explode("|", $servlist);
- $this->serverlist = array();
- foreach ($servlist as $server) {
- $dataserv = explode(",", $server);
- $this->serverlist[$dataserv[0]] = $dataserv[1];
- }
- if($this->serverlist[$this->server]>=6){ $this->connect($this->username,$password,$this->server,false); return 103; }
- unset($server);
- $this->PlayerID = stribet($data, '%xt%l%-1%', '%');
- $strUnkown = stribet($data, '%xt%l%-1%' . $this->PlayerID . '%', '%');
- $lkey = stribet($data, '%xt%l%-1%' . $this->PlayerID . '%' . $strUnkown . '%', '%');
- fclose($this->sock);
- echo '-' . chr(8);
- $data = $this->initCon($this->servers[$this->server]['ip'], $this->servers[$this->server]['port']);
- $randKey = stribet($data, '<k>', '</k>');
- $key = $this->generateKey($lkey, $randKey);
- echo '\\' . chr(8);
- fwrite($this->sock, '<msg t=\'sys\'><body action=\'login\' r=\'0\'><login z=\'' . SERVER_ZONE . '\'><nick><![CDATA[' . strtolower($username) . ']]></nick><pword><![CDATA[' . $key . ']]></pword></login></body></msg>' . chr(0));
- fwrite($this->sock, '%xt%s%j#js%-1%' . $this->PlayerID . '%' . $lkey . '%en%' . chr(0));
- $data = $this->readPacket();
- while (stripos($data, '%xt%jr%') == false && stripos($data, '%xt%lp') == false) $data .= $this->readPacket();
- $packets = $this->decodePacket($data);
- $packet = $this->packetInArray('lp', $packets);
- $this->objPlayer = $this->loadPlayer($packet[2], true, $packet);
- $packet = $this->packetInArray('jr', $packets);
- $this->intRoomID = $packet[1];
- $this->extRoomID = $packet[2];
- $this->arrPlayers = array();
- $this->room = array();
- $this->room[$this->extRoomID] = array();
- foreach ($packet as $key => $player) {
- if (!($key <= 4)) {
- $id = '|' . $player;
- $id = stribet($id, '|', '|');
- try {
- $this->arrPlayers[$id] = $this->loadPlayer($player);
- $this->room[$this->extRoomID][$id] = $this->arrPlayers[$id];
- }
- catch (PCLException $e) {
- echo $e;
- }
- }
- }
- echo "|" . chr(8);
- fwrite($this->sock, '%xt%s%i#gi%-1%' . chr(0));
- fwrite($this->sock, '%xt%s%b#gb%-1%' . chr(0));
- fwrite($this->sock, '%xt%s%n#gn%-1%' . chr(0));
- fwrite($this->sock, '%xt%s%l#mst%-1%' . chr(0));
- fwrite($this->sock, '%xt%s%p#pgu%-1%' . chr(0));
- fwrite($this->sock, '%xt%s%u#glr%-1%' . chr(0));
- echo '/' . chr(8);
- echo 'Successfully connected to ' , $this->servername , "\n";
- $this->run = true;
- return -1;
- }
- function __destruct(){
- $this->disconnect();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement