Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- set_time_limit(0);
- date_default_timezone_set("Australia/Melbourne");
- libxml_use_internal_errors(true);
- ini_set('display_errors', 'on');
- error_reporting(E_ALL);
- do {
- $server = new MSERVER();
- unset($server);
- } while (true);
- class MSERVER {
- private $info = array();
- public $socket = array(null, null);
- public $users = array();
- public $ipbans = array();
- public $protected = array();
- public $rfilter = array();
- public $debug = false;
- public $hasGroupPowers = array("Lobby", "Help","DeviazMu");
- public function __construct() {
- //require __DIR__ . "/../_class/config.php";
- $config = (object) array( 'db' => array( 0 => 'localhost', 1 => 'root', 2 => '', 3 => 'ixat' ) ); //Configuracao
- $this->mysql = new Database($config->db[0], $config->db[1], $config->db[2], $config->db[3]);
- $this->resetConfig();
- $this->bind();
- while (true) {
- $this->bind();
- while ($this->socket[0]) {
- $this->listen();
- }
- array_map('socket_close', $this->socket);
- }
- }
- public function resetConfig() {
- $this->config = $this->mysql->fetch_array("select * from `server` limit 0, 1;");
- $this->config = (object) $this->config[0];
- $this->config->spam_wait = 800;
- $this->config->staff = (array) json_decode($this->config->staff);
- $this->config->pawns = (array) json_decode($this->config->pawns);
- $this->config->pcount = $this->mysql->fetch_array('select count(distinct `section`) as `count` from `powers`;');
- $this->config->pcount = $this->config->pcount[0]['count'];
- $this->hash = $this->mysql->rand(25); /* For API Laterz */
- $this->ipbans = $this->mysql->fetch_array("select `ipbans` from `server`;");
- $this->ipbans = (array) json_decode($this->ipbans[0]['ipbans']);
- $this->mysql->query("update `server` set `pid`='" . getmypid() . "';");
- }
- public function bind() {
- try {
- global $argv;
- $this->socket = array(
- socket_create(AF_INET, SOCK_STREAM, SOL_TCP),
- socket_create_listen(0)
- );
- socket_getsockname(end($this->socket), $ip, $port);
- $this->mysql->query("update `server` set `ipc`={$port};");
- socket_set_option($this->socket[0], SOL_SOCKET, SO_REUSEADDR, true);
- if (!isset($argv[1]) || $argv[1] != 'debug') {
- socket_bind($this->socket[0], $this->config->server_ip, $this->config->server_pt) or exit('line:' . __LINE__);
- } else {
- $this->debug = true;
- print 'binding on debug port' . chr(10);
- socket_bind($this->socket[0], $this->config->server_ip, $this->config->backup_pt) or exit('line:' . __LINE__);
- }
- socket_listen($this->socket[0]);
- socket_set_block($this->socket[0]);
- } catch (Exception $e) {
- print $e->getMessage();
- exit('line:' . __LINE__);
- }
- }
- public function listen($null = null, $ipc = 0) {
- /* Create Read Array */
- $read = $this->socket;
- foreach ($this->users as $user) {
- $read[] = $user->sock;
- }
- $except = $read;
- /* Accept / Filter New Connections */
- if (@socket_select($read, $null, $except, null) < 1) {
- continue;
- }
- foreach ($this->socket as $i => $psock) {
- if (in_array($psock, $read)) {
- switch ((int) $i) {
- case 0:
- $socket = socket_accept($psock);
- socket_set_nonblock($socket);
- if (!is_resource($socket) || count($this->users) >= $this->config->max_total) {
- @socket_close($socket);
- break;
- }
- socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 3, 'usec' => 0));
- @socket_getpeername($socket, $ip);
- foreach ($this->users as $user) {
- if ($user->ipaddr == $ip) {
- $ipc++;
- }
- }
- if ($ipc > $this->config->max_per_ip || in_array($ip, $this->ipbans)) {
- foreach ($this->users as $user) {
- if ($user->ipaddr == $ip) {
- $this->disconnect($user->index);
- }
- }
- break;
- }
- do {
- $index = $this->mysql->rand();
- } while (isset($this->users[$index]));
- $this->users[$index] = new client($socket, $this, $index, $ip);
- break;
- case 1:
- $this->socket[] = socket_accept($psock);
- break;
- default: /* For API if I feel like making it later */
- $data = trim(socket_read($psock, 1205));
- if (strlen($data) <= 1) {
- socket_close($psock);
- unset($this->socket[$i]);
- break;
- }
- $packet = simplexml_load_string($data);
- $data = $this->GetMultiAttr($packet);
- if (!method_exists($packet, 'getName')) {
- break;
- }
- switch ($packet->getName()) {
- case 'usercount':
- socket_write($psock, count($this->users));
- break;
- case 'globalMessage':
- foreach ($this->users as $i => $user) {
- if ($user->online == true) {
- $user->sendPacket('<fuckoff/>');
- }
- }
- break;
- }
- break;
- }
- }
- }
- /* Read From Waiting Sockets, kill exceptions */
- if (!is_array($except)) {
- $except = array(); /* To avoid a possibility of an error below */
- }
- foreach ($this->users as $index => $user) {
- if (in_array($user->sock, $except) || !$user->sock) {
- unset($this->users[$index]);
- } elseif (in_array($user->sock, $read)) {
- $input = @socket_read($user->sock, 1205);
- if (trim($input) == '' || ord(substr($input, 0, 1)) == 136) {
- unset($this->users[$index]);
- continue;
- } elseif (substr_count($input, chr(0)) <= 1) {
- $this->handle($input, $user);
- }
- }
- }
- }
- private function handle($packet, &$user) {
- $packet = str_replace('', '', $packet); //RIP Chrome
- try {
- if ($this->debug) {
- var_dump($packet);
- }
- if ($user->mobile == false && substr($packet, 0, 1) !== '<') {
- $user->mobile = true;
- }
- if (substr($packet, 0, 2) == '<x') {
- $user->sendRoom($packet);
- }
- if ($user->mobile == true) {
- if ($user->mobready == false) {
- $user->buffer .= $packet;
- if (strlen($user->buffer) >= 2048) {
- throw new Exception();
- }
- if (is_numeric(strpos($user->buffer, "\r\n\r\n"))) {
- $headers = array();
- $lines = explode("\r\n", $user->buffer);
- foreach ($lines as $line) {
- $line = explode(': ', $line, 2);
- if (count($line) < 2)
- continue;
- $headers[strtolower($line[0])] = $line[1];
- }
- if (!isset($headers['sec-websocket-key'])) {
- throw new Exception();
- }
- $secAccept = base64_encode(pack('H*', sha1($headers['sec-websocket-key'] . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11')));
- $response = array();
- array_push($response, "HTTP/1.1 101 Pulse");
- array_push($response, "Upgrade: websocket");
- array_push($response, "Connection: Upgrade");
- array_push($response, "Sec-WebSocket-Accept: " . $secAccept);
- @socket_write($user->sock, implode("\r\n", $response) . "\r\n\r\n");
- $user->mobready = true;
- }
- return;
- } else {
- $packet = $this->unmask($packet);
- if ($packet == false) {
- throw new Exception(1);
- }
- }
- }
- if (strpos($packet, '<', 1) !== false) {
- throw new Exception(2);
- }
- $packet2 = $packet;
- $packet = simplexml_load_string(trim($packet));
- if (!method_exists($packet, 'getName')) {
- libxml_clear_errors(true);
- throw new Exception(3);
- }
- $tag = strtolower($packet->getName());
- $lPackets = array('policy-file-request', 'ls2', 'y', 'login');
- if (strlen($tag) > 25 || $tag == '') {
- throw new Exception(4);
- }
- if (!isset($user->loginKey) || $user->loginKey == null) {
- if (!in_array($tag, $lPackets)) {
- throw new Exception(5);
- }
- } elseif ($user->authenticated == null && $tag != 'ls2') {
- throw new Exception(6);
- } elseif (isset($user->id) && in_array($user->id, array(0, 2))) {
- throw new Exception(7);
- } elseif ($user->hidden == true && $user->online) {
- $user->hidden = false;
- $user->joinRoom($user->chat, false, true, $user->pool);
- };
- } catch (Exception $e) {
- //print $e->getMessage() . "\n";
- return $this->disconnect($user->index);
- }
- if (!$user->authenticated && !in_array($tag, $lPackets)) {
- return $this->disconnect($user->index, true);
- }
- switch ($tag) {
- //For bots
- case 'login':
- //$key = $this->getAttribute($packet, 'key');//lol later
- $user2 = $this->getAttribute($packet, 'user');
- $password = $this->getAttribute($packet, 'pass');
- $userLogin = $this->mysql->fetch_array('select * from `users` where `username`=\'' . $this->mysql->sanatize($user2) . '\';');
- if (!$this->mysql->validate($password, $userLogin[0]['password']) || empty($userLogin)) {
- $user->sendPacket('<login t="Bad Username/Password." e="1" />');
- } else {
- $loginKey = md5(json_encode(array(time(), $userLogin[0]['username'], $userLogin[0]['password'])));
- $this->mysql->query('update `users` set `loginKey`=\'' . $loginKey . '\' where `username`=\'' . $this->mysql->sanatize($userLogin[0]['username']) . '\';');
- if ((floor(($userLogin[0]['days'] - time()) / (24 * 3600) + 0.3) >= 1 ? floor(($userLogin[0]['days'] - time()) / (24 * 3600) + 0.3) : 0) >= 1)
- {
- $upowers = $this->mysql->fetch_array("select * from `userpowers` where `userid`={$userLogin[0]['id']};");
- $spowers = $this->mysql->fetch_array("select * from `powers` where `name` not like '%(Undefined)%';");
- list($vals, $p, $dO, $powerO, $pp) = array(array(), array(), '', '', '');
- foreach ($spowers as $i => $u)
- {
- $vals[$u["id"]] = array($u["section"], $u["subid"]);
- if (!isset($p[$u["section"]]))
- {
- $p[$u["section"]] = 0;
- }
- }
- foreach ($upowers as $i => $u)
- {
- if ($u["count"] >= 1 && isset($vals[$u["powerid"]]) && isset($p[$vals[$u["powerid"]][0]]))
- {
- $str = $u['powerid'] . '=' . ($u['count'] > 1 ? ($u['count'] - 1) : 1) . '|';
- $dO .= $str;
- if ($u['count'] > 1)
- {
- $powerO .= $str;
- }
- $p[$vals[$u["powerid"]][0]] += $vals[$u["powerid"]][1];
- }
- }
- }
- $nickname = explode('##', $userLogin[0]['nickname'], 2);
- if (count($nickname) != 2) {
- $nickname[1] = "";
- }
- $vars = "";
- $vars .= 'userno="' . $userLogin[0]["id"] . '" ';
- $vars .= 'avatar="' . $userLogin[0]["avatar"] . '" ';
- $vars .= 'k1="' . $userLogin[0]["k"] . '" ';
- $vars .= 'd0="' . $userLogin[0]["d0"] . '" ';
- $vars .= 'd1="' . $userLogin[0]["days"] . '" ';
- $vars .= 'd2="' . $userLogin[0]["d2"] . '" ';
- $vars .= 'd3="" ';
- foreach ($p as $i => $u)
- $vars .= 'd' . (substr($i, 1) + 4) . '="' . $u . '" ';
- $vars .= 'dt=0" ';
- $vars .= 'homepage="' . $userLogin[0]["url"] . '" ';
- $vars .= 'Powers="' . implode(",", $p) . '" ';
- $vars .= 'PowerO="' . $powerO . '" ';
- $vars .= 'status="' . $nickname[1] . '" ';
- $vars .= 'dO="'.$dO.'" ';
- $vars .= 'dx="' . $userLogin[0]["xats"] . '" ';
- $vars .= 'registered="' . $userLogin[0]["username"] . '" ';
- $vars .= 'k2="' . $userLogin[0]["k2"] . '" ';
- $vars .= 'k3="' . $userLogin[0]["k3"] . '" ';
- $vars .= 'name="' . $nickname[0] . '" ';
- $vars .= 'loginKey="' . $loginKey . '"';
- $user->sendPacket('<v ' . $vars . ' e="0" />');
- }
- break;
- case substr($tag, 0, 1) == 'w': /* Pools, leave it here nigga, maybe later just use joinRoom() for faster change :] */
- $pool = substr($tag, 1, 2);
- $user->sendRoom("<l u=\"{$user->id}\" />");
- $user->switchingPools = true;
- $user->joinRoom($user->chat, true, true, $pool);
- break;
- case 'f':
- $users = $this->getAttribute($packet, 'o');
- if ($users === false || $this->spamfilter($tag, $user, 200)) {
- $this->disconnect($user->index);
- } else {
- $friends = (array) explode(' ', $users);
- $online = array();
- foreach ($this->users as $i => $_user) {
- if ($_user->id != $user->id && in_array($_user->id, $friends) && $_user->hidden === false && !in_array($_user->id, $online)) {
- array_push($online, $_user->id);
- }
- }
- $user->sendPacket('<f v="' . implode(',', $online) . '" />');
- }
- break;
- case 'policy-file-request':
- if (isset($user->policy)) {
- return $this->ipban($user->ipaddr);
- }
- $user->sendPacket('<cross-domain-policy><allow-access-from domain="*" to-ports="*" /></cross-domain-policy>');
- $user->policy = 1;
- break;
- case 'y':
- if (isset($user->loginKey) && $user->loginKey != null) {
- return $this->ipban($user->ipaddr);
- }
- $user->loginKey = rand(10000000, 99999999);
- $user->loginShift = rand(2, 5);
- $user->loginTime = time();
- $user->sendPacket('<y yi="' . $user->loginKey . '" yc="' . $user->loginTime . '" ys="' . $user->loginShift . '" />');
- break;
- case 'ls2':
- if ($user->authenticated == true) {
- $user->sendPacket('<logout />');
- return $this->disconnect($user->index);
- }
- if ($user->authenticate($packet) == false) {
- $user->sendPacket('<n t="Voce deve registrar/fazer login!." />');
- $user->sendPacket('<logout />');
- $this->disconnect($user->index);
- }
- break;
- case 'l':
- $this->disconnect($user->index);
- break;
- case 'm':
- if ($user->banned > time()) {
- return false;
- }
- if (isset($this->protected[$user->chat])) {
- if ($this->protected[$user->chat]['end'] < time()) {
- unset($this->protected[$user->chat]);
- $user->sendRoom("<m t=\"A protecao do chat foi desativa
- pois ja se passarao 60 minutos.\" u=\"0\" />");
- } elseif ($this->protected[$user->chat]['type'] == 'noguest') {
- if ($user->rank == 5 || $user->rank == 40) {
- return false;
- }
- } elseif ($this->protected[$user->chat]['type'] == 'unreg') {
- if ($user->guest == true && in_array($user->rank, array(5, 40))) {
- return false;
- }
- }
- }
- if (in_array($user->rank, array(5, 40)) && $user->guest == true) {
- if (!isset($this->rfilter[$user->chat])) {
- $this->rfilter[$user->chat] = array();
- }
- $ctime = time() - 5;
- $count = 1;
- foreach ($this->rfilter[$user->chat] as $i => $time) {
- if ($ctime > $time) {
- unset($this->rfilter[$user->chat][$i]);
- continue;
- }
- $count++;
- }
- array_push($this->rfilter[$user->chat], time());
- if ($count >= 12) {
- $this->protected[$user->chat] = array('end' => time() + 3600, 'type' => 'unreg');
- $user->sendRoom("<m u=\"0\" t=\"Protecao do chat foi ativada!(Raid Detected)\" />");
- foreach ($this->users as $i => $u) {
- if ($u->chat == $user->chat && in_array($u->rank, array(5, 40)) && $u->guest == true) {
- $u->sendPacket('<n t="Protection ativada, chutando null users." />');
- $this->disconnect($u->index);
- }
- }
- unset($this->rfilter[$user->chat]);
- }
- }
- $message = $this->getAttribute($packet, 't');
- if (empty($message)) {
- return false;
- } elseif (substr($message, 0, 1) == '!') { // COMANDO <-- That's there so I can ctrl+f to here quickly <:
- $owner = in_array($user->id, $this->config->staff) ? true : false;
- $args = explode(' ', substr($message, 1));
- switch (strtolower($args[0])) {
- case 'resetconfig':
- if ($owner) {
- $this->resetConfig();
- $user->sendPacket('<m u="0" t="Configuration has been reloaded" />');
- }
- break;
- case 'setrank':
- if (!$owner) {
- break;
- }
- switch ($s) {
- case "mod":
- case "moderator":
- $return = 2;
- break;
- case "guest":
- $return = 5;
- break;
- case "member":
- $return = 3;
- break;
- case "owner":
- $return = 4;
- break;
- }
- $this->mysql->query('delete from `ranks` where `chatid`=' . $user->chat . ' and `userid`=' . $user->id . ';');
- $this->mysql->query('insert into `ranks`(`userid`, `chatid`, `f`) values(' . $user->id . ', ' . $user->chat . ', ' . $return . ');');
- $this->disconnect($user->index);
- break;
- case 'setxats':
- if (count($args) != 3 || !$owner) {
- break;
- }
- $uRow = $this->mysql->fetch_array('select `id`, `username`, `password` from `users` where `username`=\'' . $this->mysql->sanatize($args[1]) . '\';');
- if (count($uRow) == 1 && is_numeric($args[2])) {
- $this->mysql->query('update `users` set `xats`=' . $args[2] . ' where `username`=\'' . $this->mysql->sanatize($args[1]) . '\';');
- $_user = $this->getuserbyid($uRow[0]['id'], $user->chat);
- if ($_user != false) {
- $_user->sendPacket($this->doLogin($uRow[0]['username'], $uRow[0]['password']));
- }
- }
- break;
- case 'setdays':
- if (count($args) != 3 || !$owner) { break; }
- $uRow = $this->mysql->fetch_array('select `id`, `username`, `password` from `users` where `username`=\'' . $this->mysql->sanatize($args[1]) . '\';');
- if (count($uRow) == 1 && is_numeric($args[2]))
- {
- $this->mysql->query('update `users` set `days`=' . strtotime("+ " . $args[2] . " days") . ' where `username`=\'' . $this->mysql->sanatize($args[1]) . '\';');
- $_user = $this->getuserbyid($uRow[0]['id'], $user->chat);
- if ($_user != false)
- {
- $_user->sendPacket($this->doLogin($uRow[0]['username'], $uRow[0]['password']));
- }
- }
- break;
- case "clear":
- if($rank > 3) {$user->sendPacket('<n t="You don\'t have a high enough rank!" />'); break;}
- $this->mysql->query("delete from `messages` where `id` = '{$user->chat}';");
- $this->disconnect($user->index);
- $user->sendRoom("<l u=\"{$u->id}\" />");
- break;
- case 'roulette':
- $num = floor(36 * (rand(0, 36) * rand(0, 36)));
- $user->sendAll("<n t=\"$num IS Your Number!\" />");
- return;
- case 'release':
- if (!$owner) {
- break;
- }
- $power = $args[1];
- $amount = $args[2];
- $this->mysql->query("UPDATE `powers` SET `amount`='" . $amount . "' WHERE `name`='" . $power . "'");
- $Mais = $amount == 1 ? "" : "s";
- $user->sendAll("<n t=\"{$amount} {$power}{$Mais} Foi Liberado!\" />");
- return;
- break;
- case 'unrelease':
- if (!$owner) {
- break;
- }
- $power = $args[1];
- $amount = $args[2];
- $this->mysql->query("UPDATE `powers` SET `amount`='" . $amount . "' WHERE `name`='" . $power . "'");
- $Mais = $amount == 0 ? "" : "s";
- $user->sendAll("<n t=\"{$amount} {$power}{$Mais} foi travado!\" />");
- return;
- break;
- case "zua":
- if (!$owner) {
- break;
- }
- $args = explode(' ', substr($message, 1), 2);
- $args2 = explode(' ', substr($message, 2), 2);
- $sum = "<m t=\"{$args[1]}\" u=\"{$args2[2]}\" />";
- $user->sendAll($sum);
- return;
- break;
- case "global":
- if (!$owner) {
- break;
- }
- $args = explode(' ', substr($message, 1), 2);
- $sum = "<n t=\"{$args[1]}\" />";
- $user->sendAll($sum);
- return;
- break;
- case 'relog':
- if (count($args) == 2 && $owner) {
- $_user = $this->mysql->fetch_array('select * from `users` where `username`=\'' . $this->mysql->sanatize($args[1]) . '\';');
- if (empty($_user)) {
- break;
- }
- $online = $this->getuserbyid($_user[0]['id']);
- if (is_object($online)) {
- $online->sendPacket($this->doLogin($_user[0]['username'], $_user[0]['password']));
- }
- return;
- }
- break;
- case 'limited':
- if (!$owner) {
- break;
- }
- $power = $args[1];
- $this->mysql->query("UPDATE `powers` SET `limited`='1' WHERE `name`='" . $power . "'");
- $user->sendRoom('<n t="0" t="o power [' . $power . '] agora e limitado!" i="0" />');
- break;
- case 'unlimited':
- if (!$owner) {
- break;
- }
- $power = $args[1];
- $this->mysql->query("UPDATE `powers` SET `limited`='0' WHERE `name`='" . $power . "'");
- $user->sendRoom('<n t="0" t="o power [' . $power . '] agora nao e mais limitado!" i="0" />');
- break;
- case 'every':
- case 'nopowers':
- if (count($args) != 2 || !$owner) {
- break;
- }
- $uRow = $this->mysql->fetch_array('select * from `users` where `username`=\'' . $this->mysql->sanatize($args[1]) . '\';');
- if (count($uRow) == 1) {
- $this->mysql->query('delete from `userpowers` where `userid`=' . $uRow[0]['id'] . ';');
- if (strtolower($args[0]) == 'every') {
- $powers = $this->mysql->fetch_array('select `id`, `name` from `powers` where `name` not like \'%(Undefined)%\' and `subid`<2147483647;');
- $inputs = '';
- foreach ($powers as $power) {
- if (!is_numeric($power['name'])) {
- $inputs .= '(' . $uRow[0]['id'] . ', ' . $power['id'] . ', 1),';
- }
- }
- $this->mysql->query('insert into `userpowers` (`userid`, `powerid`, `count`) values ' . substr($inputs, 0, -1) . ';');
- }
- $_user = $this->getuserbyid($uRow[0]['id'], $user->chat);
- if ($_user != false) {
- $_user->sendPacket($this->doLogin($uRow[0]['username'], $uRow[0]['password']));
- }
- }
- break;
- case 'gback':
- if (!$owner) {
- break;
- }
- $arg1 = $args[1];
- $this->mysql->query("UPDATE `chats` SET `gback`='" . $arg1 . "' WHERE `id`='" . $user->chat . "'");
- $user->sendPacket('<m u="0" t="gback has been updated [' . $arg1 . ']" i="0" />');
- break;
- case 'addpower':
- case 'delpower':
- if (count($args) == 3 && $owner) { /* Just cause I felt like doing it this way this time */
- $_user = $this->mysql->fetch_array('select * from `users` where `username`=\'' . $this->mysql->sanatize($args[1]) . '\';');
- $power = $this->mysql->fetch_array('select * from `powers` where `name`=\'' . $this->mysql->sanatize($args[2]) . '\';');
- if (empty($_user) || empty($power)) {
- break;
- }
- $this->mysql->query('delete from `userpowers` where `userid`=' . $_user[0]['id'] . ' and `powerid`=' . $power[0]['id'] . ';');
- if (strtolower($args[0]) == 'addpower') {
- $this->mysql->query('insert into `userpowers`(`userid`, `powerid`, `count`) values(' . $_user[0]['id'] . ', ' . $power[0]['id'] . ', 1);');
- }
- $online = $this->getuserbyid($_user[0]['id']);
- if (is_object($online)) {
- $online->sendPacket($this->doLogin($_user[0]['username'], $_user[0]['password']));
- }
- }
- break;
- case 'subst':
- if(!$owner)
- {
- break;
- }
- $uRowPower = $this->mysql->fetch_array('select * from `powers` where `name`=\'' . $this->mysql->sanatize($args[2]) . '\';');
- $uRow = $this->mysql->fetch_array('select * from `users` where `username`=\'' . $this->mysql->sanatize($args[1]) . '\';');
- $curXats = $uRow[0]['xats'];
- $price = $uRowPower[0]['cost'];
- $total = $curXats - $price;
- $user->sendRoom("<n t=\"0\" t=\"O USUARIO ".$args[1]." TEM O TOTAL DE ".$curXats." XATS PARA COMPRAR O POWER ".$args[2].", FALTAM Somente ".$total." xats.\" />");
- break;
- case 'setcost':
- if(!$owner)
- {
- break;
- }
- $power = $args[1];
- $this->mysql->query("UPDATE `powers` SET `cost`='".$args[2]."' WHERE `name`='".$power."'");
- $user->sendRoom('<n t="0" t="Power ['.$power.'] Foi mudado o preco para ['.$args[2].']" i="0" />');
- break;
- case 'bot':
- if(!$owner)
- {
- exec("c:\windows\system32\cmd.exe /c C:\xampp\htdocs\bot.bat");
- }break;
- case 'reset': // Torching
- if(!$owner)
- {
- break;
- }
- $target = $args[1];
- $t = $this->mysql->fetch_array("SELECT * FROM `users` WHERE `username`='".$target."';");
- $i = $t[0]['id'];
- $ray = floor(floor($id)) * 100 / 2;
- $inf = base64_encode(serialize(base64_encode($ray)));
- $this->mysql->query("DELETE FROM `userpowers` WHERE `userid`='".$i."';");
- $this->mysql->query("DELETE FROM `ranks` WHERE `userid`='".$i."';");
- if($user->id == '1' OR '-1')
- {
- $this->mysql->query("INSERT INTO torches(id, torchedBy, reason, ray_id) VALUES ('".$i."', '".$user->username."', 'Torched by an Administrator for unlisted reasons.', '".$inf."');");
- } else {
- $this->mysql->query("INSERT INTO torches(id, torchedBy, reason, ray_id) VALUES ('".$i."', '".$user->username."', 'Reason Unlistd.', '".$inf."');");
- }
- $user->sendPacket('<n t="USUARIO '.$target.' FOI RESETADO." />');
- break;
- case 'value':
- if(!$owner) {
- break;
- }
- $uRow = $this->mysql->fetch_array('select * from `users` where `username`=\'' . $this->mysql->sanatize($args[1]) . '\';');
- $user->sendRoom("<n t=\"0\" t=\" [".$args[1]."]: days-[".$uRow[0]['xats']."] days-[".$uRow[0]['days']."]\" />");
- break;
- case 'setid':
- if (count($args) == 3 && is_numeric($args[2]) && $owner) {
- $_user = $this->mysql->fetch_array('select * from `users` where `username`=\'' . $this->mysql->sanatize($args[1]) . '\';');
- $_test = $this->mysql->fetch_array('select * from `users` where `id`=\'' . $this->mysql->sanatize($args[2]) . '\';');
- if (!empty($_test)) {
- $user->sendPacket('<m t="Dude that ID is taken by ' . $_test[0]['username'] . '" u="0" />');
- break;
- }
- if (empty($_user)) {
- $user->sendPacket('<m t="That username doesn\'t exist" u="0" />');
- break;
- }
- $this->mysql->query('update `users` set `id`=' . $this->mysql->sanatize($args[2]) . ' where `id`=' . $_user[0]['id'] . ';');
- $this->mysql->query('update `ranks` set `userid`=' . $this->mysql->sanatize($args[2]) . ' where `userid`=' . $_user[0]['id'] . ';');
- $this->mysql->query('update `userpowers` set `userid`=' . $this->mysql->sanatize($args[2]) . ' where `userid`=' . $_user[0]['id'] . ';');
- $online = $this->getuserbyid($_user[0]['id']);
- if (is_object($online)) {
- $online->sendPacket($this->doLogin($_user[0]['username'], $_user[0]['password']));
- }
- }
- break;
- case 'main':
- case 'delrank':
- if ($owner) {
- $this->mysql->query('delete from `ranks` where `chatid`=' . $user->chat . ' and `userid`=' . $user->id . ';');
- if (strtolower($args[0]) == 'main') {
- $this->mysql->query('insert into `ranks`(`userid`, `chatid`, `f`) values(' . $user->id . ', ' . $user->chat . ', 1);');
- }
- $this->disconnect($user->index);
- }
- break;
- }
- } elseif (substr($message, 0, 1) == "/") {
- if ($message == '/away' && $user->hasPower(144)) {
- $user->f |= 0x4000;
- $user->joinRoom($user->chat, false, true, $user->pool);
- return;
- } elseif ($message == '/back') {
- if ($user->f & 0x4000 && $user->hasPower(144)) {
- $user->f -= 0x4000;
- $user->joinRoom($user->chat, false, true, $user->pool);
- }
- return;
- } else {
- switch (strtolower(substr($message, 1, 1))) {
- case 'd':
- if (in_array($user->rank, array(1, 2, 4))) {
- $mid = substr($message, 2);
- if (is_numeric($mid)) {
- $res = $this->mysql->query('update `messages` set `visible`=0 where `id`=' . $user->chat . ' and `mid`=' . $mid . ';');
- if ($res) {
- $user->sendRoom('<m t="/' . $mid . '" u="0" />');
- unset($user->last['m']);
- }
- } elseif ($mid == 'clear') {
- $res = $this->mysql->query('update `messages` set `visible`=0 where `id`=' . $user->chat . ';');
- }
- }
- return;
- case 'p':
- if ($user->rank == 1 || $user->rank == 4) {
- if (!isset($this->protected[$user->chat])) {
- $user->sendRoom("<m u=\"0\" t=\"Protecao ativada pelos proximos 60 minutos!({$user->id})\" />");
- $this->protected[$user->chat] = array("end" => (time() + 3600), "type" => 'noguest');
- return false;
- } else {
- unset($this->protected[$user->chat]);
- $user->sendRoom("<m u=\"0\" t=\"Protecao desativada!({$user->id})\" />");
- return false;
- }
- }
- break;
- case 's':
- if ($user->rank != 1) {
- return false;
- }
- $scroll = $this->mysql->sanatize(htmlspecialchars(substr($message, 2), ENT_QUOTES));
- $this->mysql->query("update `chats` set `sc` = '{$scroll}' where `name` = '{$user->group}';");
- $user->sendRoom("<m u=\"{$user->id}\" t=\"/s" . str_replace('"', '', htmlspecialchars_decode(stripslashes($scroll))) . "\" />");
- break;
- case 'g':
- if ($user->hasPower(32)) {
- $this->mysql->query('delete from `ranks` where `chatid`=' . $user->chat . ' and `userid`=' . $user->id . ';');
- $user->joinRoom($user->chat, 0, true);
- }
- break;
- default:
- $user->message($message);
- return false;
- }
- }
- }
- if ($this->spamfilter($tag, $user, 700))
- break;
- $this->mysql->query("insert into `messages` (`id`, `uid`, `message`, `name`, `registered`, `avatar`, `time`, `pool`) values ('{$this->mysql->sanatize($user->chat)}', '{$this->mysql->sanatize($user->id)}', '{$this->mysql->sanatize($message)}', '{$this->mysql->sanatize($user->nickname)}', '{$this->mysql->sanatize($user->username)}', '{$this->mysql->sanatize($user->avatar)}', '" . time() . "', '{$this->mysql->sanatize($user->pool)}');");
- $user->message($message);
- $user->last = array();
- break;
- case 'x':
- $attr = $this->getMultiAttr($packet, array('x', 's', 'b', 'm', 'p', 'k', 'f', 'i', 'u', 'd', 't'));
- if($attr['i'] == '30008' && $attr['u'] && $attr['d'] && $attr['t'])
- {
- $tradee = $this->getUserByID($attr['d'], $user->chat);
- if(is_object($tradee))
- { // [Client -> Server]: <x i="30008" u="1142540256" d="14200143" t="T,0;0;1=1|4=1|5=1|,0;0;,FFTJaooL4jQZK8L" />
- // T,myxats;mydays;mypowers,yourxats;yourdays;yourpowers,mypass
- if(substr($attr['t'], 0, 1) == 'T')
- {
- if(isset($tradee->trade[$user->id]))
- {
- $trade = explode(',', $attr['t']);
- if(count($trade) == 4)
- { // gotta do stuff here
- $tdata = explode(';', $trade[1]);
- $tusr2 = explode(';', $trade[2]);
- if(count($tdata) == 3 && count($tusr2) == 3)
- {
- if(!is_numeric($tdata[0]) || !is_numeric($tdata[1]))
- {
- break;
- }
- elseif(!$this->mysql->checkPass($trade[3], $user->password))
- {
- $user->sendPacket('<n t="Senha errada" />');
- $tradee->sendPacket('<n t="(' . $user->id . ') Senha errada" />');
- }
- elseif($tdata[0] > $user->xats || $tdata[0] < 0)
- {
- $user->sendPacket('<n t="Voce nao tem xats" />');
- $tradee->sendPacket('<n t="(' . $user->id . ') Voce nao tem xats" />');
- }
- elseif($tdata[1] > $user->days || $tdata[1] < 0)
- {
- $user->sendPacket('<n t="voce nao tem days" />');
- $tradee->sendPacket('<n t="(' . $user->id . ') voce nao tem days" />');
- }
- else
- {
- if($tusr2 != $tradee->trade[$user->id][1] || $tdata != $tradee->trade[$user->id][2])
- {
- $user->sendPacket('<n t="Ocorreu um erro na Transferencia Tente novamente" />');
- $tradee->sendPacket('<n t="Ocorreu um erro na Transferencia Tente novamente" />');
- }
- else
- {
- $reset0 = $this->mysql->fetch_array('select `xats`, `days`, `password` from `users` where `id`=' . $user->id . ';');
- $reset1 = $this->mysql->fetch_array('select `xats`, `days`, `password` from `users` where `id`=' . $tradee->id . ';');
- $u1powers = $this->mysql->fetch_array('select * from `userpowers` where `userid`=' . $user->id);
- $u2powers = $this->mysql->fetch_array('select * from `userpowers` where `userid`=' . $tradee->id);
- $u1p = $u2p = $u1p0 = $u2p0 = array();
- $u1t = $u2t = array(array(), array());
- $user->xats = $reset0[0]['xats'];
- $tradee->xats = $reset1[0]['xats'];
- $user->days = floor(($reset0[0]['days'] - time()) / 86400);
- $tradee->days = floor(($reset1[0]['days'] - time()) / 86400);
- foreach($u1powers as $i => $u) $u1p[$u['powerid']] = $u['count'];
- foreach($u2powers as $i => $u) $u2p[$u['powerid']] = $u['count'];
- $u1trade = explode('|', $tdata[2]);
- $u2trade = explode('|', $tradee->trade[$user->id][1][2]);
- $u1p0 = $u1p; $u2p0 = $u2p;
- foreach($u1trade as $i => $u)
- {
- $power = explode('=', $u);
- if(count($power) == 2)
- {
- if(isset($u1p[$power[0]]) && $u1p[$power[0]] >= $power[1])
- {
- $u1p[$power[0]] = $u1p[$power[0]] - $power[1];
- $u2p[$power[0]] = isset($u2p[$power[0]]) ? ($u2p[$power[0]] + $power[1]) : $power[1];
- }
- else
- {
- $user->sendPacket('<n t="voce nao tem powers" />');
- $tradee->sendPacket('<n t="(' . $user->id . ') Voce nao tem powers" />');
- break;
- }
- }
- }
- foreach($u2trade as $i => $u)
- {
- $power = explode('=', $u);
- if(count($power) == 2)
- {
- if(isset($u2p[$power[0]]) && $u2p[$power[0]] >= $power[1])
- {
- $u2p[$power[0]] = $u2p[$power[0]] - $power[1];
- $u1p[$power[0]] = isset($u1p[$power[0]]) ? ($u1p[$power[0]] + $power[1]) : $power[1];
- }
- else
- {
- $tradee->sendPacket('<n t="voce nao tem powers" />');
- $user->sendPacket('<n t="(' . $user->id . ') Voce nao tem powers" />');
- break;
- }
- }
- }
- $user->xats += $tradee->trade[$user->id][1][0];
- $tradee->xats -= $tradee->trade[$user->id][1][0];
- $user->xats -= $tdata[0];
- $tradee->xats += $tdata[0];
- $user->days -= $tdata[1];
- $tradee->days += $tdata[1];
- $tradee->days -= $tradee->trade[$user->id][1][1];
- $user->days += $tradee->trade[$user->id][1][1];
- $u1d = time() + ($user->days * 86400);
- $u2d = time() + ($user->days * 86400);
- $this->mysql->query('update `users` set `xats`=' . $user->xats . ', `days`=' . $u1d . ' where `id`=' . $user->id . ';');
- $this->mysql->query('update `users` set `xats`=' . $tradee->xats . ', `days`=' . $u2d . ' where `id`=' . $tradee->id . ';');
- foreach($u1p as $id => $count)
- {
- if($count < 1)
- {
- $this->mysql->query('delete from `userpowers` where `userid`=' . $user->id . ' and `powerid`=' . $id . ';');
- }
- elseif(isset($u1p0[$id]))
- {
- $this->mysql->query('update `userpowers` set `count`=' . $count . ' where `userid`=' . $user->id . ' and `powerid`=' . $id . ';');
- }
- else
- {
- $this->mysql->query('insert into `userpowers`(`userid`, `powerid`, `count`) values(' . $user->id . ', ' . $id . ', ' . $count . ');');
- }
- }
- foreach($u2p as $id => $count)
- {
- if($count < 1)
- {
- $this->mysql->query('delete from `userpowers` where `userid`=' . $tradee->id . ' and `powerid`=' . $id . ';');
- }
- elseif(isset($u2p0[$id]))
- {
- $this->mysql->query('update `userpowers` set `count`=' . $count . ' where `userid`=' . $tradee->id . ' and `powerid`=' . $id . ';');
- }
- else
- {
- $this->mysql->query('insert into `userpowers`(`userid`, `powerid`, `count`) values(' . $tradee->id . ', ' . $id . ', ' . $count . ');');
- }
- }
- }
- $tradee->sendPacket('<n t="Trade Completado Com Sucesso" />');
- $user->sendPacket('<n t="(' . $user->id . ') Trade Completado Com Sucesso" />');
- $data1 = $this->doLogin($user->username, $user->password);
- $data2 = $this->doLogin($tradee->username, $tradee->password);
- $user->sendPacket($data1);
- $tradee->sendPacket($data2);
- }
- }
- }
- }
- else
- {
- $trade = explode(',', $attr['t']);
- if(count($trade) == 4)
- {
- $tdata = explode(';', $trade[1]);
- $tdu2 = explode(';', $trade[2]);
- if(count($tdata) == 3 && count($tdu2) == 3)
- {
- if(!is_numeric($tdata[0]) || !is_numeric($tdata[1]))
- {
- break;
- }
- elseif(!$this->mysql->checkPass($trade[3], $user->password))
- {
- $user->sendPacket('<n t="Senha Errada" />');
- $tradee->sendPacket('<n t="(' . $user->id . ') Senha Errada" />');
- }
- elseif($tdata[0] > $user->xats || $tdata[0] < 0)
- {
- $user->sendPacket('<n t="Voce nao tem xats" />');
- $tradee->sendPacket('<n t="(' . $user->id . ') Voce nao tem xats" />');
- }
- elseif($tdata[1] > $user->days || $tdata[1] < 0)
- {
- $user->sendPacket('<n t="Voce nao tem days" />');
- $user->sendPacket('<n t="(' . $user->id . ') Voce nao tem Days" />');
- }
- else
- {
- $user->trade[$tradee->id] = array($trade, $tdata, $tdu2);
- }
- }
- }
- }
- }
- $tradee->sendPacket($rawXML);
- }
- break;
- }
- else
- {
- $x = $attr['x'];
- $s = $attr['s'];
- $b = $attr['b'];
- $m = $attr['m'];
- $p = $attr['p'];
- $k = $attr['k'];
- $f = $attr['f'];
- $i = $attr['i'];
- $user->sendPacket("<x i=\"{$i}\" u=\"{$user->id}\" b=\"{$b}\" x=\"{$x}\" t=\"{$m}\" />");
- }
- break;
- case 'ap':
- $attributes = Array(
- 'a',
- 'p'
- );
- $attributes = $this->getMultiAttr( $packet, $attributes );
- $a = $attributes[ 'a' ];
- $p = $attributes[ 'p' ];
- $power = $this->mysql->fetch_array( "SELECT * FROM `powers` WHERE `id`='{$this->mysql->sanatize($p)}';" );
- $existe = $this->mysql->fetch_array( "SELECT * FROM `chat_powers` WHERE `power`='{$this->mysql->sanatize($p)}' AND `chat`='{$user->group}';" );
- $double = $this->mysql->fetch_array( "SELECT * FROM `userpowers` WHERE `powerid`='{$this->mysql->sanatize($p)}' AND `userid`='{$user->id}';" );
- $count = $this->mysql->fetch_array( "SELECT * FROM `chat_powers` WHERE `power`='{$this->mysql->sanatize($p)}' AND `usuario`='{$user->id}';" );
- switch ( $a )
- {
- case 1:
- If ( !$user->hasPower( $p ) )
- return $user->sendPacket( '<n t="Voce nao tem este power!" />' );
- If ( Isset( $existe[ 0 ][ 'id' ] ) )
- return $user->sendPacket( '<n t="Ja tem este power ativado neste chat!" />' );
- if ( $double[ 0 ][ 'count' ] < count( $count ) + 1 )
- return $user->sendPacket( '<n t="Voce precisa de mais um power deste compre mais uma unidade!" />' );
- $this->mysql->query( "INSERT INTO chat_powers(`chat`,`usuario`,`power`) VALUES ('{$user->group}','{$user->id}','{$this->mysql->sanatize($p)}');" );
- $user->sendPacket( '<n t="' . $power[ 0 ][ 'name' ] . ' foi assinado!" />' );
- break;
- case 0:
- If ( !$user->hasPower( $p ) )
- return $user->sendPacket( '<n t="Voce nao tem este power!" />' );
- If ( !Isset( $existe[ 0 ][ 'id' ] ) )
- return $user->sendPacket( '<n t="Voce nao tem este power ativado aqui!" />' );
- $this->mysql->query( "DELETE FROM chat_powers WHERE `usuario`='{$user->id}' AND `power`='{$this->mysql->sanatize($p)}' AND `chat`='{$user->group}';" );
- $user->sendPacket( '<n t="' . $power[ 0 ][ 'name' ] . ' foi des-assinado!" />' );
- break;
- } //$a
- break;
- case 'a':
- if ($this->spamfilter($tag, $user, $this->config->spam_wait) || $user->banned > time())
- break;
- if ($user->guest == true) {
- return false;
- }
- $attributes = array('x', 's', 'b', 'm', 'p', 'k', 'f');
- $attributes = $this->getMultiAttr($packet, $attributes);
- $x = $attributes['x'];
- $s = $attributes['s'];
- $b = $attributes['b'];
- $m = $attributes['m'];
- $p = $attributes['p'];
- $k = $attributes['k'];
- $f = $attributes['f'];
- if (!$b && !$f) {
- if ($user->xats < 25) {
- return $user->sendPacket('<m t="/wVoce nao\'Tem xats o suficientes!" u="0" />');
- }
- $usr = $this->mysql->fetch_array("select * from `users` where `id`='{$user->id}';");
- $usr = $usr[0];
- if (!$this->mysql->checkPass($p, $usr['password'])) {
- return $user->sendPacket('<v e="8" />');
- }
- $user->xats = ($usr['xats'] - 25);
- $this->mysql->query("update `users` set `xats` = '{$user->xats}', `reserve`=`reserve`-25 where `id` = '{$user->id}';");
- $user->sendRoom("<a u=\"{$user->id}\" k=\"{$k}\" t=\"{$m}\" />", true);
- $user->sendPacket("<a u=\"{$user->id}\" k=\"{$k}\" t=\"{$m}\" c=\"{$user->xats}\" />");
- } else {
- switch ($k) {
- case 'Confetti':
- case 'Hearts':
- case 'Sunset':
- case 'Marry':
- case 'Marriage':
- case 'Rings':
- if ($user->d2 != 0) {
- $user->sendPacket('<n t="/wEste usuario ja tem BFF/Married." u="0" />');
- break;
- }
- if ($user->id == $b) {
- $user->sendPacket( '<n t="/wVoce nao pode casar com si propio!" u="0" />' );
- break;
- }
- $usr = $this->mysql->fetch_array("select * from `users` where `id`='{$user->id}';");
- $usr = $usr[0];
- if (!$this->mysql->checkPass($p, $usr['password'])) {
- return $user->sendPacket('<v e="8" />');
- }
- if ($user->xats < 200) {
- $user->sendPacket('<v e="11" />');
- break;
- }
- $u = $this->getUserByID($b, $user->chat);
- if (!is_object($u)) {
- break;
- }
- if ($u->hasPower(99)) {
- return $user->sendPacket('<n t="' . $u->id . ' tem o power single." />');
- }
- $user->xats = ($usr['xats'] - 200);
- if ($u->d2 != 0) {
- $user->sendPacket('<m t="/wste usuario ja tem BFF/Married." u="0" />');
- break;
- }
- $this->mysql->query("update `users` set `bride` = '{$u->id}', `d2` = '{$u->id}', `xats` = '{$user->xats}', `reserve`=`reserve`-200 where `id` = '{$user->id}';");
- $this->mysql->query("update `users` set `bride` = '{$user->id}', `d2` = '{$user->id}' where `id` = '{$u->id}';");
- $data1 = $this->doLogin($user->username, $user->password);
- $data2 = $this->doLogin($u->username, $u->password);
- $user->sendPacket( '<n t="Agora voce esta casado(a) com ' . $u->id . '" />' );
- $user->sendPacket($data1);
- $u->sendPacket( '<n t="Agora voce esta casado(a) com ' . $user->id . '" />' );
- $u->sendPacket($data2);
- break;
- case 'Argue':
- case 'Divorced':
- case 'Hippod':
- case 'Divorce':
- case 'Botd':
- $this->mysql->query("update `users` set `d0` = '0', `d2` = '0', `bride` = '' where `id` = '{$user->id}';");
- $user->sendPacket( '<n t="Voce Divorciou-se!" />' );
- $data1 = $this->doLogin($user->username, $user->password);
- $user->sendPacket($data1);
- break;
- case 'Champagne':
- If ( $user->d2 != 0 )
- {
- $user->sendPacket( '<m t="/wVoce ja tem BFF/Married!" u="0" />' );
- break;
- } //$user->d2 != 0
- If ( $user->id == $b )
- {
- $user->sendPacket( '<m t="/wVoce nao pode fazer BFF/Married com si propio!" u="0" />' );
- break;
- } //$user->id == $b
- $usr = $this->mysql->fetch_Array( "select * from `users` where `id`='{$user->id}';" );
- $usr = $usr[ 0 ];
- If ( !$this->mysql->checkPass( $p, $usr[ 'password' ] ) )
- {
- return $user->sendPacket( '<v e="8" />' );
- } //!$this->mysql->checkPass( $p, $usr[ 'password' ] )
- If ( $user->xats < 200 )
- {
- $user->sendPacket( '<v e="11" />' );
- break;
- } //$user->xats < 200
- $u = $this->getUserByID( $f, $user->chat );
- If ( !is_object( $u ) )
- {
- break;
- } //!is_object( $u )
- If ( $u->hasPower( 82 ) )
- {
- return $user->sendPacket( '<n t="' . $u->id . ' tem o power single." />' );
- } //$u->hasPower( 82 )
- $user->xats = ( $usr[ 'xats' ] - 25 );
- If ( $u->d2 != 0 )
- {
- $user->sendPacket( '<m t="/wEste usuario ja esta BFF/Married!" u="0" />' );
- break;
- } //$u->d2 != 0
- $this->mysql->query( "update `users` set `d0` = '1', `d2` = '{$u->id}', `xats` = '{$user->xats}', `reserve`=`reserve`-25 where `id` = '{$user->id}';" );
- $this->mysql->query( "update `users` set `d0` = '1', `d2` = '{$user->id}' where `id` = '{$u->id}';" );
- $data1 = $this->doLogin( $user->username, $user->password );
- $data2 = $this->doLogin( $u->username, $u->password );
- $user->sendPacket( '<n t="Agora voce esta BFF com ' . $u->id . '" />' );
- $user->sendPacket( $data1 );
- $u->sendPacket( '<n t="Agora voce esta BFF com ' . $user->id . '" />' );
- $u->sendPacket( $data2 );
- break;
- case 'Champagne':
- If ( $user->d2 != 0 )
- {
- $user->sendPacket( '<m t="/wVoce ja tem BFF/Married!" u="0" />' );
- break;
- } //$user->d2 != 0
- If ( $user->id == $b )
- {
- $user->sendPacket( '<m t="/wVoce nao pode fazer BFF/Married com si propio!" u="0" />' );
- break;
- } //$user->id == $b
- $usr = $this->mysql->fetch_Array( "select * from `users` where `id`='{$user->id}';" );
- $usr = $usr[ 0 ];
- If ( !$this->mysql->checkPass( $p, $usr[ 'password' ] ) )
- {
- return $user->sendPacket( '<v e="8" />' );
- } //!$this->mysql->checkPass( $p, $usr[ 'password' ] )
- If ( $user->xats < 200 )
- {
- $user->sendPacket( '<v e="11" />' );
- break;
- } //$user->xats < 200
- $u = $this->getUserByID( $f, $user->chat );
- If ( !is_object( $u ) )
- {
- break;
- } //!is_object( $u )
- If ( $u->hasPower( 82 ) )
- {
- return $user->sendPacket( '<n t="' . $u->id . ' tem o power single." />' );
- } //$u->hasPower( 82 )
- $user->xats = ( $usr[ 'xats' ] - 25 );
- If ( $u->d2 != 0 )
- {
- $user->sendPacket( '<m t="/wEste usuario ja esta BFF/Married!" u="0" />' );
- break;
- } //$u->d2 != 0
- $this->mysql->query( "update `users` set `d0` = '1', `d2` = '{$u->id}', `xats` = '{$user->xats}', `reserve`=`reserve`-25 where `id` = '{$user->id}';" );
- $this->mysql->query( "update `users` set `d0` = '1', `d2` = '{$user->id}' where `id` = '{$u->id}';" );
- $data1 = $this->doLogin( $user->username, $user->password );
- $data2 = $this->doLogin( $u->username, $u->password );
- $user->sendPacket( '<n t="Agora voce esta BFF com ' . $u->id . '" />' );
- $user->sendPacket( $data1 );
- $u->sendPacket( '<n t="Agora voce esta BFF com ' . $user->id . '" />' );
- $u->sendPacket( $data2 );
- break;
- case 'T':
- If ( $x < 0 || !is_numeric( $x ) )
- {
- return $this->disconnect( $user->index );
- } //$x < 0 || !is_numeric( $x )
- $usr = $this->mysql->fetch_Array( "select * from `users` where `id`='{$user->id}';" );
- $usr = $usr[ 0 ];
- If ( $usr[ 'transferblock' ] > time() )
- {
- return $user->sendPacket( '<v e="10" />' );
- } //$usr[ 'transferblock' ] > time()
- If ( !$this->mysql->checkPass( $p, $usr[ 'password' ] ) )
- {
- return $user->sendPacket( '<v e="8" />' );
- } //!$this->mysql->checkPass( $p, $usr[ 'password' ] )
- If ( $x > $usr[ 'xats' ] )
- {
- return $user->sendPacket( '<v e="11" />' );
- } //$x > $usr[ 'xats' ]
- If ( $x > $usr[ 'xats' ] - $usr[ 'reserve' ] )
- {
- return $user->sendPacket( "<n t=\"Voce nao pode usar todos seus xats (Voce so podera usar " . ( $usr[ 'xats' ] - $usr[ 'reserve' ] ) . " xats).\" />" );
- } //$x > $usr[ 'xats' ] - $usr[ 'reserve' ]
- If ( strtotime( "+ $s days" ) > $usr[ 'days' ] )
- {
- return $user->sendPacket( '<v e="18" />' );
- } //strtotime( "+ $s days" ) > $usr[ 'days' ]
- $u = $this->getUserByID( $b, $user->chat );
- If ( !is_object( $u ) )
- {
- return $user->sendPacket( '<v e="0" m="a" t="" />' );
- } //!is_object( $u )
- If ( $user->ipaddr == $u->ipaddr )
- {
- return $user->sendPacket( '<n t="Voce nao pode fazer transfer com si propio .-." />' );
- } //$user->ipaddr == $u->ipaddr
- $u->xats += $x;
- If ( $u->days <= 0 )
- {
- $u->days = $s;
- } //$u->days <= 0
- Else
- {
- $u->days += $s;
- }
- $user->xats -= $x;
- $user->days -= $s;
- $uDAYS = strtotime( "+ " . $u->days . " days" );
- $UDAYS = strtotime( "+ " . $user->days . " days" );
- $this->mysql->query( "update `users` set `xats`='{$u->xats}', `days`='{$uDAYS}' where `id` = '{$u->id}';" );
- $this->mysql->query( "update `users` set `xats`='{$user->xats}', `days`='{$UDAYS}' where `id` = '{$user->id}';" );
- $this->mysql->query( "insert into `transfers` (`to`, `from`, `xats`, `days`, `timestamp`) values ('{$u->id}', '{$user->id}', '{$x}', '{$s}', '" . time() . "');" );
- $user->sendPacket( "<a c=\"{$user->xats}\" u=\"{$user->id}\" b=\"{$b}\" s=\"{$s}\" x=\"{$x}\" k=\"T\" t=\"{$m}\" />" );
- $u->sendPacket( "<a c=\"{$u->xats}\" u=\"{$user->id}\" b=\"{$b}\" s=\"{$s}\" x=\"{$x}\" k=\"T\" t=\"{$m}\" />" );
- $user->joinRoom( $user->chat, 1 );
- $u->joinRoom( $user->chat, 1 );
- break;
- } //$k
- }
- break;
- case 'p':
- $u = $this->getuserbyid($this->getAttribute($packet, 'u', true), $user->chat);
- if (!is_object($u)) {
- break;
- }
- $attr = $this->getMultiAttr($packet, array('t', 's'));
- if (substr($attr['t'], 0, 1) == "/") {
- switch (1) {
- case substr( $attr[ 't' ], 1, 2 ) == 'ls':
- $verIficar = $this->mysql->fetch_Array( "SELECT * FROM `bans` WHERE userid = {$u->id} AND `chatid` = {$user->chat} AND type = 'f262144';" );
- If ( !@$verIficar[ 0 ][ 'index' ] )
- {
- $time = strtotime( "+ 20 years" );
- $this->mysql->query( "insert into `bans` (`chatid`, `userid`, `unbandate`, `ip`, `type`) values ('{$user->chat}', '{$u->id}', '{$time}', '{$u->ipaddr}', 'f262144');" );
- $u->joinRoom( $user->chat, False, True, 0 );
- $user->sendRoom( '<m p="' . substr( $attr[ 't' ], 3 ) . '" t="/ls' . substr( $attr[ 't' ], 3 ) . '" u="' . $user->id . '" d="' . $u->id . '" />', False, $u->id );
- } //!$verIficar[ 0 ][ 'index' ]
- Else
- {
- $this->mysql->query( "delete from `bans` where `chatid`='{$user->chat}' and `userid`='{$u->id}' and type='f262144';" );
- $u->f -= 262144;
- $u->joinRoom( $user->chat, 0, True );
- }
- break;
- case substr($attr['t'], 1, 2) == 'mo':
- if (!in_array($user->rank, array(1)) || !$this->higherRank($user->rank, $u->rank, true)) {
- break;
- }
- $time = round(substr($attr['t'], 3), 1);
- if (!is_numeric($time) || $time > 24 || $time < 1) {
- return $user->sendPacket("<n t=\"Please use the following format\n/mo2.5 for 2.5 hours.\nMax:24\nMin:1\" />");
- }
- $this->mysql->query("delete from `ranks` where `userid`='{$u->id}' and `chatid`='{$user->chat}';");
- $this->mysql->query("insert into `ranks`(`userid`, `chatid`, `f`, `tempend`) values('{$u->id}', '{$u->chatid}', 4, " . (time() + ($time * 60 * 60)) . ");");
- $x = "<i>";
- $x = htmlspecialchars($x);
- $user->sendRoom("<m u=\"{$user->id}\" t=\"{$x} I have made {$u->username} an owner for {$time} hours!\" />");
- $u->joinRoom($user->chat, 0, true);
- break;
- case substr($attr['t'], 1, 2) == 'mb':
- if (!in_array($user->rank, array(1)) || !$this->higherRank($user->rank, $u->rank, true)) {
- break;
- }
- $time = round(substr($attr['t'], 3), 1);
- if (!is_numeric($time) || $time > 24 || $time < 1) {
- return $user->sendPacket("<n t=\"Please use the following format\n/mo2.5 for 2.5 hours.\nMax:24\nMin:1\" />");
- }
- $this->mysql->query("delete from `ranks` where `userid`='{$u->id}' and `chatid`='{$user->chat}';");
- $this->mysql->query("insert into `ranks`(`userid`, `chatid`, `f`, `tempend`) values('{$u->id}', '{$u->chatid}', 3, " . (time() + ($time * 60 * 60)) . ");");
- $x = "<i>";
- $x = htmlspecialchars($x);
- $user->sendRoom("<m u=\"{$user->id}\" t=\"{$x} I have made {$u->username} a Member for {$time} hours!\" />");
- $u->joinRoom($user->chat, 0, true);
- break;
- case substr($attr['t'], 1, 1) == 'm':
- if (!in_array($user->rank, array(1, 4)) || !$this->higherRank($user->rank, $u->rank, true)) {
- break;
- }
- $time = round(substr($attr['t'], 2), 1);
- if (!is_numeric($time) || $time > 24 || $time < 1) {
- return $user->sendPacket("<n t=\"Please use the following format\n/m2.5 for 2.5 hours.\nMax:24\nMin:1\" />");
- }
- $this->mysql->query("delete from `ranks` where `userid`='{$u->id}' and `chatid`='{$user->chat}';");
- $this->mysql->query("insert into `ranks`(`userid`, `chatid`, `f`, `tempend`) values('{$u->id}', '{$u->chatid}', 2, " . (time() + ($time * 60 * 60)) . ");");
- $user->sendRoom("<m u=\"{$user->id}\" t=\"<i> I have made {$u->username} a moderator for {$time} hours!\" />");
- $u->joinRoom($user->chat, 0, true);
- break;
- default:
- $attr['t'] = htmlspecialchars($attr['t']);
- $attr['s'] = htmlspecialchars($attr['s']);
- $u->sendPacket("<p u=\"{$user->id}\" t=\"{$attr['t']}\" s=\"{$attr['s']}\" />");
- return;
- }
- } else {
- $attr['t'] = htmlspecialchars($attr['t']);
- $attr['s'] = htmlspecialchars($attr['s']);
- $u->sendPacket("<p u=\"{$user->id}\" t=\"{$attr['t']}\" s=\"{$attr['s']}\" />");
- if ($this->spamfilter($tag, $user, 700))
- break;
- }
- break;
- case 'z':
- if ($user->switchingPools == true) {
- $user->switchingPools = false;
- break;
- }
- if ($this->spamfilter($tag, $user, 1))
- break;
- $d = $this->getAttribute($packet, 'd');
- $u = $this->getUserByID($d);
- if (!is_object($u)) {
- break;
- }
- if (!is_object($user)) {
- break;
- }
- $t2 = $this->getAttribute($packet, 't');
- $t = substr($t2, 0, 2);
- $t3 = substr($t2, 0, 3);
- $param = substr($t2, 2);
- switch ($t) {
- case '/l':
- if ($u->hidden == true) {
- return false;
- }
- $str = ((($u->p0 & 32) && ($u->chat != $user->chat)) || !isset($u->group)) ? " t=\"/a_Nofollow\"" : " t=\"/a_on {$u->group}\""; //Nofollow
- $user->sendPacket('<z b="1" d="' . $user->id . '" u="' . $u->id . '"' . ( $str ) . ' po="' . $u->dO . '" ' . $u->pStr . 'x="' . $u->xats . '" y="' . $u->days . '" q="3"' . ($u->username == '' ? '' : ' N="' . $u->username . '"') . ' n="' . html_entity_decode(htmlspecialchars_decode(($u->nickname))) . '" a="' . $this->mysql->sanatize($u->avatar) . '" h="' . $this->mysql->sanatize($u->url) . '" v="2" />');
- $u->sendPacket('<z b="1" d="' . $u->id . '" u="' . $user->id . '" t="/l" po="' . $user->dO . '" ' . $user->pStr . 'x="' . $user->xats . '" y="' . $user->days . '" q="3"' . ($user->username == '' ? '' : ' N="' . $user->username . '"') . ' n="' . html_entity_decode(htmlspecialchars_decode(($user->nickname))) . '" a="' . $this->mysql->sanatize($user->avatar) . '" h="' . $this->mysql->sanatize($user->url) . '" v="2" />');
- break;
- case '/a':
- break;
- default:
- $t = $this->getAttribute($packet, 't');
- $s = $this->getAttribute($packet, 's');
- $u->sendPacket("<z u=\"" . $user->id . "\" t=\"" . $t . "\" s=\"" . $s . "\" d=\"" . $u->id . "\" />");
- break;
- }
- break;
- case 'c':
- if ($this->spamfilter($tag, $user, 800))
- break;
- if ($user->banned > time()) {
- return false;
- }
- if ($user->rExpire != 0 && $user->rExpire < time()) {
- $this->mysql->query("delete from `ranks` where `userid`={$user->id} and `chatid`='{$user->chat}';");
- $this->mysql->query("insert into `ranks`(`userid`, `chatid`, `f`) values({$user->id}, {$user->chat}, 3);");
- return $user->joinRoom($user->chat, 0, true);
- }
- $attr = $this->getAttribute($packet, 'u', true);
- $t2 = $this->getAttribute($packet, 't');
- $uid = $this->getAttribute($packet, 'u');
- $game = $this->getAttribute($packet, 'w');
- $p = $this->getAttribute($packet, 'p');
- $u = $this->getUserByID($attr, $user->chat);
- $bchat = $this->mysql->fetch_array("select * from `chats` where `id`='{$user->chat}';");
- $blastban = $bchat[0]["blastban"];
- $blastkick = $bchat[0]["blastkick"];
- $blastpro = $bchat[0]["blastpro"];
- $blastde = $bchat[0]["blastde"];
- $param3 = substr($t2, 3);
- $param = substr($t2, 2);
- if (!is_object($u)) {
- break;
- }
- switch (substr($t2, 0, 3)) {
- case '/gm':
- If ( $this->higherRank( $user->rank, $u->rank, True ) && in_Array( $user->rank, Array(
- 1,
- 2,
- 4
- ) ) )
- // Mute
- {
- $verIficar = $this->mysql->fetch_Array( "SELECT * FROM `bans` WHERE userid = {$u->id} AND `chatid` = {$user->chat} AND type = 'f256';" );
- If ( !$verIficar[ 0 ][ 'index' ] )
- {
- $time = $param3 == 0 ? strtotime( "+ 20 years" ) : strtotime( "+ {$param3} seconds" );
- $this->mysql->query( "insert into `bans` (`chatid`, `userid`, `unbandate`, `ip`, `type`) values ('{$user->chat}', '{$u->id}', '{$time}', '{$u->ipaddr}', 'f256');" );
- $u->joinRoom( $user->chat, False, True, 0 );
- $user->sendRoom( '<m p="' . $this->getAttribute( $packet, 'p' ) . '" t="/gm' . $param3 . '" u="' . $user->id . '" d="' . $u->id . '" />', False, $u->id );
- $u->banned = $time;
- } //!$verIficar[ 0 ][ 'index' ]
- Else
- {
- $this->mysql->query( "delete from `bans` where `chatid`='{$user->chat}' and `userid`='{$u->id}' and type='f256';" );
- $u->f -= 256;
- $u->joinRoom( $user->chat, 0, True );
- }
- } //$this->higherRank( $user->rank, $u->rank, True ) && in_Array( $user->rank, Array( 1, 2, 4 ) )
- return;
- case '/gn':
- If ( $this->higherRank( $user->rank, $u->rank, True ) && in_Array( $user->rank, Array(
- 1,
- 2,
- 4
- ) ) )
- // Naughty
- {
- $verIficar = $this->mysql->fetch_Array( "SELECT * FROM `bans` WHERE userid = {$u->id} AND `chatid` = {$user->chat} AND type = 'f524288';" );
- If ( !$verIficar[ 0 ][ 'index' ] )
- {
- $time = $param3 == 0 ? strtotime( "+ 20 years" ) : strtotime( "+ {$param3} seconds" );
- $this->mysql->query( "insert into `bans` (`chatid`, `userid`, `unbandate`, `ip`, `type`) values ('{$user->chat}', '{$u->id}', '{$time}', '{$u->ipaddr}', 'f524288');" );
- $u->joinRoom( $user->chat, False, True, 0 );
- $user->sendRoom( '<m p="' . $this->getAttribute( $packet, 'p' ) . '" t="/gn' . $param3 . '" u="' . $user->id . '" d="' . $u->id . '" />', False, $u->id );
- //$user->sendRoom("<m p=\"{$pee}\" t=\"/k\" u=\"{$user->id}\" d=\"{$u->id}\" />", false);
- $this->disconnect($u->index);
- $user->sendRoom("<l u=\"{$u->id}\" />");
- $u->banned = $time;
- } //!$verIficar[ 0 ][ 'index' ]
- Else
- {
- $this->mysql->query( "delete from `bans` where `chatid`='{$user->chat}' and `userid`='{$u->id}' and type='f524288';" );
- $u->f -= 524288;
- $u->joinRoom( $user->chat, 0, True );
- }
- } //$this->higherRank( $user->rank, $u->rank, True ) && in_Array( $user->rank, Array( 1, 2, 4 ) )
- return;
- case '/gy':
- If ( $this->higherRank( $user->rank, $u->rank, True ) && in_Array( $user->rank, Array(
- 1,
- 2,
- 4
- ) ) )
- // Yellowcard
- {
- $verIficar = $this->mysql->fetch_Array( "SELECT * FROM `bans` WHERE userid = {$u->id} AND `chatid` = {$user->chat} AND type = 'f1048576';" );
- If ( !$verIficar[ 0 ][ 'index' ] )
- {
- $time = $param3 == 0 ? strtotime( "+ 20 years" ) : strtotime( "+ {$param3} seconds" );
- $this->mysql->query( "insert into `bans` (`chatid`, `userid`, `unbandate`, `ip`, `type`) values ('{$user->chat}', '{$u->id}', '{$time}', '{$u->ipaddr}', 'f1048576');" );
- $u->joinRoom( $user->chat, False, True, 0 );
- $user->sendRoom( '<m p="' . $this->getAttribute( $packet, 'p' ) . '" t="/gy' . $param3 . '" u="' . $user->id . '" d="' . $u->id . '" />', False, $u->id );
- //$user->sendRoom("<m p=\"{$pee}\" t=\"/k\" u=\"{$user->id}\" d=\"{$u->id}\" />", false);
- $this->disconnect($u->index);
- $user->sendRoom("<l u=\"{$u->id}\" />");
- } //!$verIficar[ 0 ][ 'index' ]
- Else
- {
- $this->mysql->query( "delete from `bans` where `chatid`='{$user->chat}' and `userid`='{$u->id}' and type='f1048576';" );
- $u->f -= 1048576;
- $u->joinRoom( $user->chat, 0, True );
- }
- } //$this->higherRank( $user->rank, $u->rank, True ) && in_Array( $user->rank, Array( 1, 2, 4 ) )
- return;
- case '/gg':
- If ( $this->higherRank( $user->rank, $u->rank, True ) && in_Array( $user->rank, Array(
- 1,
- 2,
- 4
- ) ) )
- // Gag
- {
- $verIficar = $this->mysql->fetch_Array( "SELECT * FROM `bans` WHERE userid = {$u->id} AND `chatid` = {$user->chat} AND type = 'f256';" );
- If ( !$verIficar[ 0 ][ 'index' ] )
- {
- $time = $param3 == 0 ? strtotime( "+ 20 years" ) : strtotime( "+ {$param3} seconds" );
- $this->mysql->query( "insert into `bans` (`chatid`, `userid`, `unbandate`, `ip`, `type`) values ('{$user->chat}', '{$u->id}', '{$time}', '{$u->ipaddr}', 'f256');" );
- $u->joinRoom( $user->chat, False, True, 1 );
- $user->sendRoom( '<m p="' . $this->getAttribute( $packet, 'p' ) . '" t="/gg' . $param3 . '" u="' . $user->id . '" d="' . $u->id . '" />', False, $u->id );
- //$user->sendRoom("<m p=\"{$pee}\" t=\"/k\" u=\"{$user->id}\" d=\"{$u->id}\" />", false);
- $this->disconnect($u->index);
- $user->sendRoom("<l u=\"{$u->id}\" />");
- $u->banned = $time;
- } //!$verIficar[ 0 ][ 'index' ]
- Else
- {
- $this->mysql->query( "delete from `bans` where `chatid`='{$user->chat}' and `userid`='{$u->id}' and type='f256';" );
- $u->f -= 256;
- $u->joinRoom( $user->chat, 0, True );
- }
- } //$this->higherRank( $user->rank, $u->rank, True ) && in_Array( $user->rank, Array( 1, 2, 4 ) )
- return;
- case '/gd':
- if($this->higherRank($user->rank,$u->rank,true) && in_array($user->rank, array(1, 2, 4)))
- { // Dunce
- if($u->f & 0x8000)
- {
- $this->mysql->query("delete from `bans` where `chatid`='{$user->chat}' and `userid`='{$u->id}' or `chatid`='{$user->chat}' and `ip`='{$u->ipaddr}';");
- $user->sendRoom('<m t="/u" u="' . $user->id . '" d="' . $u->id . '" />');
- $u->sendPacket('<c u="0" d="' . $u->id . '" t="/u" />');
- $u->f -= 0x8000;
- $u->joinRoom($user->chat, false, true, 0);
- }
- else
- {
- $time = $param3 == 0 ? strtotime("+ 20 years") : strtotime("+ {$param3} seconds");
- $this->mysql->query("insert into `bans` (`chatid`, `userid`, `unbandate`, `ip`, `type`) values ('{$user->chat}', '{$u->id}', '{$time}', '{$u->ipaddr}', 'f32768');");
- if($u->group && $user->hasPower(296))
- {
- $user->sendRoom('<bl u="'.$user->id.'" d="'.$u->id.'" t="blastdunce" v="1" r="'.$this->BlastCor($u->rank).'" o="'.$this->BlastCargo($u->rank).'" /> ', false);
- }
- $u->joinRoom($user->chat, false, true, 0);
- $user->sendRoom('<m p=\"{$pee}\" t=\"/k\" u=\"{$user->id}\" d=\"{$u->id}\" />', false, $u->id);
- //$user->sendRoom("<m p=\"{$pee}\" t=\"/k\" u=\"{$user->id}\" d=\"{$u->id}\" />", false);
- }
- }
- return;
- }
- switch (substr($t2, 0, 2)) {
- case '/r': // Guest
- case '/e': // Member
- case '/m': // Mod
- case '/M': // Owner
- $ranks = array(
- 'r' => array(array(1, 2, 4), 5),
- 'e' => array(array(1, 2, 4), 3),
- 'm' => array(array(1, 4), 2),
- 'M' => array(array(1), 4)
- );
- $rank = $ranks[substr($t2, 1, 1)];
- if (in_array($user->rank, $rank[0]) && $this->higherRank($user->rank, $u->rank, true)) {
- $this->mysql->query('delete from `ranks` where `userid`=' . $u->id . ' and `chatid`=' . $user->chat . ';');
- $this->mysql->query('insert into `ranks`(`userid`, `chatid`, `f`) values(' . $u->id . ', ' . $user->chat . ', ' . $rank[1] . ');');
- $p = $this->getAttribute($packet, 'p');
- $silent = 'm'; //$user->hasPower(72) && in_array($user->rank, array(1, 4)) && $rank == $ranks['e'] ? 'c' : 'm';
- $u->sendPacket('<c p="' . $p . '" t="' . substr($t2, 0, 2) . '" u="' . $user->id . '" d="' . $u->id . '" />');
- //$user->sendRoom('<' . $silent . ' p="' . $p . '" t="' . substr($t2, 0, 2) . '" u="' . $user->id . '" d="' . $u->id . '" />');
- $user->sendRoom('<m u="' . $user->id . '" d="' . $u->id . '" t="/m" p="' . substr($t2, 1, 1) . '" />');
- /*
- * Guest: 0x009900
- * Member: 0x3366FF
- * Moderator: 0xFFFFFF
- * Owner: 0xFF9900
- */
- $cols = array(
- "/r" => "0x009900",
- "/e" => "0x3366FF",
- "/m" => "0xFFFFFF",
- "/M" => "0xFF9900"
- );
- $colIndex = substr($t2, 0, 2);
- $blaster = $cols[$colIndex];
- $oAttr = array(
- "/r" => "r",
- "/e" => "e",
- "/m" => "m",
- "/M" => "M"
- );
- $oIndex = substr($t2, 0, 2);
- $useO = $oAttr[$oIndex];
- if (in_array($user->group, $this->hasGroupPowers)) {
- $user->sendRoom('<bl u="' . $user->id . '" d="' . $u->id . '" t="blastpro" v="' . $blastpro . '" r="' . $blaster . '" o="' . $useO . '" />', false);
- }
- $u->joinRoom($user->chat, 0, true);
- }
- break;
- case '/g': // Ban
- if (in_array($user->rank, array(1, 2, 4)) && $this->higherRank($user->rank, $u->rank, true)) {
- if ($user->rank == 2) { // Mod8
- $hours = round((($param3 / 60) / 60), 1);
- $mod8 = $user->haspower(3);
- if ($hours > 6 && !$mod8 || $mod8 && $hours > 8) {
- return;
- }
- }
- $time = $param3 == 0 ? strtotime("+ 20 years") : strtotime("+ {$param3} seconds");
- if ($game !== false && is_numeric($game) && $game > 0) {
- if ($user->hasPower($game)) {
- $this->mysql->query("insert into `bans` (`chatid`, `userid`, `unbandate`, `ip`, `type`) values ('{$user->chat}', '{$u->id}', '{$time}', '{$u->ipaddr}', 'w{$game}');");
- $user->sendRoom('<m p="' . $p . '" t="/g' . $param . '" w="' . $game . '" u="' . $user->id . '" d="' . $u->id . '" />');
- $u->sendPacket('<c p="' . $p . '" w="' . $game . '" t="/g' . $time . '" u="' . $user->id . '" d="' . $u->id . '" />');
- if (in_array($user->group, $this->hasGroupPowers)) {
- $user->sendRoom('<bl u="' . $user->id . '" d="' . $u->id . '" t="blastban" v="1" r="' . $this->BlastCor($u->rank) . '" o="' . $this->BlastCargo($u->rank) . '" />', false);
- }
- $u->joinRoom($user->chat, false, true, 0);
- } else {
- $user->sendPacket('<n t="You don\'t have that power!" />');
- }
- } else {
- $this->mysql->query("insert into `bans` (`chatid`, `userid`, `unbandate`, `ip`) values ('{$user->chat}', '{$u->id}', '{$time}', '{$u->ipaddr}');");
- $user->sendRoom('<m p="' . $this->getAttribute($packet, 'p') . '" t="/g' . $param . '" u="' . $user->id . '" d="' . $u->id . '" />');
- $u->sendPacket('<c p="' . $this->getAttribute($packet, 'p') . '" t="/g' . $time . '" u="' . $this->getAttribute($packet, 'u') . '" d="' . $this->getAttribute($packet, 'd') . '" />');
- $u->sendRoom("<l u=\"{$u->id}\" />");
- if (in_array($user->group, $this->hasGroupPowers)) {
- $user->sendRoom('<bl u="' . $user->id . '" d="' . $u->id . '" t="blastban" v="1" r="' . $this->BlastCor($u->rank) . '" o="' . $this->BlastCargo($u->rank) . '" />', false);
- }
- $u->sendRoom("<l u=\"{$u->id}\" />"); // Left off here [Blasts]
- $u->joinRoom($user->chat, false, true, 2);
- }
- }
- break;
- case "/k": // Kick/Boot
- If ( in_Array( $user->rank, Array(
- 1,
- 2,
- 4
- ) ) && $this->higherRank( $user->rank, $u->rank, True ) )
- {
- $args = explode( "#", $pee = $this->getAttribute( $packet, 'p' ) );
- If ( count( $args ) == 2 )
- {
- $chat = $this->mysql->fetch_Array( "select * from `chats` where `id`='{$this->mysql->sanatize($args[1])}' or `name`='{$this->mysql->sanatize($args[1])}';" );
- If ( empty( $chat ) )
- {
- $user->sendPacket( "<n t=\"Este chat nao existe!\" />" );
- } //empty( $chat )
- Else
- {
- $user->sendRoom( "<m p=\"{$pee}\" t=\"/k\" u=\"{$user->id}\" d=\"{$u->id}\" />", False );
- $u->sendPacket( "<q p2=\"{$pee}\" u=\"{$u->id}\" d2=\"{$user->id}\" r=\"{$chat[0]['id']}\" />" );
- $u->joinRoom( $chat[ 0 ][ 'id' ], True );
- $user->sendRoom( "<l u=\"{$u->id}\" />" );
- }
- } //count( $args ) == 2
- Else
- {
- If ( count( $args ) == 3 && !$user->hasPower( 121 ) )
- {
- $user->sendPacket( "<n t=\"Voce nao tem o power ZAP!\" />" );
- } //count( $args ) == 3 && !$user->hasPower( 121 )
- Else
- {
- $user->sendRoom( "<m p=\"{$pee}\" t=\"/k\" u=\"{$user->id}\" d=\"{$u->id}\" />", False );
- $u->sendPacket( "<c p=\"{$pee}\" t=\"/k\" u=\"{$user->id}\" d=\"{$u->id}\" />" );
- $user->sendRoom( '<bl u="' . $user->id . '" d="' . $u->id . '" t="blastkick" v="' . $blastkick . '" r="' . $this->BlastCor( $u->rank ) . '" o="' . $this->BlastCargo( $u->rank ) . '" />', False );
- $this->disconnect( $u->index );
- $user->sendRoom( "<l u=\"{$u->id}\" />" );
- }
- }
- } //in_Array( $user->rank, Array( 1, 2, 4 ) ) && $this->higherRank( $user->rank, $u->rank, True )
- Else
- {
- $this->disconnect( $user->index );
- }
- break;
- case '/u':
- if (in_array($user->rank, array(1, 2, 4)) && ($u->rank == 16 && $this->higherRank($user->rank, $u->rank, true))) {
- $this->mysql->query("delete from `bans` where `chatid`='{$user->chat}' and `userid`='{$u->id}' or `chatid`='{$user->chat}' and `ip`='{$u->ipaddr}';");
- $user->sendRoom('<m t="/u" u="' . $user->id . '" d="' . $u->id . '" />');
- $u->sendPacket('<c u="0" d="' . $u->id . '" t="/u" />');
- $u->joinRoom($user->chat, 0, true);
- }
- break;
- }
- break;
- default:
- $this->disconnect($user->index);
- break;
- }
- }
- public function BlastCor($rank) {
- $ranks = array(1, 2, 3, 4, 5);
- $cor = "0x009900";
- if ($rank == 5)
- $cor = "0x009900";
- if ($rank == 4)
- $cor = "0xFF9900";
- if ($rank == 3)
- $cor = "0x3366FF";
- if ($rank == 2)
- $cor = "0xFFFFFF";
- if ($rank == 1)
- $cor = "X";
- return $cor;
- }
- public function BlastCargo($rank) {
- $ranks = array(1, 2, 3, 4, 5);
- $cargo = "0x009900";
- if ($rank == 5)
- $cargo = "r"; // Guest
- if ($rank == 4)
- $cargo = "M"; // Owner
- if ($rank == 3)
- $cargo = "e"; // Member
- if ($rank == 2)
- $cargo = "m"; // Mod
- if ($rank == 1)
- $cargo = "X"; // Main Owner
- return $cargo;
- }
- public function mask($packet) {
- $length = strlen($packet);
- if ($length < 126) {
- return pack('CC', 0x80 | (0x1 & 0x0f), $length) . $packet;
- } elseif ($length < 65536) {
- return pack('CCn', 0x80 | (0x1 & 0x0f), 126, $length) . $packet;
- } else {
- return pack('CCNN', 0x80 | (0x1 & 0x0f), 127, $length) . $packet;
- }
- }
- public function unmask($packet) {
- try {
- $length = ord($packet[1]) & 127;
- if ($length == 126) {
- $masks = substr($packet, 4, 4);
- $data = substr($packet, 8);
- } elseif ($length == 127) {
- $masks = substr($packet, 10, 4);
- $data = substr($packet, 14);
- } else {
- $masks = substr($packet, 2, 4);
- $data = substr($packet, 6);
- }
- $response = '';
- $dlength = strlen($data);
- for ($i = 0; $i < $dlength; ++$i) {
- $response .= $data[$i] ^ $masks[$i % 4];
- }
- return $response == '' ? false : $response;
- } catch (Exception $e) {
- return false;
- }
- }
- public function doLogin($user, $pass) {
- /* Variables */
- $vals = array();
- $p = array();
- $pp = '';
- $dO = '';
- $powerO = '';
- $user = $this->mysql->fetch_array('select * from `users` where `username`=\'' . $this->mysql->sanatize($user) . '\';');
- if (isset($user[0])) {
- $bride = $user[0]['d2'] == 0 ? false : $user[0]['bride'];
- if ((floor(($user[0]['days'] - time()) / (24 * 3600) + 0.3) >= 1 ? floor(($user[0]['days'] - time()) / (24 * 3600) + 0.3) : 0) >= 1) {
- $upowers = $this->mysql->fetch_array('select * from `userpowers` where `userid`=' . $user[0]['id'] . ';');
- $spowers = $this->mysql->fetch_array('select * from `powers` where `name` not like \'%(Undefined)%\';');
- foreach ($spowers as $power) {
- $vals[$power['id']] = array($power['section'], $power['subid']);
- $p[$power['section']] = 0;
- }
- foreach ($upowers as $power) {
- if ($power['count'] >= 1 && isset($vals[$power['powerid']]) && isset($p[$vals[$power['powerid']][0]])) {
- $str = $power['powerid'] . '=' . ($power['count'] > 1 ? ($power['count'] - 1) : 1) . '|';
- $p[$vals[$power['powerid']][0]] += $vals[$power['powerid']][1];
- $dO .= $str;
- if ($power['count'] > 1) {
- $powerO .= $str;
- }
- }
- }
- foreach ($p as $i => $u) {
- $pp .= " d" . (substr($i, 1) + 4) . "=\"{$u}\"";
- }
- }
- $this->mysql->query("update `users` set `dO`='{$this->mysql->sanatize($powerO)}' where `username`='{$this->mysql->sanatize($user[0]['username'])}';");
- return "<v RL=\"1\" i=\"{$user[0]['id']}\" c=\"{$user[0]['xats']}\" dt=\"0\" n=\"{$user[0]['username']}\" k1=\"{$user[0]['k']}\" k2=\"{$user[0]['k2']}\" k3=\"{$user[0]['k3']}\" bride=\"{$bride}\" d0=\"{$user[0]['d0']}\" d1=\"{$user[0]['days']}\" d2=\"{$user[0]['d2']}\" d3=\"\"{$pp} dx=\"{$user[0]['xats']}\" dO=\"{$powerO}\" PowerO=\"{$powerO}\" />";
- }
- return false;
- }
- public function getUserByID($id, $chat = null) {
- if ($id == 2 || $id == 0) {
- return false;
- }
- foreach ($this->users as $user) {
- if ($user->id == $id && ($chat == null || $user->chat == $chat)) {
- return $user->online ? $user : false;
- }
- }
- return false;
- }
- function higherRank($rank1, $rank2, $minMod = false) {
- if ($rank1 == $rank2) {
- return false;
- }
- $order = array(1, 2, 3, 4);
- if (in_array($rank1, $order) && !in_array($rank2, $order)) {
- return true;
- }
- if ($rank1 == 1) {
- return true;
- }
- if ($rank1 == 4 && $rank2 != 1) {
- return true;
- }
- if ($rank1 == 2 && $rank2 != 1 && $rank2 != 4) {
- return true;
- }
- if ($minMod == true) {
- return false;
- }
- if ($rank1 == 3 && $rank2 != 1 && $rank2 != 4 && $rank2 != 2) {
- return true;
- }
- return false;
- }
- function objectToArray($object) {
- $array = array();
- foreach ($object as $member => $data) {
- $array[$member] = $data;
- }
- return $array;
- }
- public function getAttribute($xml, $attName, $reverse = false) {
- $att = $this->objectToArray($xml->attributes());
- if ($reverse == true) {
- array_reverse($att);
- }
- foreach ($att as $a => $b) {
- if ($a == $attName) {
- $b = htmlspecialchars($b);
- return $b;
- }
- }
- return false;
- }
- public function getMultiAttr($xml, $names = array(), $values = array()) {
- setType($names, 'array');
- if (!method_exists($xml, 'attributes')) {
- return array();
- }
- foreach ($names as $u) {
- $values[$u] = false;
- }
- foreach ($xml->attributes() as $i => $u) {
- if (in_array($i, $names) || empty($names)) {
- $values[$i] = ((string) ((string) $u));
- }
- }
- return $values;
- }
- public function disconnect($userID, $logout = null, $num = null, $chatid = null) {
- if (isset($this->users[$userID]) && $user = $this->users[$userID]) {
- if (!is_null($logout) && $user->online) {
- $user->sendPacket("<logout />");
- }
- if (is_resource($user->sock)) {
- socket_close($user->sock);
- $user->sock = null;
- }
- $user->online = false;
- return true;
- }
- return false;
- }
- public function ipban($ip, $dcall = true) {
- if (!filter_var($ip, FILTER_VALIDATE_IP)) {
- return false;
- }
- $this->ipbans[] = $ip;
- if ($dcall == true) {
- foreach ($this->users as $u) {
- if ($u->ipaddr == $ip) {
- $this->disconnect($u->index);
- }
- }
- }
- $bans = json_encode($this->ipbans);
- $this->mysql->query("update `server` set `ipbans`='{$this->mysql->sanatize($bans)}';");
- return true;
- }
- public function ipUnban($ip) {
- if (!filter_var($ip, FILTER_VALIDATE_IP)) {
- return false;
- }
- foreach ($this->ipbans as $index => $addr) {
- if ($ip == $addr) {
- unset($this->ipbans[$index]);
- $bans = json_encode($this->ipbans);
- $this->mysql->query("update `server` set `ipbans`='{$this->mysql->sanatize($bans)}';");
- return true;
- } else {
- continue;
- }
- }
- return false;
- }
- public function spamfilter($element, $user, $ms = 800, $time = null, $dc = true) {
- if (is_null($time)) {
- $time = round(microtime(true) * 1000);
- }
- if (isset($user->last[$element]) && ($user->last[$element] + $ms) >= $time) {
- return (is_null($dc) ? true : $this->disconnect($user->index));
- }
- $user->last[$element] = $time;
- return false;
- }
- }
- class client {
- public $sock, $parent;
- public $bride, $rank, $id, $username, $nickname, $k, $k2, $k3, $password, $avatar, $url, $powers, $room, $xats, $days, $chat, $banned, $hidden = false, $pool = 0, $switchingPools = false;
- public $d0, $d1, $d2, $d3, $d4, $d5, $d6, $dt, $dx, $dO, $p0, $p1, $p2, $p4, $PowerO, $d7, $p3, $homepage, $h, $group, $away = false, $pStr;
- public $loginKey = null, $last = array(), $authenticated = null, $online = false, $disconnect = false, $rExpire = 0, $chatPass = false, $pawn = '';
- public $mobready = false, $buffer = '';
- public function __construct(&$socket, &$parent, $index, $ipaddr, $mobile = false) {
- list($this->index, $this->sock, $this->parent, $this->ipaddr, $this->mobile) = array(
- $index, $socket, $parent, $ipaddr, $mobile
- );
- }
- public function listen( $null = null, $ipc = 0 )
- {
- $read = $this->socket;
- Foreach ( $this->users as $user )
- {
- $read[ ] = $user->sock;
- } //$this->users as $user
- $except = $read;
- If ( @socket_select( $read, $null, $except, null ) < 1 )
- {
- continue;
- } //@socket_select( $read, $null, $except, null ) < 1
- Foreach ( $this->socket as $i => $psock )
- {
- If ( in_Array( $psock, $read ) )
- {
- switch ( (int) $i )
- {
- case 0:
- $socket = socket_accept( $psock );
- socket_set_nonblock($socket);
- If ( !is_resource( $socket ) || count( $this->users ) >= $this->config->max_total )
- {
- @socket_close( $socket );
- break;
- } //!is_resource( $socket ) || count( $this->users ) >= $this->config->max_total
- socket_getpeername( $socket, $ip );
- Foreach ( $this->users as $user )
- {
- If ( $user->ipaddr == $ip )
- {
- $ipc++;
- } //$user->ipaddr == $ip
- } //$this->users as $user
- If ( $ipc > $this->config->max_per_ip || in_Array( $ip, $this->ipbans ) )
- {
- Foreach ( $this->users as $user )
- {
- If ( $user->ipaddr == $ip )
- {
- $this->disconnect( $user->index );
- } //$user->ipaddr == $ip
- } //$this->users as $user
- break;
- } //$ipc > $this->config->max_per_ip || in_Array( $ip, $this->ipbans )
- do
- {
- $index = $this->mysql->rand();
- } while ( Isset( $this->users[ $index ] ) );
- $this->users[ $index ] = new client( $socket, $this, $index, $ip );
- break;
- case 1:
- $this->socket[ ] = socket_accept( $psock );
- break;
- } //(int) $i
- } //in_Array( $psock, $read )
- } //$this->socket as $i => $psock
- If ( !is_Array( $except ) )
- {
- $except = Array( );
- } //!is_Array( $except )
- Foreach ( $this->users as $index => $user )
- {
- If ( in_Array( $user->sock, $except ) || !$user->sock )
- {
- unset( $this->users[ $index ] );
- } //in_Array( $user->sock, $except ) || !$user->sock
- ElseIf ( in_Array( $user->sock, $read ) )
- {
- $input = '';
- while(@socket_recv($user->sock, $buf, (2048 * 2048), 0) >= 1)
- {
- $input .= $buf;
- }
- If ( trim( $input ) == '' || ord( substr( $input, 0, 1 ) ) == 136 )
- {
- unset( $this->users[ $index ] );
- continue;
- } //trim( $input ) == '' || ord( substr( $input, 0, 1 ) ) == 136
- ElseIf ( substr_count( $input, chr( 0 ) ) <= 1 )
- {
- $this->handle( $input, $user );
- } //substr_count( $input, chr( 0 ) ) <= 1
- } //in_Array( $user->sock, $read )
- } //$this->users as $index => $user
- }
- public function resetDetails($id, $bans = null) {
- $user = $this->parent->mysql->fetch_array("select * from `users` where `id`='{$this->parent->mysql->sanatize($id)}' and `id` not in(0, 2);");
- if (empty($user)) {
- $this->guest = true;
- } else {
- if ($user[0]['username'] == '') {
- list($this->guest, $this->k, $this->k2, $this->k3) = array(
- true, $user[0]['k'], $user[0]['k2'], $user[0]['k3']
- );
- } else {
- $this->xats = $user[0]['xats'];
- $this->days = floor(($user[0]['days'] - time()) / (24 * 3600) + 0.3) >= 1 ? floor(($user[0]['days'] - time()) / (24 * 3600) + 0.3) : 0;
- $this->username = $user[0]['username'];
- $this->password = $user[0]['password'];
- $this->enabled = $user[0]['enabled'];
- $this->k = $user[0]['k'];
- $this->k2 = $user[0]['k2'];
- $this->k3 = $user[0]['k3'];
- $this->PowerO = $user[0]['dO'];
- $this->powers = $user[0]['powers'];
- $this->avatar = $user[0]['avatar'];
- $this->url = $user[0]['url'];
- $this->d1 = 0;
- $this->d2 = $user[0]['d2'];
- $this->bride = $user[0]['bride'];
- $this->d3 = null;
- $this->pawn = $user[0]['custpawn'] == 'off' ? '' : $user[0]['custpawn'];
- if ($this->mobile) {
- $this->nickname = $this->username == '' ? 'Unregistered' : $this->username;
- } else {
- $this->nickname = explode("##", $user[0]['nickname'], 2);
- $this->nickname[0] = htmlspecialchars_decode($this->nickname[0]);
- $this->nickname = count($this->nickname) > 1 ? implode("##", $this->nickname) : $this->nickname[0];
- }
- if (true || $user[0]['torched'] != 1) { // Torching - Add Later
- if (!$this->getPowers()) {
- return false;
- }
- $this->dO = $user[0]['dO'];
- }
- $this->dt = null;
- $this->guest = false;
- }
- $trolls = json_decode($user[0]['trolls'], true);
- if (is_array($trolls)) {
- foreach ($trolls as $i => $u) {
- $this->{$i} = $u;
- }
- }
- }
- if ($this->guest === true) {
- $this->username = '';
- }
- return true;
- }
- public function getPowers($pV = array()) {
- if ($this->days < 1)
- {
- for ($i = 0; $i <= $this->parent->config->pcount; $this->{'p' . $i++} = 0);
- return true;
- }
- $powers = $this->parent->mysql->fetch_array('select * from `userpowers` where `userid`=' . $this->id . ';');
- $powerv = $this->parent->mysql->fetch_array('select `id`, `section`, `subid` from `powers` where `name` not like \'%(Undefined)%\';');
- $pv = $test = $final = array();
- foreach ($powerv as $power) {
- $pv[$power['id']] = array('sect' => $power['section'], 'sub' => (int) $power['subid']);
- $test[$power['section']] = 0;
- $last[$power['section']] = 0;
- }
- foreach ($powers as $power) {
- $test[$pv[$power['powerid']]['sect']] += $pv[$power['powerid']]['sub'];
- }
- foreach ($test as $sect => $val) {
- if ((int) $val != (int) $this->{$sect . 'v'}) {
- return false;
- }
- }
- foreach ($powers as $power) {
- if (isset($pv[$power['powerid']])) {
- $power = $pv[$power['powerid']];
- if ((int) $this->{$power['sect'] . 'v'} & $test[$power['sect']]) {
- if (!((int) $power['sub'] & $test[$power['sect']])) {
- return false;
- }
- if (!($this->{'m' . substr($power['sect'], 1)} & (int) $power['sub'])) {
- $last[$power['sect']] += (int) $power['sub'];
- }
- }
- }
- }
- $this->pStr = '';
- foreach ($test as $sect => $u) {
- $this->{$sect} = $last[$sect];
- $this->pStr .= $sect . '="' . $this->{$sect} . '" ';
- }
- return true;
- }
- public function updateDetails() {
- $upowers = $this->parent->mysql->fetch_array('select * from `userpowers` where `userid`=' . $this->id . ';');
- $spowers = $this->parent->mysql->fetch_array('select * from `powers` where `name` not like \'%(Undefined)%\';');
- $vals = array();
- $p = array();
- $powerO = '';
- foreach ($spowers as $power)
- {
- $vals[$power['id']] = array($power['section'], $power['subid']);
- $p[$power['section']] = 0;
- }
- foreach ($upowers as $power)
- {
- if ($power['count'] >= 1 && isset($vals[$power['powerid']]) && isset($p[$vals[$power['powerid']][0]]))
- {
- $str = $power['powerid'] . '=' . ($power['count'] > 1 ? ($power['count'] - 1) : 1) . '|';
- $p[$vals[$power['powerid']][0]] += $vals[$power['powerid']][1];
- if ($power['count'] > 1) {
- $powerO .= $str;
- }
- }
- }
- if ($this->id != 0 && $this->id != 2 && $this->mobile == false) {
- $this->parent->mysql->query(
- "update `users` set
- `nickname`='{$this->parent->mysql->sanatize($this->nickname)}',
- `avatar`='{$this->parent->mysql->sanatize($this->avatar)}',
- `url`='{$this->parent->mysql->sanatize($this->url)}',
- `dO`='{$this->parent->mysql->sanatize($powerO)}',
- `connectedlast`='{$this->ipaddr}'
- where `id`='{$this->parent->mysql->sanatize($this->id)}';"
- );
- }
- return ($this->id != 0 && $this->id != 2) ? true : false;
- }
- public function hasPower($power) {
- list($subid, $section) = array(
- pow(2, $power % 32),
- $power >> 5
- );
- return $this->{'p' . $section} & $subid ? true : false;
- ;
- }
- public function authenticate($packet) {
- //print_r($packet->Attributes());
- /* Load Packet Information */
- /* Load Packet / Values */
- $attributes = array('u', 'N', 'k', 'pool', 'f', 'auth1', 'auth2', 'h', 'd0', 'a', 'c', 'banned', 'r');
- for ($i = 0; $i <= $this->parent->config->pcount; $i++) {
- array_push($attributes, 'd' . ($i + 4));
- array_push($attributes, 'm' . $i);
- }
- $info = $this->getMultiAttr($packet, $attributes);
- for ($i = 0; $i <= $this->parent->config->pcount; $i++) {
- $this->{'p' . $i . 'v'} = (int) $info['d' . ($i + 4)];
- $this->{'m' . $i} = (int) $info['m' . $i];
- }
- /* End */
- $this->id = (string) $info['u'];
- $this->d0 = (integer) $info['d0'];
- $this->f = (integer) $info['f'];
- $n = (string) $info['N'];
- $k = (integer) $info['k'];
- $pool = $this->pool;
- if ($this->mobile) {
- $this->f |= 0x0200;
- }
- $this->b = $this->f & 8 ? true : false;
- $chat = (int) $info['c'];
- if ($this->days < 1)
- {
- for ($i = 0; $i <= $this->parent->config->pcount; $i++)
- {
- $this->pStr .= 'p' . $i . '="0" ';
- }
- } else {
- for ($i = 0; $i <= $this->parent->config->pcount; $i++)
- {
- $this->{'p' . $i . 'v'} = isset($info['d' . ($i + 4)]) ? $info['d' . ($i + 4)] : 0;
- $this->{'m' . $i} = isset($info['m' . $i]) ? $info['m' . $i] : 0;
- $this->pStr .= 'p' . $i . '="' . $this->{'p' . $i . 'v'} . '" ';
- }
- }
- /* End */
- /* Reset details, Check powers */
- if (!$this->resetDetails($this->id)) {
- return false;
- }
- $this->url = (string) $info['h'];
- $this->avatar = (string) $info['a'];
- $xInfo = $this->parent->mysql->fetch_Array( "select * from `chats` where `id`='{$this->parent->mysql->sanatize($chat)}';" );
- if(isset($xInfo)){
- $pBot = $this->parent->mysql->fetch_Array( "select * from `chat_powers` where `chat`='{$this->parent->mysql->sanatize($xInfo[0]['name'])}' and power=150;" );
- }
- /* End */
- /* Bot Protection */
- if (!$this->mobile) {
- $this->bot1 = (int) $info['auth1'];
- $this->bot2 = (int) $info['auth2'];
- $bot2 = floor(pow(2, $this->loginShift % 27));
- $bot1 = floor(2 << ($this->loginKey % 94)) % $this->loginTime + $this->loginKey;
- if ($bot1 != $this->bot1 || $bot2 != $this->bot2) {
- return false;
- }
- }
- /* End */
- /* Chat Password [get main] */
- if ($info['r'] !== false) {
- $this->chatPass = $info['r'];
- }
- /* Sanatize Name / Explode Status */
- $this->nickname = $this->getAttribute($packet, 'n');
- $this->nickname = explode('##', $this->nickname, 2);
- if (count($this->nickname) > 1) {
- $this->nickname[1] = htmlspecialchars(str_replace("", "", $this->nickname[1]));
- $this->nickname = implode('##', $this->nickname);
- } else {
- $this->nickname = $this->nickname[0];
- }
- if (strlen($this->nickname) > 255) {
- //return false;
- }
- /* End */
- /* Just some information checking for guest system, + user exists */
- if ($this->guest == true && isset($this->enabled) && $this->id != 2) {
- return false;
- } elseif ($this->id != 2 && is_numeric($k)) {
- $user = $this->parent->mysql->fetch_array("select * from `users` where `id`='{$this->parent->mysql->sanatize($this->id)}' and `k`='{$this->parent->mysql->sanatize($k)}' and `id`!='' and `k`!='';");
- if (empty($user)) {
- return false;
- } elseif ($user[0]['username'] == 'Unregistered') {
- $this->guest = true;
- } else {
- $this->guest = false;
- }
- } else {
- $this->guest = true;
- }
- /* End */
- $this->updateDetails();
- $this->authenticated = true;
- return $this->joinRoom($chat, 1, false, $pool);
- }
- public function getAttribute($xml, $name) {
- if (method_exists($xml, 'attributes')) {
- foreach ($xml->attributes() as $a => $b) {
- if ($a == $name)
- return (string) $b;
- }
- }
- return false;
- }
- public function getMultiAttr($xml, $names = array(), $values = array()) {
- setType($names, 'array');
- if (!method_exists($xml, 'attributes')) {
- return array();
- }
- foreach ($names as $u) {
- $values[$u] = false;
- }
- foreach ($xml->attributes() as $i => $u) {
- if (in_array($i, $names)) {
- $values[$i] = mb_convert_encoding((string) $u, "utf-8");
- }
- }
- return $values;
- }
- public function message($t, $ex = true) {
- $this->sendMessage($t, $this->id, 0, false, $ex);
- }
- public function sendMessage($t, $u = '[C]', $i = 0, $s = false, $ex = false) {
- if ($u == '[C]')
- $u = $this->id;
- $packet = "<m t=\"{$t}\" u=\"{$u}\" i=\"{$i}\" />";
- $ex != false ? $this->sendRoom($packet, $ex) : $this->sendPacket($packet);
- }
- public function sendPacket($packet) {
- if ($this->sock) {
- if ($this->mobile == true) {
- $packet = simplexml_load_string($packet);
- if (!method_exists($packet, 'getName')) {
- $this->parent->disconnect($this->sock);
- return false;
- }
- $json = new stdClass();
- $json->tag = $packet->getName();
- foreach ($packet->Attributes() as $i => $u) {
- $json->{$i} = (string) $u;
- }
- $packet = json_encode($json);
- $packet = $this->parent->mask($packet);
- } elseif (substr($packet, -1) != chr(0)) {
- $packet .= chr(0);
- }
- // socket_set_nonblock($this->sock);
- if (!@socket_write($this->sock, $packet, strlen($packet))) {
- $this->parent->disconnect($this->sock);
- return false;
- }
- // socket_set_block($this->sock);
- return true;
- }
- }
- public function sendAll($packet) {
- if (stristr($packet, strlen($packet) - 1, 1) != chr(0)) {
- $packet = $packet . chr(0);
- }
- foreach ($this->parent->users as &$user) {
- if (!@socket_write($user->sock, $packet, strlen($packet))) {
- $this->parent->disconnect($user->index);
- }
- }
- return true;
- }
- public function parseRank($rank) {
- $ranks = array(1, 2, 3, 4, 5);
- if (!is_numeric($rank)) {
- switch (strtolower($rank)) {
- case 'guest': return 5;
- case 'owner': return 4;
- case 'member': return 3;
- case 'moderator': return 2;
- case 'mainowner': return 1;
- default: return 0;
- }
- } elseif (!in_array($rank, $ranks)) {
- return 0;
- }
- return $rank;
- }
- public function rank($numrank, $word = null, $compare = null) { // Made this for the hell of it
- $ranks = array(
- 5 => array(5, 'guest'),
- 3 => array(4, 'member'),
- 2 => array(3, 'moderator'),
- 4 => array(2, 'owner'),
- 1 => array(1, 'mainOwner')
- );
- if (!in_array($numrank, $ranks)) {
- $rank = $ranks[5];
- } else {
- $rank = $ranks[$numrank];
- }
- return is_null($compare) ? (is_null($word) ? $rank[0] : $rank[1]) : ($rank[0] < $ranks[$compare][0] ? true : false);
- }
- public function __destruct() {
- /* It's done like this to avoid a bitch of a memory leak */
- if (isset($this->id) && !isset($this->noLogout)) {
- $this->sendRoom('<l u="' . $this->id . '" />', true);
- }
- }
- public function joinRoom($chat, $reload = true, $nodup = false, $pool = 0, $banTick = 0) {
- /* Initial Information */
- list($this->pool, $this->hidden) = array($pool, false);
- if (!$this->authenticated || !is_numeric($chat) || $chat < 1) {
- return false;
- }
- $chat = $this->parent->mysql->fetch_array("select * from `chats` where `id`='{$this->parent->mysql->sanatize($chat)}';");
- if (empty($chat)) {
- return false;
- }
- list($this->chatid, $this->group) = array($chat[0]['id'], $chat[0]['name']);
- /* Do Ranks */
- $ranks = $this->parent->mysql->fetch_array("select * from `ranks` where `chatid`='{$chat[0]['id']}' and `userid`='{$this->parent->mysql->sanatize($this->id)}';");
- if ($this->chatPass !== false) {
- if ($this->parent->mysql->validate($this->chatPass, $chat[0]['pass']) === true) {
- if (empty($ranks)) {
- $this->parent->mysql->query("insert into `ranks`(`userid`, `chatid`, `f`) values({$this->id}, {$this->chatid}, 1);");
- } else {
- $this->parent->mysql->query("update `ranks` set `f`=1 where `userid`={$this->id} and `chatid`={$this->chatid};");
- }
- $ranks[0] = array(
- 'userid' => $this->id,
- 'chatid' => $this->chatid,
- 'f' => 1,
- 'tempend' => 0
- );
- }
- }
- if (!isset($ranks[0]['f'])) {
- $ranks[0] = array('f' => 5);
- $this->parent->mysql->query("insert into `ranks` (`userid`, `chatid`, `f`) values ('{$this->parent->mysql->sanatize($this->id)}', '{$chat[0]['id']}', '5');");
- } elseif ($ranks[0]['tempend'] > 0 && $ranks[0]['tempend'] < time()) {
- $ranks[0] = array("f" => 3);
- $this->parent->mysql->query("update `ranks` set `f`=3, `tempend`=0 where `userid`={$this->id} and `chatid`={$this->chatid};");
- } else {
- $userRank = $ranks[0]['f'];
- $this->rExpire = $ranks[0]['tempend'] > time() ? $ranks[0]['tempend'] : 0;
- }
- $this->rank = $ranks[0]['f'];
- if ($this->hasPower(29) && !$this->online && in_array($this->rank & 7, array(1, 4))) {
- $this->hidden = true;
- if (!($this->f & 0x0400)) {
- $this->f += 0x0400;
- }
- } elseif ($this->f & 0x0400) {
- $this->f -= 0x0400;
- }
- $this->updateDetails();
- $this->resetDetails($this->id, true);
- /* End */
- /* Update / Check Bans */
- $game = '';
- $this->banned = 0;
- $this->unban = false;
- $ban = $this->parent->mysql->fetch_array("select * from `bans` where `userid`='{$this->parent->mysql->sanatize($this->id)}' and `chatid`='{$this->parent->mysql->sanatize($chat[0]['id'])}' or `ip`='{$this->ipaddr}' and `chatid`='{$this->parent->mysql->sanatize($this->chatid)}' order by `unbandate` desc limit 0,1;");
- if (!empty($ban) && ($this->id == $ban[0]['userid'] || $this->ipaddr == $ban[0]['ip'])) {
- $ban = $ban[0];
- if ($ban['unbandate'] >= $this->loginTime) {
- if (substr($ban['type'], 0, 1) == 'w') {
- $this->rank = 16;
- $game = ' w="' . substr($ban['type'], 1) . '"';
- } elseif (substr($ban['type'], 0, 1) == 'r') {
- $this->rank |= (int) substr($ban['type'], 1);
- } elseif (substr($ban['type'], 0, 1) == 'f') {
- $this->f |= (int) substr($ban['type'], 1);
- } else {
- $this->rank = 16;
- }
- if (!($this->f & 0x8000)) { // desban do dunced
- $this->banned = $ban['unbandate'];
- }
- if (!($this->f & 0xFF)) { // desban do gag
- $this->banned = $ban['unbandate'];
- }
- } elseif ($this->id == $ban['userid']) {
- $this->unban = true;
- $this->parent->mysql->query("delete from `bans` where `userid`='{$this->parent->mysql->sanatize($this->id)}' and `chatid`='{$this->parent->mysql->sanatize($chat[0]['id'])}' and `unbandate`<={$this->loginTime};");
- }
- } elseif (empty($ban) && $this->b == true) {
- $this->unban = true;
- } elseif (isset($ban['unbandate'])) {
- $this->sendPacket("<n t=\"You are banned for " . round(($ban['unbandate'] - time()) / 60, 1) . " more minutes.\" />");
- }
- /* End */
- /* Chat Information */
- if (empty($chat[0]['attached'])) {
- $chat[0]['attached'] = array('Lobby', '1');
- } else {
- $info = $this->parent->mysql->fetch_array("select * from `chats` where `name`='{$this->parent->mysql->sanatize($chat[0]['attached'])}';");
- if (empty($info) || $info[0]['id'] == $chat[0]['id']) {
- $chat[0]['attached'] = array('Lobby', '1');
- } else {
- $chat[0]['attached'] = array(
- 0 => $info[0]['name'],
- 1 => $info[0]['id']
- );
- }
- }
- if ($chat[0]['attached'][1] == $this->chatid) {
- $chat[0]['attached'] = array('0', '0');
- }
- if ($this->unban == true) {
- $this->sendPacket('<c u="0" d="' . $this->id . '" t="/u" />');
- $this->unban = false;
- }
- $pawn = strlen($this->pawn) == 6 ? ' pawn="' . $this->pawn . '"' : '';
- $this->sendPacket("<i{$pawn}{$game} b=\"{$chat[0]['bg']};={$chat[0]['attached'][0]};={$chat[0]['attached'][1]};=;={$chat[0]['radio']};={$chat[0]['button']}\" f=\"{$this->f}\" ".($this->days >= 1 ? 'v="3"' : 'v="1"')." r=\"{$this->rank}\" cb=\"10\" />");
- $pRankpool = $this->parent->mysql->fetch_Array( "SELECT * FROM `chat_powers` WHERE `chat`='" . $this->group . "' AND `power`=114;" );
- $pBanpool = $this->parent->mysql->fetch_Array( "SELECT * FROM `chat_powers` WHERE `chat`='" . $this->group . "' AND `power`=126;" );
- If ( !count( $pRankpool ) == 0 )
- $this->sendPacket( '<w v="'.$pool.' 0 1" />' );
- If ( !count( $pRankpool ) == 0 && !count( $pBanpool ) == 0 )
- $this->sendPacket( '<w v="'.$pool.' 0 2 1" />' );
- // $this->sendPacket('<w v="'.$pool.' ' . $chat[0]['pool'] . '" />');
- $this->sendPacket($this->buildGp());
- // $this->sendPacket('<gp p="0|0|1431372864|1074025493|273678340|268435456|16384|1|0|0|0|0|0|" g80="{\'mg\':\'0\',\'mb\':\'11\',\'kk\':\'0\',\'bn\':\'0\',\'ubn\':\'0\',\'prm\':\'0\',\'bge\':\'0\',\'mxt\':50,\'sme\':\'11\',\'dnc\':\'8\'}" g114="{\'m\':\'' . $chat[0]['chat'] . '\',\'t\':\'' . $chat[0]['mods'] . '\',\'rnk\':\'7\',\'b\':\'' . $chat[0]['banned'] . '\',\'v\':1}" g90="' . $chat[0]['badword'] . '" g74="' . $chat[0]['smiles'] . '" g106="' . $chat[0]['gback'] . '" g188="a91" g100="' . $chat[0]['link'] . '" u="1" />');
- //@$this->sendPacket('<gp g80="{\'mg\':\'0\',\'mb\':\'11\',\'kk\':\'0\',\'bn\':\'0\',\'ubn\':\'0\',\'prm\':\'0\',\'bge\':\'0\',\'mxt\':50,\'sme\':\'11\',\'dnc\':\'8\'}" g114="{\'m\':\'' . $chat[0]['chat'] . '\',\'t\':\'' . $chat[0]['mods'] . '\',\'rnk\':\'7\',\'b\':\'' . $chat[0]['banned'] . '\',\'v\':1}" g90="' . $chat[0]['badword'] . '" g74="' . $chat[0]['gline'] . '" g106="' . $chat[0]['gback'] . '" g188="a91" g100="' . $chat[0]['link'] . '" p="0|0|1431372864|1074025493|273678340|268435456|16384|1|0|0|0|0|0|" />'); /* End */
- /* Check if user is already on chat */
- if ($nodup == false) {
- while ($r = $this->parent->getUserByID((int) $this->id, (int) $chat[0]['id'])) {
- if (is_object($r) && $r->online === true) {
- $r->sendPacket("<dup />");
- $r->noLogout = true;
- $this->parent->disconnect($r->index, true);
- }
- }
- }
- /* End */
- /* Compile, and send user list */
- $this->chat = $chat[0]['id'];
- $myNick = explode("##", $this->nickname, 2);
- $myNick[0] = htmlspecialchars(html_entity_decode(htmlspecialchars_decode($myNick[0])));
- $myNick = count($myNick) > 1 ? implode("##", $myNick) : $myNick[0];
- $myPack = "<u{$pawn} so=\"1\" f=\"{$this->f}\" flag=\"{$this->f}\" rank=\"{$this->rank}\" u=\"{$this->id}\" ".($this->days >= 1 ? ' q="3"' : ' q="1"') . ($this->username == '' ? '' : " N=\"{$this->username}\"") . " n=\"{$myNick}\" a=\"{$this->avatar}\" h=\"{$this->url}\" d0=\"{$this->d0}\" d2=\"{$this->d2}\" bride=\"{$this->bride}\" {$this->pStr}v=\"1\" />";
- $valid = simplexml_load_string($myPack);
- if (!method_exists($valid, 'getName')) {
- return false;
- } else {
- foreach ($this->parent->users as $user) {
- if ($this->mobile == true && $user->mobile == true && $user->ipaddr == $this->ipaddr && $user->username != $this->username) {
- $this->parent->disconnect($user->index);
- }
- if ($user->chat == $chat[0]['id'] && $user->id != $this->id && $user->pool == $this->pool) {
- if (!in_array($user->id, array(0, 2)) && $user->hidden == false) {
- $user->bride = $user->d2 == 0 ? null : $user->d2;
- $nick = explode('##', $user->nickname, 2);
- $nick[0] = htmlspecialchars(html_entity_decode(htmlspecialchars_decode($nick[0])));
- $nick = count($nick) > 1 ? implode('##', $nick) : $nick[0];
- $pawn = strlen($user->pawn) == 6 ? ' pawn="' . $user->pawn . '"' : '';
- $packet = "<u{$pawn} flag=\"{$user->f}\" s=\"1\" f=\"{$user->f}\" rank=\"{$user->rank}\" u=\"{$user->id}\" ".($user->days >= 1 ? ' q="3"' : ' q="1"') . ($user->username == '' ? '' : " N=\"{$user->username}\"") . " n=\"{$nick}\" a=\"{$user->avatar}\" h=\"{$user->url}\" d0=\"{$user->d0}\" d2=\"{$user->d2}\" bride=\"{$user->bride}\" {$user->pStr}v=\"1\" />";
- $valid = simplexml_load_string($packet);
- if (method_exists($valid, 'getName')) {
- $this->sendPacket($packet);
- } else {
- $this->parent->disconnect($user->index);
- continue;
- }
- }
- if (!in_array($this->id, array(0, 2)) && $this->hidden == false) {
- $user->sendPacket($myPack);
- }
- }
- }
- }
- /* End */
- /* Send Previous Messages (15) */
- if ($reload == true) {
- $messages = $this->parent->mysql->fetch_array("select * from `messages` where `id`='{$chat[0]['id']}' and `pool`={$this->pool} order by time desc limit 0,15;");
- for ($i = 0; $i < count($messages); $i++) {
- $message = $messages[count($messages) - $i - 1];
- if ($message['visible'] == '1') {
- $this->sendPacket("<m u=\"{$message['uid']}\" n=\"{$message['name']}\" N=\"{$message['registered']}\" a=\"{$message['avatar']}\" i=\"{$message['mid']}\" t=\"{$message['message']}\" s=\"1\" />");
- }
- }
- unset($messages);
- unset($message);
- }
- /* End */
- $this->sendPacket("<done />");
- /* Other info, scrollies, protection meh */
- $this->sendPacket("<m u=\"{$chat[0]['ch']}\" t=\"/s{$chat[0]['sc']}\" />");
- if (isset($this->parent->protected[$this->chat])) {
- $time = floor(($this->parent->protected[$this->chat]['end'] - time()) / 60);
- switch ($this->parent->protected[$this->chat]['type']) {
- case 'noguest':
- $this->sendPacket("<z d=\"0\" u=\"0\" t=\"This chat is protected for another {$time} minutes. Guests cannot chat until given a higher rank.\" />");
- break;
- case 'unreg':
- $this->sendPacket("<z d=\"0\" u=\"0\" t=\"This chat is protected for another {$time} minutes. Unregistered users cannot chat until given a higher rank.\" />");
- break;
- }
- } elseif ($this->f & 1 && 1 == 2) {
- $this->sendPacket("<logout e=\"E12\" />");
- }
- $this->online = true;
- /* End */
- return true;
- }
- public function buildGp( )
- {
- $gdata = $this->parent->mysql->fetch_Array( "SELECT * FROM `chats` WHERE `name`='" . $this->group . "';" );
- $pBad = $this->parent->mysql->fetch_Array( "SELECT * FROM `chat_powers` WHERE `chat`='" . $this->group . "' AND `power`=90;" );
- $pAnnounce = $this->parent->mysql->fetch_Array( "SELECT * FROM `chat_powers` WHERE `chat`='" . $this->group . "' AND `power`=112;" );
- $pGback = $this->parent->mysql->fetch_Array( "SELECT * FROM `chat_powers` WHERE `chat`='" . $this->group . "' AND `power`=130;" );
- $pGline = $this->parent->mysql->fetch_Array( "SELECT * FROM `chat_powers` WHERE `chat`='" . $this->group . "' AND `power`=74;" );
- $gp = "<gp ";
- $gp .= "p=\"0|0|1431655744|1079334229|290459972|269549572|16645|272646145|4194305|0|0|0|0|\" ";
- $gp .= "g80=\"{'mm':'14','mbt':48,'ss':'14','prm':'14','dnc':'14','bdg':'8'}\" ";
- $gp .= "g148=\"{'ef':'0','bk':'0','col':'','v':'32'}\" ";
- If ( !count( $pBad ) == 0 )
- $gp .= "g90=\"{$gdata[0]['bad']}\" ";
- If ( !count( $pAnnounce ) == 0 )
- {
- $gp .= "g112=\"{$gdata[0]['announce']}\" ";
- } //!count( $pAnnounce ) == 0
- $gp .= "g246=\"{'dt':70,'v':1}\" ";
- $gp .= "g256=\"{'rnk':'2','dt':65,'rt':15,'rc':'1','tg':200,'v':1}\" ";
- //$gp .= "g278=\"{'ef':'0','bk':'0','v':1}\" ";
- If ( $gdata[ 0 ][ 'pools' ] != null )
- {
- $gp .= "g114=\"{'m':'{$gdata[0]['rankpool']}','t':'{$gdata[0]['staffpool']}','rnk':'7','b':'{$gdata[0]['banned']}','v':2}\" ";
- } //$gdata[ 0 ][ 'pools' ] != null
- $gp .= "g100=\"{$gdata[0]['link']}\" ";
- If ( !count( $pGline ) == 0 )
- $gp .= "g74=\"{$gdata[0]['gline']}\" ";
- If ( !count( $pGback ) == 0 )
- $gp .= "g106=\"{$gdata[0]['gback']}\" ";
- $gp .= "/>";
- return $gp;
- }
- public function sendRoom($packet, $passme = false, $exclude = 0) {
- foreach ($this->parent->users as $user) {
- if (
- $user->chat == $this->chat &&
- $user->id != $exclude &&
- (
- isset($user->pool) &&
- isset($this->pool) &&
- $user->pool == $this->pool
- )
- ) {
- if ($user->id != $this->id || $passme == false) {
- $user->sendPacket($packet);
- }
- }
- }
- }
- }
- 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; // Cause I can put it there if I want to
- }
- public function connected() {
- return @mysqli_ping($this->link) ? true : false;
- }
- public function error($error) {
- print $error . chr(10);
- if ($this->doe == true) {
- exit('line:' . __LINE__);
- }
- }
- 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);
- }
- public function rand($length = 32, $low = true, $upp = true, $num = true, $indent = false) {
- $chars = array_merge(
- $low ? range('a', 'z') : array(), $upp ? range('A', 'Z') : array(), $num ? range('0', '9') : array()
- );
- for ($rand = ""; strlen($rand) < $length; $rand .= $chars[array_rand($chars)])
- ;
- if ($indent != false) {
- $rand = implode('-', str_split($rand, $indent));
- }
- return $rand;
- }
- static function urs($x, $y) {
- return ($x >> $y) & (2147483647 >> ($y - 1));
- }
- public function hash($str, $rawsalt = '', $hash = 'sha512') {
- if ($rawsalt == '') {
- $rawsalt = $this->rand(((strlen($str) % 3) + 1) * 5);
- }
- $loc = array(hash('sha1', $rawsalt), hash('sha1', $str), '');
- foreach (str_split($loc[0], 1) as $index => $character) {
- $loc[2] .= $character . $loc[1][$index];
- }
- $hash = hash($hash, $loc[2]);
- return substr_replace($hash, $rawsalt, (strlen($str) << 2) % strlen($hash), 0);
- }
- public function validate($str, $hash, $engine = 'sha512') {
- $salt = substr($hash, (strlen($str) << 2) % strlen(hash($engine, 1)), ((strlen($str) % 3) + 1) * 5);
- return $this->hash($str, $salt, $engine) === $hash ? true : false;
- }
- public function hashPass($pass, $salt = null, $hashtype = 'sha512', $hash = "") {
- return $this->hash($pass, $salt, $hashtype);
- }
- public function checkPass($input, $real, $hash = 'sha512') {
- return $this->validate($input, $real, $hash);
- }
- }
Add Comment
Please, Sign In to add comment