Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_time_limit(0);
- error_reporting(0);
- class iBot
- {
- public $ixatlink = "http://ixaat12.zapto.org:8090";
- public $withoutaccess = "You aren't allowed to use commands!";
- public $radioinfo = 'semnome';
- public $users;
- public $logado;
- public $socket;
- public $chatID;
- public $botID;
- public $port;
- public $ip;
- public $k;
- public $filterWords;
- public $maxKicks = 4; //Number of kicks before ban
- public $members = array();
- public $censor = array("porra","fdp","caralho","buceta","pinto","anal","cu","fuck","bitch","vai tomar no cu","viado","gay");
- public function __construct()
- {
- $config = (object) array('db' => array(0 => 'localhost', 1 => 'root', 2 => '', 3 => 'pulse'));
- $this->mysql = new database($config->db[0], $config->db[1], $config->db[2], $config->db[3]);
- $this->config = $this->mysql->fetch_array("select * from `bots` limit 0, 1;");
- $this->config = (object) $this->config[0];
- $this->config->admins = @(array) json_decode($this->config->admins);
- $this->time = time();
- }
- public function connect()
- {
- $this->getinfo();
- $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
- $test = socket_connect($this->socket, $this->ip, $this->port);
- echo "--> Connecting to {$this->ip}:{$this->port}...\n";
- if(!$test){
- die( "<-- Error to connection!\n" );
- }
- }
- public function disconnect()
- {
- if(isset($this->socket) && $this->socket == true)
- socket_close($this->socket);
- $this->socket = false;
- }
- function getinfo()
- {
- $curl = curl_init($this->ixatlink.'/mobile?'.time());
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_POST, true);
- curl_setopt($curl, CURLOPT_POSTFIELDS, "username={$this->config->username}&password={$this->config->password}&room={$this->config->room}");
- $url = curl_exec($curl);
- $parte1 = explode("\"id\":\"", $url);
- $id = explode("\"", $parte1[1]);
- $this->botID = $id[0];
- $parte2 = explode("\"k\":\"", $url);
- $k = explode("\"", $parte2[1]);
- $this->k = $k[0];
- $k3_data = explode("\"k3\":\"", $url);
- $k3 = explode("\"", $k3_data[1]);
- $this->k3 = $k3[0];
- $sala_data = explode('c="', $url);
- $salaID = explode('"', $sala_data[1]);
- $this->chatID = $salaID[0];
- $parte4 = explode("WebSocket('ws://", $url);
- $ip = explode(":", $parte4[1]);
- $this->ip = $ip[0];
- $dx_data = explode("\"xats\":\"", $url);
- $dx = explode("\"", $dx_data[1]);
- $this->dx = $dx[0];
- $d1_data = explode("\"days\":\"", $url);
- $d1 = explode("\"", $d1_data[1]);
- $this->d1 = $d1[0];
- $d4_data = explode('"p4":', $url);
- $d4 = explode(',"', $d4_data[1]);
- $this->d4 = $d4[0];
- $d5_data = explode('"p5":', $url);
- $d5 = explode(',"', $d5_data[1]);
- $this->d5 = $d5[0];
- $d6_data = explode('"p6":', $url);
- $d6 = explode(',"', $d6_data[1]);
- $this->d6 = $d6[0];
- $d7_data = explode('"p7":', $url);
- $d7 = explode(',"', $d7_data[1]);
- $this->d7 = $d7[0];
- $d8_data = explode('"p8":', $url);
- $d8 = explode(',"', $d8_data[1]);
- $this->d8 = $d8[0];
- $d9_data = explode('"p9":', $url);
- $d9 = explode(',"', $d9_data[1]);
- $this->d9 = $d9[0];
- $d10_data = explode('"p10":', $url);
- $d10 = explode(',"', $d10_data[1]);
- $this->d10 = $d10[0];
- $d11_data = explode('"p11":', $url);
- $d11 = explode(',"', $d11_data[1]);
- $this->d11 = $d11[0];
- $d12_data = explode('"p12":', $url);
- $d12 = explode(',"', $d12_data[1]);
- $this->d12 = $d12[0];
- $d13_data = explode('"p13":', $url);
- $d13 = explode(',"', $d13_data[1]);
- $this->d13 = $d13[0];
- $d14_data = explode('p14":', $url);
- $d14 = explode(',"', $d14_data[1]);
- $this->d14 = $d14[0];
- $d15_data = explode('p15":', $url);
- $d15 = explode('}', $d15_data[1]);
- $this->d15 = $d15[0];
- $parte5 = explode($this->ip.':', $url);
- $port = explode("/", $parte5[1]);
- $this->port = $port[0];
- if(empty($url)){
- die( "<-- Connection failed, or the website could be closed!!\n");
- }
- if(empty($this->botID)){
- die( "<-- The chat doesn't exist, or the data is incorrect!\n");
- }
- }
- public function passXML($xml, $return = null)
- {
- $content = @simplexml_load_string(trim($xml));
- foreach($content->Attributes() as $i => $u)
- $return[$i] = (string) ((string) $u);
- return $return;
- }
- public function send($packet)
- {
- if($packet[strlen($packet) - 1] != chr(0))
- $packet .= chr(0);
- echo "[BOT]-> {$packet}\n";
- return socket_write($this->socket, $packet, strlen($packet));
- }
- public function enter()
- {
- $this->connect();
- $this->send("<y r=\"{$this->chatID}\" v=\"0\" u=\"{$this->config->id}\" />");
- $x = $this->passXML(socket_read($this->socket, $this->port));
- $bot2 = floor(pow(2, $x['ys'] % 27));
- $bot1 = floor(2 << ($x['yi'] % 94)) % $x['yc'] + $x['yi'];
- $j2 = "cb=\"0\" ";
- $j2 .= "auth1=\"{$bot1}\" ";
- $j2 .= "auth2=\"{$bot2}\" ";
- $j2 .= "y=\"{$x["yi"]}\" ";
- $j2 .= "k=\"{$this->k}\" ";
- $j2 .= "k3=\"{$this->k3}\" ";
- $j2 .= "d1=\"{$this->d1}\" ";
- $j2 .= "p=\"0\" ";
- $j2 .= "c=\"{$this->chatID}\" ";
- if($this->config->botpion == 1){ $j2 .= "f=\"8192\" "; } else { $j2 .= "f=\"0\" "; }
- $j2 .= "u=\"{$this->config->id}\" ";
- $j2 .= "d0=\"0\" ";
- $j2 .= "d4=\"{$this->d4}\" ";
- $j2 .= "d5=\"{$this->d5}\" ";
- $j2 .= "d6=\"{$this->d6}\" ";
- $j2 .= "d7=\"{$this->d7}\" ";
- $j2 .= "d8=\"{$this->d8}\" ";
- $j2 .= "d9=\"{$this->d9}\" ";
- $j2 .= "d10=\"{$this->d10}\" ";
- $j2 .= "d11=\"{$this->d11}\" ";
- $j2 .= "d12=\"{$this->d12}\" ";
- $j2 .= "d13=\"{$this->d13}\" ";
- $j2 .= "d14=\"{$this->d14}\" ";
- $j2 .= "d15=\"{$this->d15}\" ";
- $j2 .= "dO=\"\" ";
- $j2 .= "dx=\"{$this->dx}\" ";
- $j2 .= "N=\"{$this->config->username}\" ";
- $j2 .= "n=\"{$this->config->name}\" ";
- $j2 .= "a=\"{$this->config->avatar}\" ";
- $j2 .= "h=\"{$this->config->homepage}\" ";
- $j2 .= "v=\"5\"";
- $j2 = "<j2 {$j2} />";
- $this->send($j2);
- }
- public function load($check = true, $test_var = true)
- {
- $x = "";
- try {
- $x = rtrim(socket_read($this->socket, 2048));
- $x = str_replace("", "", $x);
- }
- catch(Exception $e){
- return "OFF";
- }
- if(!$x)
- return "OFF";
- if($x[strlen($x) - 1] != ">")
- $x .= $this->load(true);
- if($check)
- $this->packets($x, $test_var);
- return $x;
- }
- public function packets($packet, $test = true, $test2 = false)
- {
- if(substr_count($packet, ">") > 1){
- $packet = explode("/>", $packet);
- $test2 = true;
- }
- foreach((array) $packet as $p ){
- if($test2)
- $p .= "/>";
- $p = trim($p);
- if(strlen($p) < 5)
- return;
- echo "[XAT]-> {$p}\n";
- $type = trim(strtolower(substr($p, 1, strpos($p." ", " "))));
- $p = trim(str_replace("<".$type, "", str_replace("/>", "", $p)));
- $p = str_replace("\"", "", str_replace("\" ", "&", str_replace("&", "__38", $p)));
- parse_str($p, $this->packet[$type]);
- foreach($this->packet[$type] as $x => $v)
- $this->packet[$type][$x] = str_replace("__38", "&", str_replace("pl_", "+", $v));
- if($test)
- $this->type($type, $this->packet[$type]);
- }
- }
- public function type($type, $packet)
- {
- switch($type){
- case 'u':
- $u = $this->fetchUser($packet['u']);
- $this->users[$this->parseU($packet['u'])] = $packet;
- $this->users[$packet['u']]['cb'] = @$packet['cb'];
- $this->users[$packet['u']]['s'] = @$packet['s'];
- $this->users[$packet['u']]['f'] = (isset($packet['f'])) ? (int)$packet['f']: 0;
- $this->users[$packet['u']]['id'] = $packet['u'];
- $this->users[$packet['u']]['d0'] = (isset($packet['d0'])) ? (int)$packet['d0']: 0;
- $this->users[$packet['u']]['d2'] = (isset($packet['d2'])) ? @$packet['d2']: 0;
- $this->users[$packet['u']]['q'] = (isset($packet['q'])) ? (int)$packet['q']: 0;
- $this->users[$packet['u']]['registered'] = ((key_exists('N', $packet)) ? $packet['N']: 'Unregistered');
- $this->users[$packet['u']]['name'] = @$packet['n'];
- $this->users[$packet['u']]['avatar'] = (isset($packet['a'])) ? @$packet['a']: 'No Avatar';
- $this->users[$packet['u']]['home'] = (isset($packet['h'])) ? @$packet['h']: 'No Homepage';
- $this->users[$packet['u']]['v'] = (@$packet['v']) ? @$packet['v']: 0;
- $this->users[$packet['u']]['bride'] = (isset($packet['d2'])) ? @$packet['d2']: 0;
- $this->users[$packet['u']]['rel'] = (@$packet['d0'] & 1) ? 1: 2;
- $this->users[$packet['u']]['sub'] = (isset($packet['p0'])) ? 1: 0;
- $user = ( $packet['N']) ? $packet['N']: $packet['u'];
- $userid = $packet['i'];
- if(!empty($this->config->autowelcome) && !isset($packet['s']))
- {
- $this->sendwelcome($this->config->autowelcome, $packet['u'], $packet['f'], $user);
- }
- if($packet['rank'] == 5)
- {
- if($this->config->automember == 1){
- $this->member($packet['u']);
- }
- }
- if($packet['rank'] == 3)
- {
- if($this->config->autoguest == 1){
- $this->guest($packet['u']);
- }
- }
- break;
- case "i":
- $info = explode(';=', $this->packet['i']['b']);
- $this->radioinfo = str_replace("http://", "", $info[4]);
- break;
- case "z":
- $this->sendmsg("{$this->config->ticklemsg}", "PM", $packet["u"]);
- break;
- case "m":
- case "p":
- if($this->censor($packet['t'])) {
- $this->send('<c p="Sem inapp (d)" u="'.$packet['u'].'" t="/k" />');
- }
- if(isset($packet["i"]) && $packet["i"] > 0)
- break;
- $msg = $message = explode(" ", $packet["t"]);
- unset($msg[0]);
- $msg = implode(" ", $msg);
- $user4 = ($this->users[$packet["u"]]["n"]) ? $this->users[$packet["u"]]["n"]: $this->users[$packet["u"]]["u"];
- $response = $this->mysql->fetch_array("select * from `response` where `question`='{$this->mysql->sanatize($message[0])}';");
- if($message[0] == "{$response[0]['question']}" || $msg == "{$response[0]['question']}"){
- $hat = explode("(hat#", $user4, 2);
- $hat2 = explode(")", $hat[1], 2);
- $glow = explode("(glow#", $user4, 2);
- $glow2 = explode(")", $glow[1], 2);
- $status = explode("##", $user4, 2);
- $this->sendmsg(str_replace("$", "", str_replace("##{$status[1]}", "", str_replace("(glow#{$glow2[0]})", "", str_replace("(hat#{$hat2[0]})", "", str_replace("[user]", $user4, $response[0]['answer']))))));
- }
- if(isset($message[0]) && $message[0][0] != "!")
- break;
- $user = $this->users[$packet["u"]];
- $user2 = ($user["N"]) ? $user["N"]: $user["u"];
- $bot = $this->mysql->fetch_array("select * from `bots` limit 0, 1;");
- switch(substr($message[0], 1)){
- case "say":
- $this->sendmsg("[$user2] : ".$msg);
- break;
- case 'insultar':
- if(is_numeric(strpos(strtolower($message[1]), 'Key'))) return $this->respond("Nao posso chingar ele :(");
- $insulto = array("$message[1] FDP", "$message[1] lixo", "$message[1] arrombado", "$message[1] noob", "$message[1] tueburroe");
- $this->sendmsg($insulto[array_rand($insulto)]);
- break;
- case "perg":
- case "8ball":
- // !perg/!8ball [pergunta]
- $resposta = array(
- 'Talvez sim',
- 'Sim.',
- 'Nao.',
- 'Minhas fontes informou que nao.',
- 'Ah, sim e sim',
- 'Na verdade nao sei',
- 'Outlook nao presta \'-\'',
- 'Eu acho que nao',
- 'Muito bom',
- 'Definiu-se que sim.'
- );
- $resposta = $resposta[ array_rand( $resposta ) ];
- $message = array( );
- foreach ( $message as $k => $valus ) {
- $valus = strtoupper( $valus );
- array_push( $message, $values );
- } //$message as $k => $valus
- $this->sendmsg( '' . $resposta . $packet[ 'u' ] );
- break;
- case "test":
- // !say [msg]
- $user = $this->users[ $packet[ "u" ] ];
- $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
- $this->sendmsg ('('.$msg.') ');
- break;
- case "sayadm":
- if(!in_array($packet['u'], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet['u']);
- }
- $this->sendmsg($msg);
- break;
- case 'botpion':
- if(!in_array($packet['u'], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet['u']);
- }
- if($this->config->botpion == 1)
- {
- $this->mysql->query("UPDATE bots SET botpion='0'");
- $this->sendmsg('Bot pion has been disabled!');
- return $this->restart();
- }
- else
- {
- $this->mysql->query("UPDATE bots SET botpion='1'");
- $this->sendmsg('Bot pion has been activated!');
- return $this->restart();
- }
- break;
- case 'goto':
- if(!in_array($packet['u'], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet['u']);
- }
- if($msg == $this->config->room){
- $this->sendmsg("I'm already on {$msg}!");
- } else {
- $this->mysql->query("UPDATE bots SET room='{$msg}'");
- $this->sendmsg("I'm going to {$msg}!");
- return $this->restart();
- }
- break;
- case '!filter':
- case '!censor':
- if(!$this->isAllowed($this->packet['m']['u'])) {$this->sendMessage("Você não tem permissão para alternar o filtro de linguagem!"); return;}
- $this->filterWords = !$this->filterWords;
- if($this->filterWords) $this->sendMessage("Censor, e seja comportado!");
- else $this->sendMessage("Censor é off, Sinta-se livre para relaxar.");
- $this->save();
- break;
- case '!spamfilter':
- case '!spam':
- case '!sfilter':
- if(!$this->isAllowed($this->packet['m']['u'])) {$this->sendMessage("você não tem permissão para alterar o filtro de spam."); return;}
- $word = explode(' ',$info[1].' ');
- if(is_numeric($word[0]) && is_numeric($word[1]) && !empty($word[1])) {
- $this->spam['time'] = $word[1];
- $this->spam['limit'] = $word[0];
- $this->sendMessage("filtro de spam foi definido para ".$this->spam['limit']."mensagens a cada ".$this->spam['time']." segundos");
- $this->sendMessage("se alguém passa esse limite, eles serão chutou resultando em uma proibição em função dos chutes máximos.");
- }
- $this->save();
- break;
- case 'info':
- $this->sendmsg('iBot by yuukiyuuki(381455307) aka Kayabe ~Key Por add cmd ', 'PM', $packet['u']);
- break;
- case 'users':
- $this->sendmsg($user2.': '.count($this->users).' users online.');
- break;
- case'!chatinfo':
- $this->send('ID : '.$this->sala.' | Buttons : _'.$this->chatInfo['buttons'].' | Radio : '.$this->chatInfo['radio'].' | Background : '.$this->chatInfo['background']);
- break;
- case "time":
- $s = time() - $this->time;
- $m = floor($s / 60);
- $h = floor($m / 60);
- $msg = "Run time (approx): Seconds - $s | Minutes - $m | Hours - $h";
- $this->sendmsg($msg);
- break;
- case "glow":
- case "ng":
- case "name":
- case "hat":
- case "av":
- case "avatar":
- case "status":
- if(!in_array($packet["u"], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet["u"]);
- }
- if(substr($message[0], 1) == "hat"){
- $hat = explode("(hat#", $this->config->name);
- $status = explode("##", $this->config->name, 2);
- if($status[1]){
- if($hat[1]){
- $this->mysql->query("UPDATE `bots` SET `name`='".$hat[0]."(hat#".$msg.")##".$status[1]."'");
- $this->restart();
- $this->sendmsg("Hat alterado com sucesso!");
- } else {
- $this->mysql->query("UPDATE `bots` SET `name`='".$status[0]."(hat#".$msg.")##".$status[1]."'");
- $this->restart();
- $this->sendmsg("Hat adicionado com sucesso!");
- }
- }else{
- if($hat[1]){
- $this->mysql->query("UPDATE `bots` SET `name`='".$hat[0]."(hat#".$msg.")"."'");
- $this->restart();
- $this->sendmsg("Hat alterado com sucesso!");
- } else {
- $this->mysql->query("UPDATE `bots` SET `name`='".$hat[0]."(hat#".$msg.")"."'");
- $this->restart();
- $this->sendmsg("Hat adicionado com sucesso! [COND1]");
- }
- }
- }else if(substr($message[ 0 ], 1) == "ng" || substr($message[0], 1) == "glow"){
- $glow = explode("(glow#", $bot[0]['name']);
- if($glow[1]){
- $this->mysql->query("UPDATE `bots` SET `name`='".$glow[0]."(glow#".$msg.")"."'");
- $this->restart();
- $this->sendmsg("Nameglow alterada com sucesso!");
- } else {
- $this->mysql->query("UPDATE `bots` SET `name`='".$bot[0]['name']."(glow#".$msg.")"."'");
- $this->restart();
- $this->sendmsg("Nameglow adicionado com sucesso!");
- }
- }else if(substr($message[0], 1) == "name"){
- $special = explode("(", $bot[0]['name']);
- if($special[1]){
- $this->mysql->query("UPDATE `bots` SET `name`='".$msg."(".$special[1]."'");
- $this->restart();
- $this->sendmsg("Nome alterado com sucesso!");
- }else{
- $this->nome = $msg;
- $this->restart();
- $this->sendmsg("Nome alterado com sucesso!");
- }
- }else if(substr($message[0], 1) == "av" || substr($message[0], 1) == "avatar"){
- $this->avatar = $msg;
- $this->mysql->query("UPDATE `bots` SET `avatar`='".$msg."'");
- $this->restart();
- $this->sendmsg("Avatar alterado com sucesso!");
- }else if(substr($message[0], 1) == "status"){
- $status = explode("##", $bot[0]['name'], 2);
- if($status[1]){
- $this->mysql->query("UPDATE `bots` SET `name`='".$status[0]."##".$msg."'");
- $this->restart();
- $this->sendmsg("Status alterado com sucesso!");
- } else {
- $this->mysql->query("UPDATE `bots` SET `name`='".$bot[0]['name']."##".$msg."'");
- $this->restart();
- $this->sendmsg("Status adicionado com sucesso!");
- }
- }
- break;
- case "restart":
- if(!in_array($packet["u"], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet["u"]);
- }
- $this->sendmsg("[Servidor]: Estou sendo reiniciado (backoff)");
- $this->restart();
- break;
- case'dunceme':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->send('<c p="Você foi dunced por ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are undunced." u="'.$packet['u'].'" t="/gd3600" />');
- break;
- case'undunceme':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->send('<c p="You have been dunced by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are undunced." u="'.$packet['u'].'" t="/gd3600" />');
- break;
- case 'value':
- if(!$owner) {
- break;
- }
- $uRow = $this->mysql->fetch_array('select * from `users` where `username`=\'' . $this->mysql->sanatize($args[1]) . '\';');
- $user->sendRoom("<m u=\"0\" t=\"The k-k2 values for [".$args[1]."]: K1-[".$uRow[0]['k']."] K2-[".$uRow[0]['k2']."]\" />");
- break;
- case'modme':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(!in_array($packet['u'], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet['u']);
- }
- $this->send('<c p="voce que pediu ['.$this->users[$packet['u']]['registered'].'] " u="'.$packet['u'].'" t="/m" />');
- break;
- case'kickme':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->send('<c p="You have been kicked by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are kicked." u="'.$packet['u'].'" t="/k" />');
- break;
- case'kick':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->send('<c p="You have been kicked by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are kicked." u="'.$packet['u'].'" t="/k" />');
- break;
- case'guestme':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->send('<c p="You have been dunced by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are undunced." u="'.$packet['u'].'" t="/r" />');
- break;
- case'smiley':
- mysql_connect('localhost','root','');
- mysql_select_db('pulse') or $this->sendmsg('Can\'t connect.');
- $message = explode(' ', $message[1], 1);
- $power = $message[0];
- $db = mysql_query("SELECT * FROM `powers` WHERE name='$power'");
- $row = mysql_fetch_array($db);
- if(!$row['name']) {$this->sendmsg('Power not found! (d)');}
- else {
- $powers = str_replace(',','#) (',$row['topsh']);
- if(empty($row['topsh'])) {$this->sendmsg(ucfirst($power).' are doar ('.$power.') ca smilies.');}
- else {
- $this->sendmsg('('.$power.'#) Smilies : ('.$powers.'#)');}}
- break;
- case "powers":
- $user = $this->users[$packet["u"]];
- $user2 = ($user["registered"]) ? $user["registered"]: $user["u"];
- $this->sendmsg('!everypower '.$user2.'');
- break;
- case'memberme':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->send('<c p="You have been dunced by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are undunced." u="'.$packet['u'].'" t="/e" />');
- break;
- case'last':
- $pow2 = file_get_contents('http://xat.com/web_gear/chat/pow2.php?Milk=1234');
- $pow2 = json_decode($pow2, true);
- $powername = array_search($pow2['0']['1']['id'], $pow2['5']['1']);
- $status = ($pow2[0][1]['text'] == '[LIMITED]') ? 'LIMITED':'UNLIMITED';
- $smilie = array_merge(array($powername), array_keys($pow2['3']['1'], $pow2['0']['1']['id'])); //get all smilies of the new power
- $smilies = array();
- $pawns = array();
- foreach($smilie as $v)
- array_push($smilies, $v);
- foreach($pow2[6][1] as $name => $value)
- if($name != 'time' && $value[0] == $pow2['0']['1']['id'])
- array_push($pawns, 'h'.$name);
- $smilielist = implode("), (", $smilies);
- $pawnlist = implode(", ", $pawns);
- $this->sendmsg(ucfirst($powername).' | ID : '.$pow2['0']['1']['id'].' | Status : '.$status.' | Smilies: ('.ucfirst($smilielist).') | Hats : '.$pawnlist);
- break;
- case 'promocost':
- $hours = array(
- '0.5' => 8,
- '1' => 16,
- '1.5' => 25,
- '2' => 33,
- '2.5' => 41,
- '3' => 49,
- '3.5' => 57,
- '4' => 66,
- '4.5' => 74,
- '5' => 85,
- '5.5' => 93,
- '6' => 102
- );
- if ( key_exists( $message[ 1 ], $hours ) )
- $this->sendmsg( '' . $message[ 1 ] . ' ora promovare costa: ' . $message[ 1 ] * 200 . ' xats sau ' . $hours[ $message[ 1 ] ] . ' days' );
- else
- $this->sendmsg( 'incorrect amount of hours' );
- break;
- {
- return false;
- }
- break;
- case 'love':
- // !lovetest [alguma coisa] [alguma coisa2]
- $gerar = rand( 0, 100 );
- $this->sendmsg( $message[ 1 ] . ' + ' . $message[ 2 ] . ' = ' . $gerar . '%' );
- break;
- case'unbanme':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(!in_array($packet['u'], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet['u']);
- }
- $this->send('<c p="voce que pediu ['.$this->users[$packet['u']]['registered'].'] " u="'.$packet['u'].'" t="/u" />');
- break;
- case 'calc':
- /* Command created by iZerang */
- // !calc [numero] [/ * * -] [numero 2]
- if ( is_numeric( $message[1] ) && is_numeric( $message[3] ) ) {
- switch ( $message[2] ) {
- case "*":
- $x = $message[1] * $message[3];
- $this->sendmsg("{$message[1]} x {$message[3]} = {$x}");
- break;
- case "/":
- $x = $message[1] / $message[3];
- $this->sendmsg("{$message[1]} + {$message[3]} = {$x}");
- break;
- case "+":
- $x = $message[1] + $message[3];
- $this->sendmsg("{$message[1]} + {$message[3]} = {$x}");
- break;
- case "-":
- $x = $message[1] - $message[3];
- $this->sendmsg("{$message[1]} - {$message[3]} = {$x}");
- break;
- }
- //$message[2]
- } //is_numeric( $message[1] ) && is_numeric( $message[3] )
- else {
- $this->sendmsg( 'Você deve digitar uma conta valida' , "PM", $packet[ "u" ] );
- }
- break;
- case 'dx':
- $days = intval($message[1]);
- if($days < 1)
- return $this->sendPM($packet['u'], 'days must be 1 or more');
- $tradeValue = 13;
- $xats = floor($days * $tradeValue);
- $this->sendmsg($days.' days costa '.$xats.' xats cu 13 xats pe days');
- break;
- case "xavi":
- $user = $this->users[$packet["u"]];
- $user2 = ($user["registered"]) ? $user["registered"]: $user["u"];
- $this->sendmsg('!delpower '.$user2.' xavi');
- break;
- case'unban':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(!in_array($packet['u'], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet['u']);
- }
- $this->send('<c p="voce que pediu ['.$this->users[$packet['u']]['registered'].'] " u="'.$packet['u'].'" t="/u" />');
- break;
- case'ban':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(!in_array($packet['u'], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet['u']);
- }
- $this->send('<c p="voce que pediu ['.$this->users[$packet['u']]['registered'].'] " u="'.$packet['u'].'" t="/g10000" />');
- break;
- case'ownerme':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(!in_array($packet['u'], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet['u']);
- }
- $this->send('<c p="voce que pediu ['.$this->users[$packet['u']]['registered'].'] " u="'.$packet['u'].'" t="/M" />');
- break;
- case'gag':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->send('<c p="You have been dunced by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are undunced." u="'.$packet['u'].'" t="/gg" />');
- break;
- case 'lastpower':
- /* Command created by IoNuT */
- $url = @file_get_contents('http://xat.com/json/powers.php');
- if(empty($url)){$this->sendmsg('Falha ao obter o ultimo power, avise um administrador!'); return false;}
- $conteudo = json_decode($url, true);
- $ultimo_pw = reset($conteudo);
- $this->sendmsg('Ultimul power adaugat este : ('.$ultimo_pw['s'].'#).');
- break;
- case'mute':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->send('<c p="You have been dunced by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are undunced." u="'.$packet['u'].'" t="/gm" />');
- break;
- case'banme':
- $message = explode(' ', $message[1], 1);
- $users = $message[0];
- if(empty($users)) $users = $packet['u'];
- $this->send('<c p="You have been dunced by ['.$this->users[$packet['u']]['registered'].'] or please refresh if you are undunced." u="'.$packet['u'].'" t="/g6000" />');
- break;
- case 'radio':
- $connection = explode(':', $this->radioinfo);
- $url = fsockopen($connection[0],$connection[1]);
- if($this->radioinfo == 'semnome' or !$this->radioinfo){$this->sendmsg("This group chat does not have a radio."); return false;}
- if(!$url){
- $this->sendmsg("Connection failed."); return false;
- } else {
- fputs($url,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n");
- $socket = fread($url, 1000);
- $return = explode(",", $socket);
- $final = str_replace("</body></html>", "", $return[6]);
- if(!$final){
- $this->sendmsg("a Musica que esta tocando e: Nao estou reconhecendo."); return false;
- } else
- $this->sendmsg("a Musica que esta tocando e: {$final}");
- }
- break;
- case'userinfo':
- $message = explode(' ', $message[1], 1);
- $user = $message[0];
- if(!$this->users[$user]['id']){
- $this->sendmsg("I'm not a noob.");
- } else {
- if($this->users[$user]['rel'] == 2) $this->users[$user]['rel'] = "Married";
- if($this->users[$user]['rel'] == 1) $this->users[$user]['rel'] = "Bff'd";
- $myNick = explode("##", $this->users[$user]['name'], 2);
- $myNick[0] = htmlspecialchars(html_entity_decode(htmlspecialchars_decode($myNick[0])));
- $relation = $this->users[$user]['rel'].' to '.$this->users[$user]['d2'];
- if($relation == 'Married to 0') $relation = 'Relation not found.';
- $name = explode('##', $this->users[$user]['name']);
- $n = $name[1];
- $this->sendmsg('Name : '.$myNick[0].' | Status : '.str_replace('#',' | ',$n).'| Avatar : '.$this->users[$user]['avatar'].' | Home : '.$this->users[$user]['home'].' | Relation : '.$relation);
- }
- break;
- case "desligar":
- case "die":
- if(!in_array($packet["u"], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet["u"]);
- }
- $this->sendmsg("[Servidor]: Estou sendo desligado (bye)");
- die();
- break;
- case 'autowelcome':
- if(!in_array($packet['u'], $this->config->admins)){
- return $this->sendmsg($this->withoutaccess, "PM", $packet['u']);
- }
- if(!empty($this->config->autowelcome))
- {
- $this->mysql->query("UPDATE bots SET autowelcome=''");
- $this->sendmsg('Autowelcome of message has been disabled!');
- return $this->restart();
- }
- else
- {
- $this->mysql->query("UPDATE bots SET autowelcome='Bine ati venit pe [chat] - [user]!'");
- $this->sendmsg('Autowelcome of message has been activated!');
- return $this->restart();
- }
- break;
- }
- }
- }
- function parseU($id){
- if(substr_count($id,'_')>=1) $id = substr($id,0,strpos($id,'_'));
- return $id;
- }
- public function restart()
- {
- $this->__construct();
- $this->connect();
- $this->enter();
- }
- public function fetchUser($id){
- $id = $this->parseU($id);
- if(isset($this->users[$id]))
- return $this->users[$id];
- else
- return false;
- }
- function member($id,$time=null){
- if(!$time) $time = 0;
- $id = $this->parseU($id);
- $this->sendC($id, '/e',$time);
- }
- function guest($id,$time=null) {
- if(!$time) $time = 0;
- $id = $this->parseU($id);
- $this->sendC($id, '/r',$time);
- }
- public function sendC($id=0, $com='') {
- $this->send('<c u="'.$id.'" t="'.$com.'" />');
- }
- public function censor($message) {
- $badwords = $this->censor;
- $message = @preg_replace('#\((.+)\)#U','',strtolower(' '.$message.' '));
- foreach($badwords as $bad) {
- $bad = trim($bad);
- if(strpos($message.' ', $bad.' ')!==false) {
- if(strlen($bad)>=2) {
- return true;
- }
- }
- }
- }
- function sendwelcome($message, $id, $f, $nome)
- {
- if(!$message)
- {
- return false;
- }
- $message = str_replace('[chat]', $this->config->room, $message);
- $message = str_replace('[online]', count($this->users), $message);
- $message = str_replace('[user]', $nome, $message);
- $this->sendmsg($message, 'PM', $id);
- }
- function sendmsg($message, $type = "MSG", $id = 0)
- {
- if(!$message){
- return false;
- }
- switch($type) {
- case "MSG":
- $this->send("<m t=\"{$message}\" u=\"{$this->botID}\" />");
- break;
- case "PM":
- $this->send("<p u=\"{$id}\" t=\"{$message}\" d=\"{$id}\" />");
- break;
- case "PC":
- $this->send("<z d=\"{$id}\" u=\"{$this->botID}\" t=\"{$message}\" />");
- break;
- }
- }
- }
- $bot = new iBot();
- while(1){
- try{
- if($bot->load() == "OFF"){
- $bot->disconnect();
- $bot->enter();
- }
- }
- catch(Exception $e){
- die($e);
- }
- }
- class database {
- public $link, $host, $user, $pass, $name;
- public $doe = true;
- public function __construct($host = null, $user = null, $pass = null, $name = null)
- {
- if ($name != null) {
- $this->host = $host;
- $this->user = $user;
- $this->pass = $pass;
- $this->name = $name;
- }
- if (!$this->connected()) {
- $this->link = mysqli_connect($this->host, $this->user, $this->pass, $this->name);
- if (!$this->connected()){$this->error("Failed to connect to `{$this->host}`.`{$this->name}` using password [" . (empty($this->pass) ? "NO" : 'YES') . "]");}
- }
- return true;
- }
- public function connected(){return @mysqli_ping($this->link) ? true : false;}
- public function error($error)
- {
- print $error . chr(10);
- if ($this->doe == true){exit;}
- }
- public function query($query = "")
- {
- if (!is_string($query)){return false;}
- $this->__construct();
- $return = @mysqli_query($this->link, $query);
- return $return ? $return : false;
- }
- public function fetch_array($query, $return = array())
- {
- $this->__construct();
- if (!is_string($query) || !($res = $this->query($query))){return array();}
- while ($data = mysqli_fetch_assoc($res)) {$return[] = $data;}
- return !empty($return) ? $return : array();
- }
- public function sanatize($data)
- {
- if(is_array($data)){return array_map(array($this,'sanatize'), $data);}
- if(function_exists("mb_convert_encoding")) {$data = @mb_convert_encoding($data, "UTF-8", 'auto');}
- return $this->link->real_escape_string($data);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement