Jump to content

UnknownReaper

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

UnknownReaper's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I get an error php_mbstring.dll was not located. I fix it. I get another error php4ts.dll was not located. I fix it. And then I get another error The procedure point zend_wrong_param_count could not be located in the dynamic link library php4ts.dll. No idea what to do now, I have re installed PHP a lot of times, someone help please.
  2. I appolagise, it' just I don't know much PHP and I needed some help here's more of the code: function connect($ip, $port) { if($this->soc!=null) socket_close($this->soc); $this->soc = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); if(!$this->soc) die(socket_strerror(socket_last_error($this->soc))); if(!socket_connect($this->soc,$ip,$port)) die("Could not connect."); } /** * Writes the given message to the object socket($this->soc) * @param $message The packet to send. */ function send($message) { if($this->debug)echo "->>\t$message\n"; socket_write($this->soc, $message."\0", strlen($message)+1); } /** * Reads a message from the socket, will read until entire message has been recieved or connection closes. * @param $parse Used for recursive calls to tell the function not to parse a partial packet */ function read($parse=true) { $res = rtrim(socket_read($this->soc, 4096)); if($this->debug)echo "<<-\t$res\n"; if(!$res) { return "DIED"; //Used to gracefully handle a closed socket } if($res{strlen($res)-1}!='>') { $res.=$this->read(false);} //Recursive call for messages split over several packets. if($parse)$this->parse($res); return $res; } /** * Parses the recieved packets into their message and types. * @param $packet The packet recieved. */ function parse($packet) { if(substr_count($packet,'>')>1) $packet = explode('/>',$packet);//If necessary split the packet into individual messages foreach((Array)$packet as $p) { $p = trim($p); if(strlen($p)<5) return;//garbage data $type = trim(strtolower(substr($p,1,strpos($p.' ',' '))));//packet type $p = trim(str_replace("<$type",'',str_replace('/>','',$p)));//remove details so it is just the info to be parsed parse_str(str_replace('"','',str_replace('" ','&',str_replace('="','=',str_replace('&','__38',$p)))),$this->packet[$type]); foreach($this->packet[$type] as $k=>$v) { $this->packet[$type][$k] = str_replace('__38','&',$v); //htmlspecial chars are protected instead of being parsed } $this->handle($type,$p); } } /** * This is the inital handler for the packets, parses them and sends them off to their respective function to be handled further. * @param $type The character code indicating the type of data within the message. * @param $message The data the message contains. */ function handle($type,$msg) { switch($type) { case 'gp': if(isset($this->packet['gp']['x'])) $this->send('<x i="'.$this->packet['gp']['x'].'" u="'.$this->userID.'" t="j" />'); //Handle groups break; case 'q'://XAT notice to change ip/port $this->connect($this->packet['q']['d'], $this->packet['q']['p']); $this->join($this->roomID); break; case 'o': $this->packet['o']['u'] = $this->parseU(@$this->packet['u']['u']); $this->userInfo[$this->packet['o']['u']]['name'] = @$this->packet['o']['n']; $this->userInfo[$this->packet['o']['u']]['registeredName'] = ((isset($this->packet['o']['N']))?$this->packet['o']['N']:''); $this->userInfo[$this->packet['o']['u']]['avatar'] = @$this->packet['o']['a']; $this->userInfo[$this->packet['o']['u']]['homepage'] = @$this->packet['o']['h']; $this->userInfo[$this->packet['o']['u']]['rank'] = $this->f2rank(@$this->packet['o']['f']); break; case 'u': //Joined //Default Bot stuff regarding userInformation $this->packet['u']['u'] = $this->parseU(@$this->packet['u']['u']); $this->userInfo[$this->packet['u']['u']]['name'] = @$this->packet['u']['n']; $this->userInfo[$this->packet['u']['u']]['registeredName'] = ((isset($this->packet['u']['N']))?$this->packet['u']['N']:''); $this->userInfo[$this->packet['u']['u']]['avatar'] = @$this->packet['u']['a']; $this->userInfo[$this->packet['u']['u']]['homepage'] = @$this->packet['u']['h']; $this->userInfo[$this->packet['u']['u']]['rank'] = $this->f2rank(@$this->packet['u']['f']); $event = 'userJoined'; $data['id'] = $this->packet['u']['u']; $data['old'] = ($type=='o'||(isset($this->packet['u']['s']))?true:false); $this->handleEvent($event,$data); break; case 'l': //User Left or was kicked, banned unset($this->userInfo[$this->packet['l']['u']]); $event = 'userLeft'; $data['id'] = $this->packet['l']['u']; $this->handleEvent($event,$data); break; case 'p': //Private message/chat recieved $event = ((isset($this->packet['p']['d']))?'privateChat':'privateMessage'); $data['id'] = $this->parseU(@$this->packet['p']['u']); $data['message'] = $this->packet['p']['t']; $this->handleEvent($event,$data); break; case 'm': //message to main chat. $event = 'message'; $data['id'] = $this->parseU(@$this->packet['m']['u']); $data['message'] = $this->packet['m']['t']; $data['old'] = ((isset($this->packet['m']['s']))?true:false); $this->handleEvent($event,$data); break; } } /** * Joins a room. * @param $roomID the numeric roomID to join. */ function join($roomID) { //Announce we are here: $this->send('<y m="1" />');//Anounces our arrival to the server and gets some information to send back $this->read(); //Auto parsed into $this->packet['y'] $this->send('<j2 q="1" y="'.$this->packet['y']['i'].'" k="'.$this->k.'" k3="0" z="12" p="0" c="'.$roomID.'" f="0" u="'.$this->userID.'" d0="0" n="'.$this->name.'" a="'.$this->avatar.'" h="'.$this->homepage.'" v="0" />'); $this->roomID = $roomID; } /** * Parses the u value from a packet to get just the id * @param $id the id to be parsed. */ function parseU($id) { if(substr_count($id,'_')>=1) $id = substr($id,0,strpos($id,'_')); return $id; } /** * Converts an f value to a string containing the corresponding rank...this if you don't understand bitwise operations is a little 'magical' deal with it. * @param $f The f value to be parsed. */ function f2rank($f) { $f = $this->parseU($f); if($f==-1) return 'guest'; //Okay, 98% of you reading this on NewHax won't know what any of this means; if you do you are more adnvanced than I expected //Not that this is advnaced stuff, but basiclly it is a bit-wise comparision(notice & instead of && it is checking if certain binary bits are set to 1 //The F value is essientially a bunch of flags where for example 00010000 == banned(the 0s can be 0 or 1, just as long as that one 1 is a one you are banned. if((16 & $f)) return 'banned'; if((1 & $f)&&(2 & $f)) return 'member'; if((4 & $f)) return 'owner'; if((32 & $f)&&(1 & $f)&&!(2 & $f)) return 'main'; if(!(1 & $f)&&!(2 & $f)) return 'guest'; if((16 & $f)) return 'banned'; if((2 & $f)&&!(1 & $f)) return 'mod'; } /** * Returns an assoc array of information regarding the user with the given id * @param $id The user id you want information on. */ function getUserArray($id) { $id = $this->parseU($id); if(isset($this->userInfo[$id])) { return $this->userInfo[$id]; } else return false; } /** * Sends the given message to the main chat * @param $message */ function sendMessage($message) { if(empty($message))return; $this->send('<m t="'.$message.'" u="'.$this->userID.'" />'); } /** * Sends a PC to the given ID * @param $message The message to send. * @param $id The id to send the message to */ function sendPrivateChat($message, $id) { if(empty($message))return; $this->send('<p u="'.$id.'" t="'.$message.'" s="2" d="'.$this->userID.'" />'); } /** * Sends a PM to the given ID * @param $message The message to send. * @param $id The id to send the message to */ function sendPrivateMessage($message,$id) { $id = $this->parseU($id); if(empty($message))return; $this->send('<p u="'.$id.'" t="'.$message.'" />'); } /** * Makes the given $id an owner, assuming the bot is main * @param $id The id to promote */ function mod($id) { $this->send('<c u="'.$this->parseU($id).'" t="/M" />'); } /** * Makes the given $id a mod, assuming the bot is owner * @param $id The id to promote */ function owner($id) { $this->send('<c u="'.$this->parseU($id).'" t="/m" />'); } /** * Makes the given $id a member, assuming the bot is mod * @param $id The id to member */ function member($id) { $this->send('<c u="'.$this->parseU($id).'" t="/e" />'); /** * KIcks the given ID assuming the bot is a mod and $id is a member or less * @param $id The id to kick */ function kick($message, $id) { $this->send('<c p="'.$message.'" u="'.$this->parseU($id).'" t="/k" />'); } /** * Bans the ID for a given time(0 is forever) * @param $id The id to ban */ function ban($message, $id, $time) { if(empty($time)) $time = 3600; $this->send('<c p="'.$message.'" u="'.$this->parseU($id).'" t="/g'.$time.'" />'); } /** * Unbans the given ID * @param $id The id to unban */ function unban($id) { $this->send('<c u="'.$this->parseU($id).'" t="/u" />'); } /** * Performs a basic HTTP GET to the given URL * @param $url The url to retrieve, please include http:// and www if necessary * @param $includeHeader Tells teh function wether or not to include the server header respond before the main content */ function get($url, $includeHeader=false) { $urlp = parse_url($url); $fp = fsockopen($urlp['host'],80); $path = explode('/',$url,4); $path = ((count($path)>=4)?$path[3]:""); $req = "GET /$path HTTP/1.1\r\n"; $req .= "Host: $urlp[2`host]\r\n"; $req .= "Connection: Close\r\n\r\n"; fputs($fp, $req); $res = ""; while(!feof($fp)) $res .= fgets($fp, 4096); fclose($fp); if($includeHeader) return $res; $res = explode("\r\n\r\n",$res,2); return $res[1]; } /** * A utility function to get all text beween $start and $end * @param $content The content from which we are grabbing data * @param $start where to start grabbing from * @param $end the end of the content to grab */ function getBetween($content,$start,$end){ $r = explode($start, $content); if (isset($r[1])){ $r = explode($end, $r[1]); return $r[0]; } return ''; } } } } ?>
  3. Hey, my friend gave me this php script but it has an error: Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/a2091624/public_html/UnknownReaper.php on line 554 function getBetween($content,$start,$end){ $r = explode($start, $content); if (isset($r[1])){ $r = explode($end, $r[1]); return $r[0]; } return ''; } } } } ?> NOTE: This is only the part of the script that has the error. Can someone please fix the script and re send it to me, thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.