Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 57.16 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14. $sql = "SELECT chat FROM bots";
  15. $result = $conn->query($sql);
  16.  
  17. if ($result->num_rows > 0) {
  18. // output data of each row
  19. while($row = $result->fetch_assoc()) {
  20. $GLOBALS["chat"] = $row["chat"];
  21. }
  22. } else {
  23. echo "0 results";
  24. }
  25. $conn->close();
  26. set_time_limit( 0 ); // Tempo maximo de ejecucion
  27. error_reporting( 1 ); // No mostrar errores
  28.  
  29. class zBot
  30. {
  31. $chat = $GLOBALS["chat"];
  32. /* Sample config */
  33. public $ixatlink = ""; // Link do iXat
  34. public $usuario = "lbots"; // Usuario BOT
  35. public $senha = ""; // Senha admin123
  36. public $sala = $chat; /* Lembre-se que a conta do BOT precisa ter everypower! */
  37. public $nome = "LightBot(tickle#noel#0099D5#f#topspin#w6#offset#w6351)(glow#00eeff#flag#gb#e)(text#0000FF#grad#00eeff#00ABFF#00eeff#ffffff#r160)(pglow#010101)"; // Nome do BOT
  38. public $hat = "(hat#hC)"; // Hat do BOT
  39. public $glow = "(glow#-------#00FF00)"; // Glow do BOT
  40. public $status = "LBots#00eeff#ffffff"; // Status do BOT
  41. public $statusglow = "#ffffff#00eeff"; // Statusglow do BOT
  42. public $statuscolor = "#ffffff#grad#00eeff"; // Statuscolor do BOT
  43. public $textcolor = "(text#00ff00#-------)"; // Statuscolor do BOT
  44. public $avatar = "http://i.imgur.com/O1oPr1h.png#glitter#http://lchats.com/web_gear/chat_bgs/4.png"; // Avatar do BOT
  45. public $home = "http://lchats.com/"; // Homepage[casinha] do BOT
  46. public $maxKicks = 3; //Number of kicks before ban
  47. public $admins = Array(1438515); // IDs com acesso exemplo Array(42,100,96218942); etc...
  48. public $semacesso = "You dont have permission to use commands!"; // Mensagem sem acesso..
  49. public $autoWelcome = "Welcome To LightBots! If You Would Like A Bot Message Light!"; // Mensagem de welcome para os usuarios
  50. public $automember = True; // True = ativado, False = desativado
  51. public $autoguest = False; // True = ativado, False = desativado
  52. public $censor = array("wioxo","ixat.ro","zat","pica","xatbrasil.com","xatbrasil","pnc","cu","4xat.com","ixat");
  53. //public $spam = "5";
  54. public $flood = "7";
  55. /* Extra */
  56. public $usuarios;
  57. public $logado;
  58. public $socket;
  59. public $chatID;
  60. public $botID;
  61. public $porta;
  62. public $ip;
  63. public $k;
  64.  
  65. /* Funcao de conectar com o ixat */
  66. public function conectar( )
  67. {
  68. $this->pegarInfos();
  69. $this->socket = socket_create( AF_INET, SOCK_STREAM, SOL_TCP );
  70. $test = socket_connect( $this->socket, $this->ip, $this->porta );
  71. echo "--> Connecting {$this->ip}:{$this->porta}...\n";
  72. If ( !$test ) {
  73. die( "<-- Failed Connection!\n" );
  74. } //!$test
  75. }
  76.  
  77. /* Funcao de desconetar [usado para debug] */
  78. public function desconectar( )
  79. {
  80. If ( isset( $this->socket ) && $this->socket == True )
  81. socket_close( $this->socket );
  82. $this->socket = False;
  83. }
  84.  
  85. /* Funcao de pegar informacoes sobre o usuario bot... */
  86. function pegarInfos( )
  87. {
  88. $curl = curl_init( $this->ixatlink . "/mobile?" . time() );
  89. curl_setopt( $curl, CURLOPT_RETURNTRANSFER, True );
  90. curl_setopt( $curl, CURLOPT_POST, True );
  91. curl_setopt( $curl, CURLOPT_POSTFIELDS, "username={$this->usuario}&password={$this->senha}&room={$this->sala}" );
  92. $url = curl_exec( $curl );
  93. $parte1 = explode( "\"id\":\"", $url );
  94. $id = explode( "\"", $parte1[ 1 ] );
  95. $this->botID = $id[ 0 ];
  96. $parte2 = explode( "\"k\":\"", $url );
  97. $k = explode( "\"", $parte2[ 1 ] );
  98. $this->k = $k[ 0 ];
  99. $parte3 = explode( "'<y r=\"", $url );
  100. $sala_data = explode('c="', $url);
  101. $salaID = explode('"', $sala_data[1]);
  102. $this->chatID = $salaID[0];
  103. $parte4 = explode( "WebSocket('ws://", $url );
  104. $ip = explode( ":", $parte4[ 1 ] );
  105. $this->ip = $ip[ 0 ];
  106. $dx_data = explode("\"xats\":\"", $url);
  107. $dx = explode("\"", $dx_data[1]);
  108. $this->dx = $dx[0];
  109. $d1_data = explode("\"days\":\"", $url);
  110. $d1 = explode("\"", $d1_data[1]);
  111. $this->d1 = $d1[0];
  112. $d4_data = explode('"p4":', $url);
  113. $d4 = explode(',"', $d4_data[1]);
  114. $this->d4 = $d4[0];
  115. $d5_data = explode('"p5":', $url);
  116. $d5 = explode(',"', $d5_data[1]);
  117. $this->d5 = $d5[0];
  118. $d6_data = explode('"p6":', $url);
  119. $d6 = explode(',"', $d6_data[1]);
  120. $this->d6 = $d6[0];
  121. $d7_data = explode('"p7":', $url);
  122. $d7 = explode(',"', $d7_data[1]);
  123. $this->d7 = $d7[0];
  124. $d8_data = explode('"p8":', $url);
  125. $d8 = explode(',"', $d8_data[1]);
  126. $this->d8 = $d8[0];
  127. $d9_data = explode('"p9":', $url);
  128. $d9 = explode(',"', $d9_data[1]);
  129. $this->d9 = $d9[0];
  130. $d10_data = explode('"p10":', $url);
  131. $d10 = explode(',"', $d10_data[1]);
  132. $this->d10 = $d10[0];
  133. $d11_data = explode('"p11":', $url);
  134. $d11 = explode(',"', $d11_data[1]);
  135. $this->d11 = $d11[0];
  136. $d12_data = explode('"p12":', $url);
  137. $d12 = explode(',"', $d12_data[1]);
  138. $this->d12 = $d12[0];
  139. $d13_data = explode('"p13":', $url);
  140. $d13 = explode(',"', $d13_data[1]);
  141. $this->d13 = $d13[0];
  142. $d14_data = explode('p14":', $url);
  143. $d14 = explode(',"', $d14_data[1]);
  144. $this->d14 = $d14[0];
  145. $d15_data = explode('p15":', $url);
  146. $d15 = explode(',"', $d15_data[1]);
  147. $this->d15 = $d15[0];
  148. $d16_data = explode('p16":', $url);
  149. $d16 = explode(',"', $d16_data[1]);
  150. $this->d16 = $d16[0];
  151. $d17_data = explode('p17":', $url);
  152. $d17 = explode('}', $d17_data[1]);
  153. $this->d17 = $d17[0];
  154. $parte5 = explode( $this->ip . ":", $url );
  155. $porta = explode( "/", $parte5[ 1 ] );
  156. $this->porta = $porta[ 0 ];
  157. If ( empty( $url ) ) {
  158. die( "<-- Falha na conexao, ou o site pode estar offlne!!\n" );
  159. } //empty( $url )
  160. If ( empty( $this->botID ) ) {
  161. die( "<-- O chat nao existe, ou os dados estao incorretos!\n" );
  162. } //empty( $this->botID )
  163. }
  164.  
  165. /* Passar codigo XML para pegar B1 e B2 */
  166. public function passarXML( $xml, $retornar = null )
  167. {
  168. $conteudo = @simplexml_load_string( trim( $xml ) );
  169. Foreach ( $conteudo->Attributes() as $i => $u )
  170. $retornar[ $i ] = (string) ( (string) $u );
  171. return $retornar;
  172. }
  173.  
  174. /* Enviar packets obvio ._. */
  175. public function enviar( $packet )
  176. {
  177. If ( $packet[ strlen( $packet ) - 1 ] != chr( 0 ) )
  178. $packet .= chr( 0 );
  179. echo "[BOT]-> {$packet}\n";
  180. return socket_write( $this->socket, $packet, strlen( $packet ) );
  181. }
  182.  
  183. /* Entrar no ixat grupo */
  184. public function entrar( )
  185. {
  186. $this->conectar();
  187. $this->enviar( "<y r=\"{$this->chatID}\" />" );
  188. $x = $this->passarXML(socket_read($this->socket, 1205));
  189. $b1 = floor(2 << ($x["yi"] % 94)) % $x["yc"] + $x["yi"];
  190. $b2 = floor(pow(2, $x["ys"] % 27));
  191. $j2 = "cb=\"0\" ";
  192. $j2 .= "auth1=\"{$b1}\" ";
  193. $j2 .= "auth2=\"{$b2}\" ";
  194. $j2 .= "y=\"{$x[ 'yi' ]}\" ";
  195. $j2 .= "k=\"{$this->k}\" ";
  196. $j2 .= "k3=\"0\" ";
  197. $j2 .= "d1=\"{$this->d1}\" ";
  198. $j2 .= "p=\"0\" ";
  199. $j2 .= "c=\"{$this->chatID}\" ";
  200. $j2 .= "f=\"8192\" ";
  201. $j2 .= "u=\"{$this->botID}\" ";
  202. $j2 .= "m6=\"131072\" ";
  203. $j2 .= "d0=\"0\" ";
  204. $j2 .= "d2=\"0\" ";
  205. $j2 .= "d4=\"{$this->d4}\" ";
  206. $j2 .= "d5=\"{$this->d5}\" ";
  207. $j2 .= "d6=\"{$this->d6}\" ";
  208. $j2 .= "d7=\"{$this->d7}\" ";
  209. $j2 .= "d8=\"{$this->d8}\" ";
  210. $j2 .= "d9=\"{$this->d9}\" ";
  211. $j2 .= "d10=\"{$this->d10}\" ";
  212. $j2 .= "d11=\"{$this->d11}\" ";
  213. $j2 .= "d12=\"{$this->d12}\" ";
  214. $j2 .= "d13=\"{$this->d13}\" ";
  215. $j2 .= "d14=\"{$this->d14}\" ";
  216. $j2 .= "d15=\"{$this->d15}\" ";
  217. $j2 .= "d16=\"{$this->d16}\" ";
  218. $j2 .= "d17=\"{$this->d17}\" ";
  219. $j2 .= "N=\"{$this->usuario}\" ";
  220. $j2 .= "n=\"{$this->nome}{$this->hat}{$this->glow}##{$this->status}#{$this->statusglow}#{$this->statuscolor}\" ";
  221. $j2 .= "a=\"{$this->avatar}\" ";
  222. $j2 .= "h=\"{$this->home}\" ";
  223. $j2 .= "v=\"0\"";
  224. $j2 = "<j2 {$j2} />";
  225. $this->enviar( $j2 );
  226. }
  227.  
  228. /* Carregar packets */
  229. public function carregar( $verIfi = True, $teste_var = True )
  230. {
  231. $x = "";
  232. try {
  233. $x = rtrim( socket_read( $this->socket, 2048 ) );
  234. $x = str_replace( "", "", $x );
  235. }
  236. catch ( Exception $e ) {
  237. return "DESLIGADO";
  238. }
  239. If ( !$x )
  240. return "DESLIGADO";
  241. If ( $x[ strlen( $x ) - 1 ] != ">" )
  242. $x .= $this->carregar( True );
  243. If ( $verIfi )
  244. $this->packets( $x, $teste_var );
  245. return $x;
  246. }
  247.  
  248. /* Mostrar packets e etc... */
  249. public function packets( $packet, $teste = True, $teste2 = False )
  250. {
  251. If ( substr_count( $packet, ">" ) > 1 ) {
  252. $packet = explode( "/>", $packet );
  253. $teste2 = True;
  254. } //substr_count( $packet, ">" ) > 1
  255. Foreach ( (Array) $packet as $p ) {
  256. If ( $teste2 )
  257. $p .= "/>";
  258. $p = trim( $p );
  259. If ( strlen( $p ) < 5 )
  260. return;
  261. echo "[IXAT]-> {$p}\n";
  262. $tipo = trim( strtolower( substr( $p, 1, strpos( $p . " ", " " ) ) ) );
  263. $p = trim( str_replace( "<" . $tipo, "", str_replace( "/>", "", $p ) ) );
  264. $p = str_replace( "\"", "", str_replace( "\" ", "&", str_replace( "&", "__38", $p ) ) );
  265. parse_str( $p, $this->packet[ $tipo ] );
  266. Foreach ( $this->packet[ $tipo ] as $x => $v )
  267. $this->packet[ $tipo ][ $x ] = str_replace( "__38", "&", str_replace( "pl_", "+", $v ) );
  268. If ( $teste )
  269. $this->tipos( $tipo, $this->packet[ $tipo ] );
  270. } //(Array) $packet as $p
  271. }
  272.  
  273. /* Algums tipos de packets e comandos podem ser adicionado aqui! */
  274. public function tipos( $tipo, $packet )
  275. {
  276. switch ( $tipo ) {
  277. /* Packets */
  278. case 'u':
  279. $u = $this->fetchUser($packet['u']);
  280. $this->users[$packet['u']]['cb'] = @$packet['cb'];
  281. $this->users[$packet['u']]['s'] = @$packet['s'];
  282. $this->users[$packet['u']]['f'] = (isset($packet['f'])) ? (int)$packet['f'] : 0;
  283. $this->users[$packet['u']]['id'] = $packet['u'];
  284. $this->users[$packet['u']]['d0'] = (isset($packet['d0'])) ? (int)$packet['d0'] : 0;
  285. $this->users[$packet['u']]['d2'] = (isset($packet['d2'])) ? @$packet['d2'] : 0;
  286. $this->users[$packet['u']]['q'] = (isset($packet['q'])) ? (int)$packet['q'] : 0;
  287. $this->users[$packet['u']]['registered'] = ((key_exists('N',$packet))?$packet['N']:'Unregistered');
  288. //$this->users[$packet['u']]['name'] = (substr(@$packet['n'],0,1)=="$") ? substr(@$packet['n'],0,1) : $packet['n'];
  289. $this->users[$packet['u']]['name'] = @$packet['n'];
  290. $this->users[$packet['u']]['avatar'] = (isset($packet['a'])) ? @$packet['a'] : 'No Avatar';
  291. $this->users[$packet['u']]['home'] = (isset($packet['h'])) ? @$packet['h'] : 'No Homepage';
  292. $this->users[$packet['u']]['v'] = (@$packet['v']) ? @$packet['v'] : 0;
  293. $this->users[$packet['u']]['bride'] = (isset($packet['d2'])) ? @$packet['d2'] : 0;
  294. $this->users[$packet['u']]['rel'] = (@$packet['d0'] & 1) ? 1 : 2;//Relationship Type: 1=BFF 2=Married #note that if they not in a relationship it will show there Married this can be fixed by detecting if they have a bride [D2]
  295. $this->users[$packet['u']]['sub'] = (isset($packet['p0'])) ? 1 : 0;
  296. if($this->autoWelcome!=''&&!isset($packet['s']))$this->sendPM($packet['u'], $this->autoWelcome);
  297.  
  298. if($packet['rank'] == 5)
  299. {
  300. if($this->automember){
  301. $this->member($packet['u']);
  302. }
  303. }
  304. if($packet['rank'] == 3)
  305. {
  306. if($this->autoguest){
  307. $this->guest($packet['u']);
  308. }
  309. }
  310. break;
  311.  
  312.  
  313.  
  314. case "i":
  315. $this->enviarMSG( "Link Chats (yum) ", "PM", $packet[ "u" ] );
  316. break;
  317. case'i':
  318. $info = explode(';=', $this->packet['i']['b']);
  319. $this->radioinfo = str_replace("http://", "", $info[4]);
  320. $ci = explode(';=', $packet['b']);
  321. $this->chatInfo = array('background'=>$ci[0], 'tabbedChat'=>$ci[1],'tabbedChatID'=>$ci[2],'language'=>$ci[3],'radio'=>str_replace('http://','',$ci[4]),'buttons'=>$ci[5]);
  322. print_r($this->chatInfo);
  323. break;
  324.  
  325. case "m": // Mensagem
  326. if(isset($this->packet['m']['s'])) return;
  327.  
  328. if(($this->packet['m']['t']) =='fuck you') {
  329.  
  330. $user = $this->users[ $packet[ "u" ] ];
  331. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  332. $this->enviarMSG ('dont be rude you cunt (xd)');
  333. }
  334. if(($this->packet['m']['t']) =='te amo') {
  335.  
  336. $user = $this->users[ $packet[ "u" ] ];
  337. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  338. $this->enviarMSG ('wish somebody told me what she said, dont it mean i love you (cd) (hi#c)');
  339. }
  340.  
  341. if(($this->packet['m']['t']) =='matt') {
  342.  
  343. $user = $this->users[ $packet[ "u" ] ];
  344. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  345. $this->enviarMSG ('loves sucking chode(yum)');
  346. }
  347. if(($this->packet['m']['t']) =='haha') {
  348.  
  349. $user = $this->users[ $packet[ "u" ] ];
  350. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  351. $this->enviarMSG ('real funny (xd#hehe)');
  352. }
  353.  
  354. if(($this->packet['m']['t']) =='hey bot') {
  355. $user = $this->users[ $packet[ "u" ] ];
  356. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  357. $this->enviarMSG ('Hey '.$usuario.'');
  358. }
  359.  
  360. if(($this->packet['m']['t']) =='how do i get links') {
  361.  
  362. $user = $this->users[ $packet[ "u" ] ];
  363. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  364. $this->enviarMSG ('get people here or donate for them');
  365. }
  366.  
  367. if(($this->packet['m']['t']) =='(cd)') {
  368.  
  369. $user = $this->users[ $packet[ "u" ] ];
  370. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  371. $this->enviarMSG ('(cd)');
  372. }
  373. if(($this->packet['m']['t']) =='this ixat is shit') {
  374. $user = $this->users[ $packet[ "u" ] ];
  375. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  376. $this->enviarMSG ('well it clearly isnt you stupid neek. and its link chats not an ixat (facepalm)');
  377. }
  378. if(($this->packet['m']['t']) =='joseph') {
  379. $user = $this->users[ $packet[ "u" ] ];
  380. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  381. $this->enviarMSG ('thinks he is smart but really is not');
  382. }
  383. if(($this->packet['m']['t']) =='users') {
  384.  
  385. $user = $this->users[ $packet[ "u" ] ];
  386. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  387. $this->enviarMSG( $users . '' . 'there is ' . count( $this->users ) . ' Users in the chatroom' );
  388. }
  389. if(($this->packet['m']['t']) =='hey gurl') {
  390.  
  391. $user = $this->users[ $packet[ "u" ] ];
  392. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  393. $this->enviarMSG('shut the hell up speaking like a gay cunt');
  394. }
  395. if(($this->packet['m']['t']) =='do i get free powers') {
  396.  
  397. $user = $this->users[ $packet[ "u" ] ];
  398. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  399. $this->enviarMSG("damn right just register(hug)");
  400. }
  401. if(($this->packet['m']['t']) =='(evil)') {
  402.  
  403. $user = $this->users[ $packet[ "u" ] ];
  404. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  405. $this->enviarMSG("your sexy when you act evil (hehe)");
  406. }
  407. if(($this->packet['m']['t']) =='welzy is gay') {
  408.  
  409. $user = $this->users[ $packet[ "u" ] ];
  410. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  411. $this->enviarMSG("we all know you are really matt");
  412. }
  413. if(($this->packet['m']['t']) =='bot') {
  414.  
  415. $user = $this->users[ $packet[ "u" ] ];
  416. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  417. $this->enviarMSG("Yes i am a Bot (gloomy)");
  418. }
  419. if(($this->packet['m']['t']) =='avatar') {
  420.  
  421. $user = $this->users[ $packet[ "u" ] ];
  422. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  423. $this->enviarMSG("http://pastebin.com/xBHjHw3n");
  424. }
  425. if(($this->packet['m']['t']) =='nameglow') {
  426.  
  427. $user = $this->users[ $packet[ "u" ] ];
  428. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  429. $this->enviarMSG ('Nameglow and color generator http://ebr.link/grad');
  430. }
  431. if(($this->packet['m']['t']) =='animated') {
  432.  
  433. $user = $this->users[ $packet[ "u" ] ];
  434. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  435. $this->enviarMSG ('animated pics are here http://pastebin.com/xBHjHw3n');
  436. }
  437. if(($this->packet['m']['t']) =='you are a slut') {
  438.  
  439. $user = $this->users[ $packet[ "u" ] ];
  440. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  441. $this->enviarMSG ('put your pinky in my chilli ring');
  442. }
  443. if(($this->packet['m']['t']) =='zombieland') {
  444.  
  445. $user = $this->users[ $packet[ "u" ] ];
  446. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  447. $this->enviarMSG ('Zombieland gamemode available if TEN is online');
  448. }
  449. if(($this->packet['m']['t']) =='gay') {
  450. $user = $this->users[ $packet[ "u" ] ];
  451. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  452. $this->enviarMSG ('matt AKA TEN loves it up the shitter(troll#hehe).');
  453. }
  454. if(($this->packet['m']['t']) =='welzy') {
  455.  
  456. $user = $this->users[ $packet[ "u" ] ];
  457. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  458. $this->enviarMSG ('if welzy is away try his skype it is welzydesigns');
  459. }
  460. if(($this->packet['m']['t']) =='prick') {
  461.  
  462. $user = $this->users[ $packet[ "u" ] ];
  463. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  464. $this->enviarMSG ('you are the prick, you sad fuck');
  465. }
  466. if(($this->packet['m']['t']) =='radio') {
  467.  
  468. $user = $this->users[ $packet[ "u" ] ];
  469. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  470. $this->enviarMSG ('http://ebr.link/last for the last played tracks');
  471. }
  472. if(($this->packet['m']['t']) =='register') {
  473.  
  474. $user = $this->users[ $packet[ "u" ] ];
  475. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  476. $this->enviarMSG ('Register your account and get free powers (goo#dance)');
  477. }
  478. if(($this->packet['m']['t']) =='namegrad') {
  479.  
  480. $user = $this->users[ $packet[ "u" ] ];
  481. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  482. $this->enviarMSG (' Generator at http://ebr.link/grad ');
  483. }
  484.  
  485. case "p":
  486. if(isset($packet["i"]) && $packet["i"] > 0)
  487. if(substr($packet['t']) && ++$this->users[$packet['u']]['messages'] >= 1 && time() - $this->users[$packet['u']]['time'] < 1)
  488. {
  489. $this->enviarMSG("Flood");
  490. }
  491.  
  492.  
  493. if(preg_match('/(.)\1{' . ($this->spam - 1) . ',}/', strtolower($packet['t'])) != 0)
  494. {
  495. $this->kick('Spam Detectado', $packet['u']);
  496. }
  497.  
  498. if($this->censor($packet['t'])) {
  499. //$this->send('<c p="Esta palabra no esta permitido aqui.(d)" u="'.$packet['u'].'" t="/k" />');
  500. $this->kick('Esta palabra no esta permitido aqui.(d)',$packet['u']);
  501. }
  502. If ( isset( $packet[ "i" ] ) && $packet[ "i" ] > 0 )
  503. break;
  504.  
  505. $msg = $mensagem = explode( " ", $packet[ "t" ] );
  506. unset( $msg[ 0 ] );
  507. $msg = implode( " ", $msg );
  508. If ( isset( $mensagem[ 0 ] ) && $mensagem[ 0 ][ 0 ] != "!" )
  509. break;
  510. $user = $this->usuarios[ $packet[ "u" ] ];
  511. $usuario = ( $user[ "N" ] ) ? $user[ "N" ] : $user[ "u" ];
  512. switch ( substr( $mensagem[ 0 ], 1 ) ) {
  513. /* Comandos para todos */
  514. case "say":
  515. // !say [msg]
  516. $user = $this->users[ $packet[ "u" ] ];
  517. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  518. $this->enviarMSG (' '.$msg);
  519. break;
  520.  
  521. case "kiss":
  522. if (!in_array($packet['u'], $this->admins)) {
  523. return $this->enviarMSG($this->semacesso, "PM", $packet['u']);
  524. }
  525. $message = explode(' ', $mensagem[3], 3);
  526. switch($mensagem[1]){
  527.  
  528. case "Bruna":
  529. $this->enviar('<a k="Bruna" p="' . $this->senha . '" m="'. $message[0] .'" />');
  530. break;
  531. case "Foda":
  532. $this->enviar('<a k="Foda" p="' . $this->senha . '" m="FODA-SE" />');
  533. break;
  534. case "Dig":
  535. $this->enviar('<a k="Digdin" p="' . $this->senha . '" m="SOU FODA" />');
  536. break;
  537. case "Susto":
  538. $this->enviar('<a k="Susto" p="' . $this->senha . '" m="OI" />');
  539. break;
  540. case "Shark":
  541. $this->enviar('<a k="Shark" p="' . $this->senha . '" m="KISS BOT" />');
  542. break;
  543. }
  544.  
  545. break;
  546.  
  547. case "test":
  548. // !say [msg]
  549. $user = $this->users[ $packet[ "u" ] ];
  550. $usuario = ( $user[ "registered" ] ) ? $user[ "registered" ] : $user[ "u" ];
  551. $this->enviarMSG ('('.$msg.') ');
  552. break;
  553.  
  554.  
  555. case "sayadm":
  556. if ( !in_array( $packet[ 'u' ], $this->admins ) )
  557. {
  558. return $this->enviarMSG($this->withoutaccess, "PM", $packet['u']);
  559. }
  560.  
  561. $this->enviarMSG($msg);
  562. break;
  563.  
  564.  
  565.  
  566.  
  567. case "info":
  568. // !info
  569. $this->enviarMSG( "Lbot By WeLzY", "PM", $packet[ "u" ] );
  570. break;
  571.  
  572. case 'radio':
  573.  
  574. $radio = file_get_contents('http://centauri.shoutca.st:8869/currentsong?sid=1');
  575.  
  576. $final = file_get_contents('http://centauri.shoutca.st:8869/currentsong?sid=1');
  577. if(!$final){
  578. $this->enviarMSG("Auto DJ."); return false;
  579. } else
  580. $this->enviarMSG("Now Playing on (nfe)(nfb)(nfr): {$final}");
  581.  
  582. break;
  583.  
  584.  
  585.  
  586.  
  587.  
  588. case 'id':
  589. $id = file_get_contents('http://lchats.com/web_gear/chat/auser3.php');
  590. if(!$id) { return $this->enviarMSG('unable to connect!',($type==0)?1:$type,$packet['u']); }
  591. //$id = str_replace($id, '=', ' = ');
  592. $t = explode('&',$id);
  593. $id = array('id'=>$t[1], 'k1'=>$t[2], 'k2'=>$t[3]);
  594.  
  595. $link = 'http://xat.com/web_gear/chat/register.php?'.$id['id'].'&'.$id['k1'].'&'.$id['k2'].'&mode=1';
  596. $this->enviarMSG(implode(', ',$id),($type==0)?1:$type,$packet['u']);
  597. $this->enviarMSG($link,($type==0)?1:$type,$packet['u']);
  598. break;
  599.  
  600. case 'youtubee':
  601. case 'yy':
  602. $query = str_replace(' ', '%20', $msg);
  603. $x = file_get_contents('http://gdata.youtube.com/feeds/api/videos?max-results=3&q=' . str_replace(' ', '%20', urlencode($query)));
  604. $js = json_decode(json_encode(new SimpleXMLElement($x)));
  605. if (!isset($js->entry[0]->title))
  606. return $this->enviarMSG('No results from Youtube.', $type, $msg['u']);
  607. $videos = array();
  608. $i = 0;
  609. while ($i != 3) {
  610. $URL = get_object_vars($js->entry[$i]->link[0]);
  611. $link = explode('&', $URL['@attributes']->href);
  612. if (!empty($link[0]))
  613. $this->enviarMSG($js->entry[$i]->title . ' - ' . $link[0], $type, $msg['u']);
  614. $i++;
  615. sleep(3);
  616. }
  617. break;
  618.  
  619. case'typing':
  620. switch(strtolower($mensagem[1])){
  621. case 'on':
  622. $this->enviar('/RTypeOn');
  623. break;
  624.  
  625. case 'off':
  626. $this->enviar('/RTypeOff');
  627. break;
  628. }
  629. break;
  630.  
  631. case'price2':
  632. $message = explode(' ', $mensagem[1], 1);
  633. $powers = $message[0];
  634. mysql_connect('127.0.0.1','root','yeahright');
  635. mysql_select_db('ixat');
  636. if(is_numeric($powers)){
  637. $db = mysql_query("SELECT * FROM `powers` WHERE id ='$powers'");}
  638. else {$db = mysql_query("SELECT * FROM `powers` WHERE name ='$powers'");}
  639. $row = mysql_fetch_array($db);
  640. if($row['name'] == true) {
  641. if(empty($row['xats'])) {$row['xats'] = '0 - 0';}
  642. if(empty($row['days'])) {$row['days'] = '0 - 0';}
  643. $this->enviarMSG(htmlentities(ucfirst($row['name'])).' custos '.$row['xats'].' xats ou '.$row['days'].' days.');
  644. } else { $this->enviarMSG('Power not found.');}
  645. break;
  646.  
  647. case'rinfo':
  648. $this->enviarMSG('ID : '.$this->sala.' | Buttons : _'.$this->chatInfo['buttons'].' | Radio : '.$this->chatInfo['radio'].' | Background : '.$this->chatInfo['background']);
  649. break;
  650.  
  651. case "value":
  652. // !value
  653. $this->enviarMSG( "You're worth nothing to me (maniac#c#clap#spin)", "MSG", $packet[ "u" ] );
  654. break;
  655. case "cmd":
  656. // !info
  657. $this->enviarMSG( "!online , !say , !price , !love , !choose , !perg , !info ,
  658. mazeme,snakeme,!att", "PM", $packet[ "u" ] );
  659. break;
  660.  
  661. case 'online':
  662. $this->enviarMSG( $users . '' . 'There is ' . count( $this->users ) . ' Users connected(xd).' );
  663. break;
  664.  
  665. case "choose":
  666. // !choose [coisa] [coisa2]
  667. $mensagem = explode( ' ou ', strtolower( $msg ) );
  668. if ( !isset( $mensagem[ 0 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
  669. return $this->enviarMSG( 'You can not make me choose shit bitch (D)', "PM", $packet[ 'u' ] );
  670. $mensagem = array_values( $mensagem );
  671. $rand = $mensagem[ array_rand( $mensagem ) ];
  672. $this->enviarMSG( 'I prefer ' . $rand, "PM", $packet[ 'u' ] );
  673. break;
  674.  
  675. case "perg":
  676. case "8ball":
  677. // !perg/!8ball [pergunta]
  678. $respostas = array(
  679. 'Maybe',
  680. 'Sim.',
  681. 'Do Not.',
  682. 'My sources said no.',
  683. 'Ah, SIM and SIM',
  684. 'In fact I do not know',
  685. 'Outlook does not provide \'-\'',
  686. 'I think not',
  687. 'Very good',
  688. 'It was determined that yes.'
  689. );
  690. $resposta = $respostas[ array_rand( $respostas ) ];
  691. $mensagens = array( );
  692. foreach ( $mensagens as $k => $valor ) {
  693. $valor2 = strtoupper( $valor );
  694. array_push( $mensagens, $valor2 );
  695. } //$mensagens as $k => $valor
  696. $this->enviarMSG( ' [' . $usuario . ']' . $resposta, "MSG", $packet[ 'u' ] );
  697. break;
  698.  
  699. case 'love':
  700. // !lovetest [alguma coisa] [alguma coisa2]
  701. $gerar = rand( 0, 100 );
  702. $this->enviarMSG( $mensagem[ 1 ] . ' + ' . $mensagem[ 2 ] . ' = ' . $gerar . '%' );
  703. break;
  704.  
  705. /* Comandos para admin */
  706. case "reiniciar":
  707. // !reiniciar
  708. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  709. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  710. } //!in_Array( $packet[ "u" ], $this->admins )
  711. $this->enviarMSG( "Vou ali da uma cagada e ja volto!!(bye)" );
  712. $this->reiniciar();
  713. break;
  714.  
  715.  
  716. case'userinfo':
  717. $message = explode(' ', $mensagem[1], 1);
  718. $user = $message[0];
  719.  
  720. if(!$this->users[$user]['id']){ $this->enviarMSG('I Do not NOOB.');}
  721. else{
  722. if($this->users[$user]['rel'] == 2) $this->users[$user]['rel'] = "Married";
  723. if($this->users[$user]['rel'] == 1) $this->users[$user]['rel'] = "BFF";
  724. $myNick = explode("##", $this->users[$user]['name'], 2);
  725. $myNick[0] = htmlspecialchars(html_entity_decode(htmlspecialchars_decode($myNick[0])));
  726. $relation = $this->users[$user]['rel'].' to '.$this->users[$user]['d2'];
  727. if($relation == 'Married to 0') $relation = 'Relation not found.';
  728. $name = explode('##', $this->users[$user]['name']);
  729. $n = $name[1];
  730. $this->enviarMSG('Name : '.$myNick[0].' | Status : '.str_replace('#',' | ',$n).'| Avatar : '.$this->users[$user]['avatar'].' | Home : '.$this->users[$user]['home'].' | Relation : '.$relation);
  731. }
  732. break;
  733.  
  734. case "apagar":
  735. case "die":
  736. // !die
  737. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  738. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  739. } //!in_Array( $packet[ "u" ], $this->admins )
  740. $this->enviarMSG( "[Server]: Thankyou For Using Me On Your Chat (bye)" );
  741. die( );
  742. break;
  743.  
  744. case 'automember':
  745. // !automember [on/off]
  746. if ( !in_array( $packet[ 'u' ], $this->admins ) )
  747. {
  748. return $this->enviarMSG( 'you cant do that without permission man (hehe)', 'PM', $packet[ 'u' ] );
  749. } //!in_array( $packet[ 'u' ], $this->admins )
  750. switch ( $mensagem[ 1 ] )
  751. {
  752. case 'on':
  753. $this->automember = True;
  754. $this->enviarMSG( 'Auto member is now on!' );
  755. break;
  756.  
  757. case 'off':
  758. $this->automember = False;
  759. $this->enviarMSG( 'Auto member off!' );
  760. break;
  761.  
  762. default:
  763. $this->enviarMSG( 'automember [on / off].' );
  764. } //$mensagem[ 1 ]
  765. break;
  766. case 'autoguest':
  767. // !automember [on/off]
  768. if ( !in_array( $packet[ 'u' ], $this->admins ) )
  769. {
  770. return $this->enviarMSG( 'You do not have to use this command!', 'PM', $packet[ 'u' ] );
  771. } //!in_array( $packet[ 'u' ], $this->admins )
  772. switch ( $mensagem[ 1 ] )
  773. {
  774. case 'on':
  775. $this->autoguest = True;
  776. $this->enviarMSG( 'Autoguest ON' );
  777. break;
  778.  
  779. case 'off':
  780. $this->autoguest = False;
  781. $this->enviarMSG( 'autoguest OFF!' );
  782. break;
  783.  
  784. default:
  785. $this->enviarMSG( 'You should choose an option [on / off].' );
  786. } //$mensagem[ 1 ]
  787. break;
  788.  
  789. case 'edit':
  790. // !edit name , status , glow , hat ,avatar
  791. if ( !in_array( $packet[ 'u' ], $this->admins ) )
  792. {
  793. return $this->enviarMSG( 'You do not have permission to use this command!', 'PM', $packet[ 'u' ] );
  794. } //!in_array( $packet[ 'u' ], $this->admins )
  795. switch ( $mensagem[ 1 ] )
  796. {
  797. case'name':
  798. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  799. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  800. } //!in_Array( $packet[ "u" ], $this->admins )
  801. $this->nome = $mensagem[ 2 ];
  802. $this->entrar();
  803. $this->enviarMSG('Ahora me cambiare el nombre esperenme : '.$this->nome);
  804.  
  805. break;
  806.  
  807. case'status':
  808. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  809. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  810. } //!in_Array( $packet[ "u" ], $this->admins )
  811. $this->status = htmlentities($mensagem[2]);
  812. $this->entrar();
  813. $this->enviarMSG('Updated my status : '.$this->status );
  814. break;
  815.  
  816. case'glow':
  817. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  818. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  819. } //!in_Array( $packet[ "u" ], $this->admins )
  820. $mensagem = explode( ' ou ', strtolower( $msg ) );
  821. if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
  822. $this->glow = $mensagem[0];
  823. $this->entrar();
  824. $this->enviarMSG('My GlowColor has been changed to [ #'.$this->glow.' ]');
  825. break;
  826.  
  827. case'hat':
  828. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  829. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  830. } //!in_Array( $packet[ "u" ], $this->admins )
  831. $mensagem = explode( ' ou ', strtolower( $msg ) );
  832. if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
  833. $this->hat = $mensagem[0];
  834. $this->entrar();
  835. $this->enviarMSG('My hat was changed to Success : ' );
  836. break;
  837.  
  838. case'home':
  839. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  840. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  841. } //!in_Array( $packet[ "u" ], $this->admins )
  842. $mensagem = explode( ' ou ', strtolower( $msg ) );
  843. if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
  844. $this->home = $mensagem[0];
  845. $this->entrar();
  846. $this->enviarMSG('My little house has been changed : ' );
  847. break;
  848.  
  849. case'welcome':
  850. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  851. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  852. } //!in_Array( $packet[ "u" ], $this->admins )
  853. $mensagem = explode( ' ou ', strtolower( $msg ) );
  854. if ( !isset( $mensagem[ 1 ] ) || empty( $mensagem[ 1 ] ) || count( array_keys( $mensagem ) ) == 1 )
  855. $this->autoWelcome = $mensagem[0];
  856. $this->entrar();
  857. $this->enviarMSG('My Welcome message has changed for : '.$this->autoWelcome );
  858. break;
  859.  
  860.  
  861. default:
  862. $this->enviarMSG( 'You should choose an option : !edit [name , status , glow , hat ,avatar].' );
  863. } //$mensagem[ 1 ]
  864. break;
  865.  
  866. /* Command Admin Para Bot Created Juninho & Sloom! */
  867. case "staff":
  868. // !staff
  869. $this->enviarMSG( " 1 , 10 ", "PM", $packet[ "u" ] );
  870. break;
  871.  
  872. case'avatar':
  873. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  874. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  875. } //!in_Array( $packet[ "u" ], $this->admins )
  876. $this->avatar = $mensagem[1];
  877. $this->avatar = str_replace(' (', '(', $this->avatar);
  878. $this->avatar = str_replace(') ', ')', $this->avatar);
  879. $this->avatar = str_replace(' ', ' ', $this->avatar);
  880. $this->entrar();
  881. $this->entrar();
  882. $this->enviarMSG('My avatar has been changed : '.$this->avatar );
  883. break;
  884. case'last':
  885. $pow2 = file_get_contents('http://xat.com/web_gear/chat/pow2.php?Milk=1234');
  886. $pow2 = json_decode($pow2, true);
  887. $powername = array_search($pow2['0']['1']['id'], $pow2['5']['1']);
  888. $status = ($pow2[0][1]['text'] == '[LIMITED]') ? 'LIMITED':'UNLIMITED';
  889. $smilie = array_merge(array($powername), array_keys($pow2['3']['1'], $pow2['0']['1']['id'])); //get all smilies of the new power
  890. $smilies = array();
  891. $pawns = array();
  892. foreach($smilie as $v)
  893. array_push($smilies, $v);
  894. foreach($pow2[6][1] as $name => $value)
  895. if($name != 'time' && $value[0] == $pow2['0']['1']['id'])
  896. array_push($pawns, 'h'.$name);
  897. $smilielist = implode(", ", $smilies);
  898. $pawnlist = implode(", ", $pawns);
  899. $this->enviarMSG(ucfirst($powername).' | ID : '.$pow2['0']['1']['id'].' | Status : '.$status.' | Smilies: '.ucfirst($smilielist).' | Hats : '.$pawnlist);
  900. break;
  901. case 'calc':
  902. /* Command created by iZerang */
  903. // !calc [numero] [/ * * -] [numero 2]
  904. if ( is_numeric( $mensagem[1] ) && is_numeric( $mensagem[3] ) ) {
  905. switch ( $mensagem[2] ) {
  906.  
  907. case "*":
  908. $x = $mensagem[1] * $mensagem[3];
  909. $this->enviarMSG("{$mensagem[1]} x {$mensagem[3]} = {$x}");
  910. break;
  911.  
  912. case "/":
  913. $x = $mensagem[1] / $mensagem[3];
  914. $this->enviarMSG("{$mensagem[1]} / {$mensagem[3]} = {$x}");
  915. break;
  916.  
  917. case "+":
  918. $x = $mensagem[1] + $mensagem[3];
  919. $this->enviarMSG("{$mensagem[1]} + {$mensagem[3]} = {$x}");
  920. break;
  921.  
  922. case "-":
  923. $x = $mensagem[1] - $mensagem[3];
  924. $this->enviarMSG("{$mensagem[1]} - {$mensagem[3]} = {$x}");
  925. break;
  926. }
  927. //$mensagem[2]
  928. } //is_numeric( $mensagem[1] ) && is_numeric( $mensagem[3] )
  929. else {
  930. $this->enviarMSG( 'Debe introducir una cuenta valida por Ej. !calc 1 + 1 :)' , "MSG", $packet[ "u" ] );
  931. }
  932. break;
  933.  
  934. case 'price':
  935. /* Command created by iZerang */
  936. $x1 = strtr(substr($mensagem[1], 0, 1), "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  937. $x2 = strtr(substr($mensagem[1], 1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz");
  938. $msg = $x1.$x2;
  939. if(empty($msg)){$this->enviarMSG('The power of the name can not be empty.'); return;}
  940. $url = @file_get_contents('http://xatalert.com/fairtrade/');
  941. file_put_contents($core->lib . "prices.txt", $pricelist);
  942. if(empty($msg)){$this->enviarMSG('Failed to get price notify an administrator!'); return;}
  943. $parte1 = explode($msg.'</abbr></td><td></td><td>(', $url);
  944. $final = explode(')</td><td>',$parte1[1]);
  945. if(!$final[0]){
  946. $parte1 = explode($msg.'</abbr></td><td><img src="http://xat.com/images/apicon.png" border="0"></td><td>(', $url);
  947. $final = explode(')</td><td>',$parte1[1]);
  948. }
  949. $parte2 = explode($msg.'</abbr></td><td></td><td>('.$final[0].')</td><td>', $url);
  950. $final2 = explode('</td><td>',$parte2[1]);
  951. if(!$final2[0]){
  952. $parte2 = explode($msg.'</abbr></td><td><img src="http://xat.com/images/apicon.png" border="0"></td><td>('.$final[0].')</td><td>', $url);
  953. $final2 = explode('</td><td>',$parte2[1]);
  954. }
  955. $parte3 = explode($msg.'</abbr></td><td><img src="http://xat.com/images/apicon.png" border="0"></td><td>('.$final[0].')</td><td>'.$final2[0].'</td><td>', $url);
  956. $final3 = explode('</td><td>',$parte3[1]);
  957. if(!$final3[0]){
  958. $parte3 = explode($msg.'</abbr></td><td></td><td>('.$final[0].')</td><td>'.$final2[0].'</td><td>', $url);
  959. $final3 = explode('</td><td>',$parte3[1]);
  960. }
  961. if(!$final[0]){$this->enviarMSG('El Power no existente.');}else
  962. $this->enviarMSG('The power in the '.$msg.' store costs: '.$final[0].', trade: '.$final2[0].', in days: '.$final3[0].'.');
  963. break;
  964.  
  965. case 'dx':
  966. $days = intval($message[1]);
  967. if($days < 1)
  968. return $this->sendPM($packet['u'], 'days must be 1 or more');
  969.  
  970. $tradeValue = 13;
  971. $xats = floor($days * $tradeValue);
  972. $this->enviarMSG($days.' days equals '.$xats.' xats');
  973. break;
  974.  
  975. case 'clear':
  976. If ( !in_Array( $packet[ "u" ], $this->admins ) ) {
  977. return $this->enviarMSG( $this->semacesso, "PM", $packet[ "u" ] );
  978. } //!in_Array( $packet[ "u" ], $this->admins )
  979. return $this->enviarMSG('Sorry, but you are not allowed to do so!');;
  980. $this->clear = $mensagem[1];
  981. $this->clearMsg(true,25);
  982. $this->socket->connect();
  983. $this->network->join();
  984. break;
  985.  
  986.  
  987.  
  988. } //substr( $mensagem[ 0 ], 1 )
  989. } //$tipo
  990. }
  991.  
  992. /* Reiniciar o servidor */
  993. public function reiniciar( )
  994. {
  995. $this->conectar();
  996. $this->entrar();
  997. }
  998. public function fetchUser($id) {
  999. $id = $this->parseU($id);
  1000. if(isset($this->users[$id]))
  1001. return $this->users[$id];
  1002. else
  1003. return false;
  1004. }
  1005. function kick($message, $id, $log=true) {
  1006. if($log) {
  1007. if(!empty($this->users[$id]['kicks']) ) $this->users[$id]['kicks']++;
  1008. else $this->users[$id]['kicks'] = 1;
  1009. }
  1010. if($this->users[$id]['kicks'] > $this->maxKicks) {
  1011. $this->ban($message,$id,3600);
  1012. $this->users[$id]['kicks'] = 0;
  1013. return;
  1014. }
  1015. $this->enviar('<c p="'.$message." ".$this->users[$id]['kicks'].'/'.$this->maxKicks.'" u="'.$id.'" t="/g" />');
  1016. }
  1017. function ban($message, $id, $time) {
  1018. $this->enviar('<c p="'.ereg_replace('[^A-Za-z0-9.! ]','',$message).'" u="'.$id.'" t="/g'.$time.'" />');
  1019. }
  1020. public function sendPM($id=0, $packet='') {
  1021. $id = $this->parseU($id);
  1022. $this->enviar('<p u="'.$id.'" t="'.$packet.'" d="'.$id.'" />');
  1023. }
  1024.  
  1025. public function parseU($id) {
  1026. if(strpos($id, "_") > -1)
  1027. $e = explode("_", $id);
  1028. $u = (strpos($id, "_") > -1) ? $e[0] : $id;
  1029. return $u;
  1030. }
  1031.  
  1032. function member($id,$time=null) {
  1033. if(!$time) $time = 0;
  1034. $id = $this->parseU($id);
  1035. $this->sendC($id, '/e',$time);
  1036. }
  1037. function guest($id,$time=null) {
  1038. if(!$time) $time = 0;
  1039. $id = $this->parseU($id);
  1040. $this->sendC($id, '/r',$time);
  1041. }
  1042.  
  1043. public function sendC($id=0, $com='') {//Shit always comes in handy after awhile.
  1044. $this->enviar('<c u="'.$id.'" t="'.$com.'" />');
  1045. }
  1046. public function censor($message) {
  1047. $badwords = $this->censor;
  1048. $message = @preg_replace('#\((.+)\)#U','',strtolower(' '.$message.' '));
  1049. foreach($badwords as $bad) {
  1050. $bad = trim($bad);
  1051. if(strpos($message.' ', $bad.' ')!==false) {
  1052. if(strlen($bad)>=2) {
  1053. return true;
  1054. }
  1055. }
  1056.  
  1057. }
  1058.  
  1059. }
  1060. /* Enviar MSG, definido com tipo e ID */
  1061. function enviarMSG( $mensagem, $tipo = "MSG", $id = 0 )
  1062. {
  1063. If ( !$mensagem ) {
  1064. return False;
  1065. } //!$mensagem
  1066. switch ( $tipo ) {
  1067. case "MSG": // Sample
  1068. $this->enviar( "<m t=\"{$mensagem}\" u=\"{$this->botID}\" />" );
  1069. break;
  1070.  
  1071. case "PM": // PM
  1072. $this->enviar( "<p u=\"{$id}\" t=\"{$mensagem}\" d=\"{$id}\" />" );
  1073. break;
  1074.  
  1075. case "PC": // Privado
  1076. $this->enviar( "<z d=\"{$id}\" u=\"{$this->botID}\" t=\"{$mensagem}\" />" );
  1077. break;
  1078. } //$tipo
  1079. }
  1080.  
  1081. }
  1082.  
  1083. $bot = new zBot(); // Estanciar a class
  1084.  
  1085. while ( 1 ) {
  1086. try {
  1087. If ( $bot->carregar() == "DESLIGADO" ) {
  1088. $bot->desconectar();
  1089. $bot->entrar();
  1090. } //$bot->carregar() == "DESLIGADO"
  1091. }
  1092. catch ( Exception $e ) {
  1093. die( $e );
  1094. }
  1095. } //1
  1096.  
  1097. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement