/** * показ топа по пвп очкам * * @return void * @author NetSoul **/ function index() { $world = get_world(); $this->data['title'] = 'Топ голосов за смс'; include APPPATH . "config/mmotop.php"; $all_data = file_get_contents($config['logfile']); $rows = explode("\n", $all_data); $chars = array(); foreach ($rows as $row) { $cols = explode("\t", $row); if (isset($cols[3]) && $cols[3] !== '') { if ($cols[4] == 2) { $chars[] = iconv('UTF-8', 'CP1251', $cols[3]); } } } $top = array_count_values($chars); arsort($top); $i = 1; $this->table->set_heading('#', 'Имя персонажа'); foreach ($top as $key => $value) { $this->table->add_row($i, $key); $i++; if ($i > 100) { break; } } $this->data['content'] = $this->table->generate(); compile('', false); }
function getbonus() { if (!is_logged()) { redirect(base_url()); } include APPPATH . "config/evote.php"; $this->data['title'] = lang('off_vote'); $text = icon('64x64/chart_up.png') . '<h2>Голосование на TOP EMUDEV</h2><p>После голосования нажмите получить бонус.</p>'; $char = (int) office_secure($this->input->post('char')); if ($char <= 0) { redirect('evote'); } $query = $this->MSSQL->query("SELECT Name FROM " . get_world() . ".dbo.tbl_base WHERE Serial='{$char}'"); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $char = preg_name($row->Name); } //for } else { redirect('evote'); } # Генерация полной ссылки текущего года/месяца $FullLink = $config['logfile'] . md5(date("Ym")) . '.txt'; # Получение данных статистики $data = file_get_contents($FullLink); # Разбитие данных в строки массива $rows = explode("\r\n", $data); $find = 0; for ($i = 0; $i < count($rows) - 1; $i++) { $row = explode("\t", $rows[$i]); if ($row[3] == '') { continue; } if ($row[3] == $char) { if (!$this->_id_exits($row[0])) { $find++; $text .= br(1) . icon('32x32/accept.png') . 'Бонус выдан'; if ($row[4] == 0) { $summ = $config['normal']; } else { $summ = $config['sms']; } bonus_add(Get_AccountSerial(), $summ); $this->_accepted($row); } } } //for if ($find == 0) { $text .= br(1) . icon('32x32/delete.png') . 'Голос не найден'; } $this->data['content'] = $text; compile(); }
function change_race($serial, $sex) { $CI =& get_instance(); $CI->MSSQL->query("UPDATE " . get_world() . ".dbo.tbl_base SET Race ='{$sex}' WHERE Serial = '" . $serial . "'"); }
function _chararray($login = '') { $char = array(); $login = preg_name(office_secure($login)); $query = $this->MSSQL->query("SELECT Serial,Name FROM " . get_world() . ".dbo.tbl_base WHERE Account='{$login}' AND DCK=0"); if ($query->num_rows() > 0) { foreach ($query->result() as $row) { $char[$row->Serial] = $row->Name; } //for } else { return false; } //if return $char; }
function dataclear($serial) { if (!is_numeric($serial)) { redirect(base_url()); } if (config('dataclear', 'core') == FALSE) { redirect(base_url()); } if (is_online($serial) == FALSE) { redirect(base_url()); } if (!secure_serial_check($serial)) { redirect('#warn'); } $world = get_world(); if (is_online($serial) == FALSE) { $query = $this->MSSQL->query("SELECT Lv FROM {$world}.dbo.tbl_base WHERE Serial = '{$serial}'"); if ($query->num_rows() > 0) { $row = $query->row_array(); $now = $row['Lv']; $max = 50; if ($now < 50) { $max = 50; } elseif ($now == 50) { $max = 50; } elseif ($now <= 55 && $now >= 51) { $max = 55; } elseif ($now >= 56) { $max = 65; } $this->MSSQL->query("UPDATE {$world}.dbo.tbl_base SET Lv ='" . $row['Lv'] . "' WHERE Serial = '{$serial}'"); $this->MSSQL->query("UPDATE {$world}.dbo.tbl_general SET MaxLevel='{$max}' WHERE Serial = '{$serial}'"); //$this->MSSQL->query("DELETE {$world}.dbo.tbl_NpcData WHERE Serial = '$serial'"); } $this->data['content'] = icon('32x32/edit_profile.png') . lang('off_clearsucc'); } else { $this->data['content'] = icon('64x64/warning.png') . lang('off_online_chk'); } compile(); }
function query_config($name) { $CI =& get_instance(); $CI->config->load("query", FALSE, TRUE); $query = config($name); $user = get_user(); $world = get_world(); $query = str_replace("{user}", $user, $query); $query = str_replace("{world}", $world, $query); return $query; }