/** * calculate creature health, mana and armor * * kinda crappy way, but works * * if $type is used: * 1 -> returns health * 2 -> returns mana * 3 -> returns armor * 0 -> returns array(health,mana,armor) */ function get_additional_data($entryid, $type = 0) { global $world_db, $realm_id; if (!is_numeric($entryid)) { return array(0, 0, 0); } $sqlw = new SQL(); $sqlw->connect($world_db[$realm_id]['addr'], $world_db[$realm_id]['user'], $world_db[$realm_id]['pass'], $world_db[$realm_id]['name']); $q = $sqlw->query("\n\t\tSELECT \n\t\t\t(SELECT unit_class \n\t\t\tFROM creature_template \n\t\t\tWHERE entry = " . $entryid . ") AS class, \n\t\t\t\t(SELECT FLOOR(minlevel + (RAND() * (maxlevel - minlevel + 1))) \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ") AS level, \n\t\t\t\t(SELECT exp \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ") AS exp;"); $data = $sqlw->fetch_assoc($q); if ($sqlw->num_rows($q) == 0) { return array(0, 0, 0); } $q = "\n\t\t\tSELECT \n\t\t\t\t((SELECT Health_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t\t*(SELECT basehp" . $data['exp'] . " \n\t\t\t\t\tFROM creature_classlevelstats \n\t\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5), \n\t\t\t\t((SELECT Mana_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t\t*(SELECT basemana \n\t\t\t\t\tFROM creature_classlevelstats \n\t\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5),\n\t\t\t\t((SELECT Armor_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t*(SELECT basearmor \n\t\t\t\tFROM creature_classlevelstats \n\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5);"; if ($type == 1) { $q = "\n\t\t\tSELECT \n\t\t\t\t((SELECT Health_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t\t*(SELECT basehp" . $data['exp'] . " \n\t\t\t\t\tFROM creature_classlevelstats \n\t\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5);"; } if ($type == 2) { $q = "\n\t\t\tSELECT \n\t\t\t\t((SELECT Mana_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t\t*(SELECT basemana \n\t\t\t\t\tFROM creature_classlevelstats \n\t\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5);"; } if ($type == 3) { $q = "\n\t\t\tSELECT \n\t\t\t\t((SELECT Armor_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t\t*(SELECT basearmor \n\t\t\t\t\tFROM creature_classlevelstats \n\t\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5);"; } $query = $sqlw->query($q); $result = $sqlw->fetch_row($query); $sqlw->close(); unset($sql); if ($type == 2 && $result[0] == 0.5) { return 0; } if ($type == 0 && $result[1] == 0.5) { return array($result[0], 0, $result[2]); } return $type > 0 ? $result[0] : $result; }
function show_list() { global $lang_global, $lang_banned, $output, $realm_db, $itemperpage, $action_permission, $user_lvl; valid_login($action_permission['read']); $sqlr = new SQL(); $sqlr->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $ban_type = isset($_GET['ban_type']) ? $sqlr->quote_smart($_GET['ban_type']) : "account_banned"; $key_field = $ban_type == 'account_banned' ? 'id' : 'ip'; //==========================$_GET and SECURE================================= $start = isset($_GET['start']) ? $sqlr->quote_smart($_GET['start']) : 0; if (is_numeric($start)) { } else { $start = 0; } $order_by = isset($_GET['order_by']) ? $sqlr->quote_smart($_GET['order_by']) : "{$key_field}"; if (!preg_match("/^[_[:lower:]]{1,12}\$/", $order_by)) { $order_by = "{$key_field}"; } $dir = isset($_GET['dir']) ? $sqlr->quote_smart($_GET['dir']) : 1; if (!preg_match("/^[01]{1}\$/", $dir)) { $dir = 1; } $order_dir = $dir ? "ASC" : "DESC"; $dir = $dir ? 0 : 1; //==========================$_GET and SECURE end============================= $fromwhere = $ban_type == 'account_banned' ? $ban_type . " WHERE active = '1'" : $ban_type; $query_1 = $sqlr->query("SELECT count(*) FROM {$fromwhere}"); $all_record = $sqlr->result($query_1, 0); $result = $sqlr->query("SELECT {$key_field}, bandate, unbandate, bannedby, SUBSTRING_INDEX(banreason,' ',3) FROM {$fromwhere} ORDER BY {$order_by} {$order_dir} LIMIT {$start}, {$itemperpage}"); $this_page = $sqlr->num_rows($result); $output .= "\r\n <center>\r\n <table class=\"top_hidden\">\r\n <tr>\r\n <td>"; if ($user_lvl >= $action_permission['insert']) { makebutton($lang_banned['add_to_banned'], "banned.php?action=add_entry\" type=\"wrn", 180); } if ($ban_type === "account_banned") { makebutton($lang_banned['banned_ips'], "banned.php?ban_type=ip_banned", 130); } else { makebutton($lang_banned['banned_accounts'], "banned.php?ban_type=account_banned", 130); } makebutton($lang_global['back'], "javascript:window.history.back()\" type=\"def", 130); $output .= "\r\n </td>\r\n <td align=\"right\">" . generate_pagination("banned.php?action=show_list&order_by={$order_by}&ban_type={$ban_type}&dir=" . !$dir, $all_record, $itemperpage, $start) . "</td>\r\n </tr>\r\n </table>\r\n <script type=\"text/javascript\">\r\n answerbox.btn_ok='{$lang_global['yes_low']}';\r\n answerbox.btn_cancel='{$lang_global['no']}';\r\n var del_banned = 'banned.php?action=do_delete_entry&ban_type={$ban_type}&{$key_field}=';\r\n </script>\r\n <table class=\"lined\">\r\n <tr>\r\n <th width=\"5%\">{$lang_global['delete_short']}</th>\r\n <th width=\"19%\"><a href=\"banned.php?order_by={$key_field}&ban_type={$ban_type}&dir={$dir}\"" . ($order_by == $key_field ? " class=\"{$order_dir}\"" : "") . ">{$lang_banned['ip_acc']}</a></th>\r\n <th width=\"18%\"><a href=\"banned.php?order_by=bandate&ban_type={$ban_type}&dir={$dir}\"" . ($order_by == 'bandate' ? " class=\"{$order_dir}\"" : "") . ">{$lang_banned['bandate']}</a></th>\r\n <th width=\"18%\"><a href=\"banned.php?order_by=unbandate&ban_type={$ban_type}&dir={$dir}\"" . ($order_by == 'unbandate' ? " class=\"{$order_dir}\"" : "") . ">{$lang_banned['unbandate']}</a></th>\r\n <th width=\"15%\"><a href=\"banned.php?order_by=bannedby&ban_type={$ban_type}&dir={$dir}\"" . ($order_by == 'bannedby' ? " class=\"{$order_dir}\"" : "") . ">{$lang_banned['bannedby']}</a></th>\r\n <th width=\"25%\"><a href=\"banned.php?order_by=banreason&ban_type={$ban_type}&dir={$dir}\"" . ($order_by == 'banreason' ? " class=\"{$order_dir}\"" : "") . ">{$lang_banned['banreason']}</a></th>\r\n </tr>"; while ($ban = $sqlr->fetch_row($result)) { if ($ban_type === "account_banned") { $result1 = $sqlr->query("SELECT username FROM account WHERE id ='{$ban['0']}'"); $owner_acc_name = $sqlr->result($result1, 0, 'username'); $name_out = "<a href=\"user.php?action=edit_user&error=11&id={$ban['0']}\">{$owner_acc_name}</a>"; } else { $name_out = $ban[0]; $owner_acc_name = $ban[0]; } $output .= "\r\n <tr>\r\n <td>"; if ($user_lvl >= $action_permission['delete']) { $output .= "\r\n <img src=\"img/aff_cross.png\" alt=\"\" onclick=\"answerBox('{$lang_global['delete']}: <font color=white>{$owner_acc_name}</font><br />{$lang_global['are_you_sure']}', del_banned + '{$ban['0']}');\" style=\"cursor:pointer;\" alt=\"\" />"; } $output .= "\r\n </td>\r\n <td>{$name_out}</td>\r\n <td>" . date('d-m-Y G:i', $ban[1]) . "</td>\r\n <td>" . date('d-m-Y G:i', $ban[2]) . "</td>\r\n <td>{$ban['3']}</td>\r\n <td>{$ban['4']}</td>\r\n </tr>"; } $output .= "\r\n <tr>\r\n <td colspan=\"6\" align=\"right\" class=\"hidden\">{$lang_banned['tot_banned']} : {$all_record}</td>\r\n </tr>\r\n </table>\r\n <br/>\r\n </center>"; }
function get_itemset_name($id, &$sqlm = 0) { global $mmfpm_db; if (empty($sqlm)) { $sqlm = new SQL(); $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); } $itemset = $sqlm->fetch_row($sqlm->query(' SELECT field_1 FROM dbc_itemset WHERE itemsetID = ' . $id . ' LIMIT 1')); return $itemset[0]; }
break; } $is_unsigned = FALSE; if (strpos($field->type, "unsigned")) { $is_unsigned = TRUE; } //we need some of the info generated in this loop later in the algorythm...save what we need to arrays $ina[$index] = $is_numeric; $inu[$index] = $is_unsigned; // next field $index++; } // remove last comma $field_list = rtrim($field_list, ', '); //parse out the table's data and generate the SQL INSERT statements in order to replicate the data itself... while ($row = SQL::fetch_row($result)) { $sql = 'INSERT INTO `' . $table_name . '` (' . $field_list . ') VALUES ('; for ($d = 0; $d < count($row); $d++) { if ($inu[$d] == TRUE) { $sql .= $row[$d]; } elseif ($ina[$d] == TRUE) { $sql .= intval($row[$d]); } else { $sql .= "'" . SQL::escape(strval($row[$d])) . "'"; } if ($d < count($row) - 1) { $sql .= ", "; } } $sql .= ");\n"; if ($compressed) {
function doupdate_referral($referredby, $user_id) { global $realm_db, $mmfpm_db, $characters_db, $realm_id; $sqlm = new SQL(); $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); $sqlc = new SQL(); $sqlc->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $sqlr = new SQL(); $sqlr->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $result = $sqlm->fetch_row($sqlm->query("SELECT InvitedBy FROM mm_point_system_invites WHERE PlayersAccount = '{$user_id}'")); $result = $result[0]; if ($result == NULL) { $referred_by = $sqlc->fetch_row($sqlc->query("SELECT guid FROM characters WHERE name = '{$referredby}'")); $referred_by = $referred_by[0]; if ($referred_by != NULL) { $char = $sqlc->fetch_row($sqlc->query("SELECT account FROM characters WHERE guid = '{$referred_by}'")); $result = $sqlr->fetch_row($sqlr->query("SELECT id FROM account WHERE id = '{$char}'")); $result = $result[0]; if ($result != $user_id) { $sqlm->query("INSERT INTO mm_point_system_invites (PlayersAccount, InvitedBy, InviterAccount) VALUES ('{$user_id}', '{$referred_by}', '{$result}')"); return true; } else { return false; } } } }
function edit() { global $lang_global, $lang_item_templ, $lang_item, $lang_item_edit, $output, $world_db, $realm_id, $item_datasite, $lang_id_tab, $quest_datasite, $action_permission, $user_lvl, $creature_datasite; wowhead_tt(); valid_login($action_permission['read']); if (!isset($_GET['entry'])) { redirect("item.php?error=1"); } $sql = new SQL(); $sql->connect($world_db[$realm_id]['addr'], $world_db[$realm_id]['user'], $world_db[$realm_id]['pass'], $world_db[$realm_id]['name']); $entry = $sql->quote_smart($_GET['entry']); $deplang = get_lang_id(); $result = $sql->query("SELECT `item_template`.`entry`,`class`,`subclass`,`unk0`,IFNULL(" . ($deplang != 0 ? "name_loc{$deplang}" : "NULL") . ",`name`) as name,`displayid`,`Quality`,`Flags`,`BuyCount`,`BuyPrice`,`SellPrice`,`InventoryType`,`AllowableClass`,`AllowableRace`,`ItemLevel`,`RequiredLevel`,`RequiredSkill`,`RequiredSkillRank`,`requiredspell`,`requiredhonorrank`,`RequiredCityRank`,`RequiredReputationFaction`,`RequiredReputationRank`,`maxcount`,`stackable`,`ContainerSlots`,`stat_type1`,`stat_value1`,`stat_type2`,`stat_value2`,`stat_type3`,`stat_value3`,`stat_type4`,`stat_value4`,`stat_type5`,`stat_value5`,`stat_type6`,`stat_value6`,`stat_type7`,`stat_value7`,`stat_type8`,`stat_value8`,`stat_type9`,`stat_value9`,`stat_type10`,`stat_value10`,`dmg_min1`,`dmg_max1`,`dmg_type1`,`dmg_min2`,`dmg_max2`,`dmg_type2`,`armor`,`holy_res`,`fire_res`,`nature_res`,`frost_res`,`shadow_res`,`arcane_res`,`delay`,`ammo_type`,`RangedModRange`,`spellid_1`,`spelltrigger_1`,`spellcharges_1`,`spellppmRate_1`,`spellcooldown_1`,`spellcategory_1`,`spellcategorycooldown_1`,`spellid_2`,`spelltrigger_2`,`spellcharges_2`,`spellppmRate_2`,`spellcooldown_2`,`spellcategory_2`,`spellcategorycooldown_2`,`spellid_3`,`spelltrigger_3`,`spellcharges_3`,`spellppmRate_3`,`spellcooldown_3`,`spellcategory_3`,`spellcategorycooldown_3`,`spellid_4`,`spelltrigger_4`,`spellcharges_4`,`spellppmRate_4`,`spellcooldown_4`,`spellcategory_4`,`spellcategorycooldown_4`,`spellid_5`,`spelltrigger_5`,`spellcharges_5`,`spellppmRate_5`,`spellcooldown_5`,`spellcategory_5`,`spellcategorycooldown_5`,`bonding`,`description`,`PageText`,`LanguageID`,`PageMaterial`,`startquest`,`lockid`,`Material`,`sheath`,`RandomProperty`,`RandomSuffix`,`block`,`itemset`,`MaxDurability`,`area`,`Map`,`BagFamily`,`TotemCategory`,`socketColor_1`,`socketContent_1`,`socketColor_2`,`socketContent_2`,`socketColor_3`,`socketContent_3`,`socketBonus`,`GemProperties`,`RequiredDisenchantSkill`,`ArmorDamageModifier`,`ScriptName`,`DisenchantID`,`FoodType`,`minMoneyLoot`,`maxMoneyLoot` FROM item_template LEFT JOIN locales_item ON item_template.entry = locales_item.entry WHERE item_template.entry = '{$entry}'"); if ($result) { $item = $sql->fetch_assoc($result); require_once "scripts/get_lib.php"; //$tooltip = get_item_tooltip($entry); $output .= "<script type=\"text/javascript\" src=\"libs/js/tab.js\"></script>\n <center>\n <br /><br /><br />\n <form method=\"post\" action=\"item.php?action=do_update\" name=\"form1\">\n <input type=\"hidden\" name=\"backup_op\" value=\"0\"/>\n <input type=\"hidden\" name=\"type\" value=\"edit\"/>\n <input type=\"hidden\" name=\"entry\" value=\"{$entry}\"/>\n\n<div class=\"jtab-container\" id=\"container\">\n <ul class=\"jtabs\">\n <li><a href=\"#\" onclick=\"return showPane('pane1', this)\" id=\"tab1\">{$lang_item_edit['general_tab']}</a></li>\n <li><a href=\"#\" onclick=\"return showPane('pane2', this)\">{$lang_item_edit['additional_tab']}</a></li>\n <li><a href=\"#\" onclick=\"return showPane('pane3', this)\">{$lang_item_edit['stats_tab']}</a></li>\n <li><a href=\"#\" onclick=\"return showPane('pane4', this)\">{$lang_item_edit['damage_tab']}</a></li>\n <li><a href=\"#\" onclick=\"return showPane('pane5', this)\">{$lang_item_edit['spell_tab']}</a></li>\n <li><a href=\"#\" onclick=\"return showPane('pane7', this)\">{$lang_item_edit['sock_tab']}</a></li>\n <li><a href=\"#\" onclick=\"return showPane('pane6', this)\">{$lang_item_edit['req_tab']}</a></li>\n <li><a href=\"#\" onclick=\"return showPane('pane8', this)\">{$lang_item_edit['info']}</a></li>"; if ($item['DisenchantID']) { $output .= "<li><a href=\"#\" onclick=\"return showPane('pane9', this)\">{$lang_item_edit['disenchant_tab']}</a></li>"; } $output .= "</ul>\n <div class=\"jtab-panes\">"; $output .= "<div id=\"pane1\">\n <br /><br />\n<table class=\"lined\" style=\"width: 720px;\">\n<tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['general']}:</td></tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['entry'], $lang_item_edit['entry_desc']) . "</td>\n <td>"; //$output .= maketooltip($entry, "$item_datasite$entry", $tooltip, "item_tooltip"); $output .= "</td>\n <td>" . makeinfocell($lang_item_edit['display_id'], $lang_item_edit['display_id_desc']) . "</td>\n <td><input type=\"text\" name=\"displayid\" size=\"8\" maxlength=\"11\" value=\"{$item['displayid']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['req_level'], $lang_item_edit['req_level_desc']) . "</td>\n <td><input type=\"text\" name=\"RequiredLevel\" size=\"8\" maxlength=\"4\" value=\"{$item['RequiredLevel']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['item_level'], $lang_item_edit['item_level_desc']) . "</td>\n <td><input type=\"text\" name=\"ItemLevel\" size=\"8\" maxlength=\"4\" value=\"{$item['ItemLevel']}\" /></td>\n</tr>\n\n<tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['names']}:</td></tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['item_name'], $lang_item_edit['item_name_desc']) . "</td>\n <td colspan=\"3\"><input type=\"text\" name=\"name\" size=\"30\" maxlength=\"225\" value=\"{$item['name']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['script_name'], $lang_item_edit['script_name_desc']) . "</td>\n <td colspan=\"3\"><input type=\"text\" name=\"ScriptName\" size=\"30\" maxlength=\"100\" value=\"{$item['ScriptName']}\" /></td>\n</tr>\n\n<tr>\n <td>" . makeinfocell($lang_item_edit['description'], $lang_item_edit['description_desc']) . "</td>\n <td colspan=\"3\"><input type=\"text\" name=\"description\" size=\"30\" maxlength=\"225\" value=\"{$item['description']}\" /></td>\n <td colspan=\"4\"></td>\n</tr>\n\n<tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['type']}:</td></tr>\n <tr>"; $class = array(0 => "", 1 => "", 2 => "", 4 => "", 5 => "", 6 => "", 7 => "", 9 => "", 11 => "", 12 => "", 13 => "", 14 => "", 15 => ""); $class[$item['class']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['class'], $lang_item_edit['class_desc']) . "</td>\n <td colspan=\"3\"><select name=\"class\">\n <option value=\"0\" {$class[0]}>0 - {$lang_item['consumable']}</option>\n <option value=\"1\" {$class[1]}>1 - {$lang_item['bag']}</option>\n <option value=\"2\" {$class[2]}>2 - {$lang_item['weapon']}</option>\n <option value=\"4\" {$class[4]}>4 - {$lang_item['armor']}</option>\n <option value=\"5\" {$class[5]}>5 - {$lang_item['reagent']}</option>\n <option value=\"6\" {$class[6]}>6 - {$lang_item['projectile']}</option>\n <option value=\"7\" {$class[7]}>7 - {$lang_item['trade_goods']}s</option>\n <option value=\"9\" {$class[9]}>9 - {$lang_item['recipe']}</option>\n <option value=\"11\" {$class[11]}>11 - {$lang_item['quiver']}</option>\n <option value=\"12\" {$class[12]}>12 - {$lang_item['quest']}</option>\n <option value=\"13\" {$class[13]}>13 - {$lang_item['key']}</option>\n <option value=\"14\" {$class[14]}>14 - {$lang_item['permanent']}</option>\n <option value=\"15\" {$class[15]}>15 - {$lang_item['misc_short']}</option>\n </select></td>"; unset($class); $subclass = array(0 => array(0 => "", 3 => "", 4 => "", 5 => "", 6 => "", 7 => ""), 1 => array(0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => "", 6 => ""), 2 => array(0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => "", 6 => "", 7 => "", 8 => "", 10 => "", 11 => "", 12 => "", 13 => "", 14 => "", 15 => "", 16 => "", 17 => "", 18 => "", 19 => "", 20 => ""), 4 => array(0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => "", 6 => "", 7 => "", 8 => "", 9 => ""), 6 => array(2 => "", 3 => ""), 7 => array(0 => "", 1 => "", 2 => "", 3 => ""), 9 => array(0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => "", 6 => "", 7 => "", 8 => "", 9 => "", 10 => ""), 11 => array(2 => "", 3 => ""), 13 => array(0 => "", 1 => "")); $subclass[$item['class']][$item['subclass']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['subclass'], $lang_item_edit['subclass_desc']) . "</td>\n <td colspan=\"3\"><select name=\"subclass\">\n <option value=\"0\" {$subclass[0][0]}>0 - {$lang_item['none']}</option>\n <optgroup label=\"Class 0: {$lang_item['consumable']}\">\n <option value=\"0\" {$subclass[0][0]}>0 - {$lang_item['consumable']}</option>\n <option value=\"3\" {$subclass[0][3]}>3 - {$lang_item['potion']}</option>\n <option value=\"4\" {$subclass[0][4]}>4 - {$lang_item['scroll']}</option>\n <option value=\"5\" {$subclass[0][5]}>5 - {$lang_item['bandage']}</option>\n <option value=\"6\" {$subclass[0][6]}>6 - {$lang_item['healthstone']}</option>\n <option value=\"7\" {$subclass[0][7]}>7 - {$lang_item['combat_effect']}</option>\n <optgroup label=\"Class 1: {$lang_item['bag']}\">\n <option value=\"0\" {$subclass[1][0]}>0 - {$lang_item['bag']}</option>\n <option value=\"1\" {$subclass[1][1]}>1 - {$lang_item['soul_shards']}</option>\n <option value=\"2\" {$subclass[1][2]}>2 - {$lang_item['herbs']}</option>\n <option value=\"3\" {$subclass[1][3]}>3 - {$lang_item['enchanting']}</option>\n <option value=\"4\" {$subclass[1][4]}>4 - {$lang_item['engineering']}</option>\n <option value=\"5\" {$subclass[1][5]}>5 - {$lang_item['gems']}</option>\n <option value=\"6\" {$subclass[1][6]}>6 - {$lang_item['mining']}</option>\n <optgroup label=\"Class 2: {$lang_item['weapon']}\">\n <option value=\"0\" {$subclass[2][0]}>0 - {$lang_item['axe_1h']}</option>\n <option value=\"1\" {$subclass[2][2]}>1 - {$lang_item['axe_2h']}</option>\n <option value=\"2\" {$subclass[2][2]}>2 - {$lang_item['bow']}</option>\n <option value=\"3\" {$subclass[2][2]}>3 - {$lang_item['rifle']}</option>\n <option value=\"4\" {$subclass[2][4]}>4 - {$lang_item['mace_1h']}</option>\n <option value=\"5\" {$subclass[2][5]}>5 - {$lang_item['mace_2h']}</option>\n <option value=\"6\" {$subclass[2][6]}>6 - {$lang_item['polearm']}</option>\n <option value=\"7\" {$subclass[2][7]}>7 - {$lang_item['sword_1h']}</option>\n <option value=\"8\" {$subclass[2][8]}>8 - {$lang_item['sword_2h']}</option>\n <option value=\"10\" {$subclass[2][10]}>10 - {$lang_item['staff']}</option>\n <option value=\"11\" {$subclass[2][11]}>11 - {$lang_item['exotic_1h']}</option>\n <option value=\"12\" {$subclass[2][12]}>12 - {$lang_item['exotic_2h']}</option>\n <option value=\"13\" {$subclass[2][13]}>13 - {$lang_item['fist_weapon']}</option>\n <option value=\"14\" {$subclass[2][14]}>14 - {$lang_item['misc_weapon']}</option>\n <option value=\"15\" {$subclass[2][15]}>15 - {$lang_item['dagger']}</option>\n <option value=\"16\" {$subclass[2][16]}>16 - {$lang_item['thrown']}</option>\n <option value=\"17\" {$subclass[2][17]}>17 - {$lang_item['spear']}</option>\n <option value=\"18\" {$subclass[2][18]}>18 - {$lang_item['crossbow']}</option>\n <option value=\"19\" {$subclass[2][19]}>19 - {$lang_item['wand']}</option>\n <option value=\"20\" {$subclass[2][20]}>20 - {$lang_item['fishing_pole']}</option>\n </optgroup>\n <optgroup label=\"Class 4: {$lang_item['armor']}\">\n <option value=\"0\" {$subclass[4][0]}>0 - {$lang_item['misc']}</option>\n <option value=\"1\" {$subclass[4][1]}>1 - {$lang_item['cloth']}</option>\n <option value=\"2\" {$subclass[4][2]}>2 - {$lang_item['leather']}</option>\n <option value=\"3\" {$subclass[4][3]}>3 - {$lang_item['mail']}</option>\n <option value=\"4\" {$subclass[4][4]}>4 - {$lang_item['plate']}</option>\n <option value=\"5\" {$subclass[4][5]}>5 - {$lang_item['buckler']}</option>\n <option value=\"6\" {$subclass[4][6]}>6 - {$lang_item['shield']}</option>\n <option value=\"7\" {$subclass[4][7]}>7 - {$lang_item['libram']}</option>\n <option value=\"8\" {$subclass[4][8]}>8 - {$lang_item['idol']}</option>\n <option value=\"9\" {$subclass[4][9]}>9 - {$lang_item['totem']}</option>\n </optgroup>\n <optgroup label=\"Class 6: {$lang_item['projectile']}\">\n <option value=\"2\" {$subclass[6][2]}>2 - {$lang_item['arrows']}</option>\n <option value=\"3\" {$subclass[6][3]}>3 - {$lang_item['bullets']}</option>\n </optgroup>\n <optgroup label=\"Class 7: {$lang_item['trade_goods']}\">\n <option value=\"0\" {$subclass[7][0]}>0 - {$lang_item['trade_goods']}</option>\n <option value=\"1\" {$subclass[7][1]}>1 - {$lang_item['parts']}</option>\n <option value=\"2\" {$subclass[7][2]}>2 - {$lang_item['explosives']}</option>\n <option value=\"3\" {$subclass[7][3]}>3 - {$lang_item['devices']}</option>\n </optgroup>\n <optgroup label=\"Class 9: {$lang_item['recipe']}\">\n <option value=\"0\" {$subclass[9][0]}>0 - {$lang_item['book']}</option>\n <option value=\"1\" {$subclass[9][1]}>1 - {$lang_item['LW_pattern']}</option>\n <option value=\"2\" {$subclass[9][2]}>2 - {$lang_item['tailoring_pattern']}</option>\n <option value=\"3\" {$subclass[9][3]}>3 - {$lang_item['ENG_Schematic']}</option>\n <option value=\"4\" {$subclass[9][4]}>4 - {$lang_item['BS_plans']}</option>\n <option value=\"5\" {$subclass[9][5]}>5 - {$lang_item['cooking_recipe']}</option>\n <option value=\"6\" {$subclass[9][6]}>6 - {$lang_item['alchemy_recipe']}</option>\n <option value=\"7\" {$subclass[9][7]}>7 - {$lang_item['FA_manual']}</option>\n <option value=\"8\" {$subclass[9][8]}>8 - {$lang_item['ench_formula']}</option>\n <option value=\"9\" {$subclass[9][9]}>9 - {$lang_item['fishing_manual']}</option>\n <option value=\"10\" {$subclass[9][10]}>10 - {$lang_item['JC_formula']}</option>\n </optgroup>\n <optgroup label=\"Class 11: {$lang_item['quiver']}\">\n <option value=\"2\" {$subclass[11][2]}>2 - {$lang_item['quiver']}</option>\n <option value=\"3\" {$subclass[11][3]}>3 - {$lang_item['ammo_pouch']}</option>\n </optgroup>\n <optgroup label=\"Class 13: {$lang_item['key']}\">\n <option value=\"0\" {$subclass[13][0]}>0 - {$lang_item['key']}</option>\n <option value=\"1\" {$subclass[13][1]}>1 - {$lang_item['lockpick']}</option>\n </optgroup>\n </select></td>\n</tr>\n<tr>"; unset($subclass); $quality = array(0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => "", 6 => ""); $quality[$item['Quality']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['quality'], $lang_item_edit['quality_desc']) . "</td>\n <td colspan=\"2\"><select name=\"Quality\">\n <option value=\"0\" {$quality[0]}>0 - {$lang_item['poor']}</option>\n <option value=\"1\" {$quality[1]}>1 - {$lang_item['common']}</option>\n <option value=\"2\" {$quality[2]}>2 - {$lang_item['uncommon']}</option>\n <option value=\"3\" {$quality[3]}>3 - {$lang_item['rare']}</option>\n <option value=\"4\" {$quality[4]}>4 - {$lang_item['epic']}</option>\n <option value=\"5\" {$quality[5]}>5 - {$lang_item['legendary']}</option>\n <option value=\"6\" {$quality[6]}>6 - {$lang_item['artifact']}</option>\n </select></td>"; unset($quality); $inv_type = array(0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => "", 6 => "", 7 => "", 8 => "", 9 => "", 10 => "", 11 => "", 12 => "", 13 => "", 14 => "", 15 => "", 16 => "", 17 => "", 18 => "", 19 => "", 20 => "", 21 => "", 22 => "", 23 => "", 24 => "", 25 => "", 26 => ""); $inv_type[$item['InventoryType']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['inv_type'], $lang_item_edit['inv_type_desc']) . "</td>\n <td colspan=\"2\"><select name=\"InventoryType\">\n <option value=\"0\" {$inv_type[0]}>0 - {$lang_item['other']}</option>\n <option value=\"1\" {$inv_type[1]}>1 - {$lang_item['head']}</option>\n <option value=\"2\" {$inv_type[2]}>2 - {$lang_item['neck']}</option>\n <option value=\"3\" {$inv_type[3]}>3 - {$lang_item['shoulder']}</option>\n <option value=\"4\" {$inv_type[4]}>4 - {$lang_item['shirt']}</option>\n <option value=\"5\" {$inv_type[5]}>5 - {$lang_item['chest']}</option>\n <option value=\"6\" {$inv_type[6]}>6 - {$lang_item['belt']}</option>\n <option value=\"7\" {$inv_type[7]}>7 - {$lang_item['legs']}</option>\n <option value=\"8\" {$inv_type[8]}>8 - {$lang_item['feet']}</option>\n <option value=\"9\" {$inv_type[9]}>9 - {$lang_item['belt']}</option>\n <option value=\"10\" {$inv_type[10]}>10 - {$lang_item['gloves']}</option>\n <option value=\"11\" {$inv_type[11]}>11 - {$lang_item['finger']}</option>\n <option value=\"12\" {$inv_type[12]}>12 - {$lang_item['trinket']}</option>\n <option value=\"13\" {$inv_type[13]}>13 - {$lang_item['one_hand']}</option>\n <option value=\"14\" {$inv_type[14]}>14 - {$lang_item['off_hand']}</option>\n <option value=\"15\" {$inv_type[15]}>15 - {$lang_item['bow']}</option>\n <option value=\"16\" {$inv_type[16]}>16 - {$lang_item['back']}</option>\n <option value=\"17\" {$inv_type[17]}>17 - {$lang_item['two_hand']}</option>\n <option value=\"18\" {$inv_type[18]}>18 - {$lang_item['bag']}</option>\n <option value=\"19\" {$inv_type[19]}>19 - {$lang_item['tabard']}</option>\n <option value=\"20\" {$inv_type[20]}>20 - {$lang_item['robe']}</option>\n <option value=\"21\" {$inv_type[21]}>21 - {$lang_item['main_hand']}</option>\n <option value=\"22\" {$inv_type[22]}>22 - {$lang_item['off_misc']}</option>\n <option value=\"23\" {$inv_type[23]}>23 - {$lang_item['tome']}</option>\n <option value=\"24\" {$inv_type[24]}>24 - {$lang_item['projectile']}</option>\n <option value=\"25\" {$inv_type[25]}>25 - {$lang_item['thrown']}</option>\n <option value=\"26\" {$inv_type[26]}>26 - {$lang_item['rifle']}</option>\n </select></td>\n\n <td>" . makeinfocell($lang_item_edit['flags'], $lang_item_edit['flags_desc']) . "</td>\n <td><input type=\"text\" name=\"Flags\" size=\"10\" maxlength=\"30\" value=\"{$item['Flags']}\" /></td>\n </tr>\n\n <tr>\n <td>" . makeinfocell($lang_item_edit['item_set'], $lang_item_edit['item_set_desc']) . "</td>\n <td><input type=\"text\" name=\"itemset\" size=\"10\" maxlength=\"30\" value=\"{$item['itemset']}\" /></td>"; unset($inv_type); $bonding = array(0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => ""); $bonding[$item['bonding']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['bonding'], $lang_item_edit['bonding_desc']) . "</td>\n <td colspan=\"3\"><select name=\"bonding\">\n <option value=\"0\" {$bonding[0]}>0 - {$lang_item['no_bind']}</option>\n <option value=\"1\" {$bonding[1]}>1 - {$lang_item['bop']}</option>\n <option value=\"2\" {$bonding[2]}>2 - {$lang_item['boe']}</option>\n <option value=\"3\" {$bonding[3]}>3 - {$lang_item['bou']}</option>\n <option value=\"4\" {$bonding[4]}>4 - {$lang_item['quest_item']}</option>\n <option value=\"5\" {$bonding[5]}>5 - {$lang_item['quest_item']}1</option>\n </select></td>\n\n<td>" . makeinfocell($lang_item_edit['start_quest'], $lang_item_edit['start_quest_desc']) . "</td>\n<td><input type=\"text\" name=\"startquest\" size=\"10\" maxlength=\"30\" value=\"{$item['startquest']}\" /></td>\n\n</tr>\n</table>\n<br />{$lang_item_edit['short_rules_desc']}<br /><br />\n</div>"; unset($bonding); $output .= "<div id=\"pane2\">\n <br /><br /><table class=\"lined\" style=\"width: 720px;\">\n <tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['vendor']}:</td></tr>\n <tr>\n <td>" . makeinfocell($lang_item_edit['buy_count'], $lang_item_edit['buy_count_desc']) . "</td>\n <td><input type=\"text\" name=\"BuyCount\" size=\"8\" maxlength=\"3\" value=\"{$item['BuyCount']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['buy_price'], $lang_item_edit['buy_price_desc']) . "</td>\n <td><input type=\"text\" name=\"BuyPrice\" size=\"8\" maxlength=\"30\" value=\"{$item['BuyPrice']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['sell_price'], $lang_item_edit['sell_price_desc']) . "</td>\n <td><input type=\"text\" name=\"SellPrice\" size=\"8\" maxlength=\"30\" value=\"{$item['SellPrice']}\" /></td>\n <td></td><td></td>\n </tr>\n\n <tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['container']}:</td></tr>\n <tr>\n\n <td>" . makeinfocell($lang_item_edit['max_count'], $lang_item_edit['max_count_desc']) . "</td>\n <td><input type=\"text\" name=\"maxcount\" size=\"6\" maxlength=\"5\" value=\"{$item['maxcount']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['stackable'], $lang_item_edit['stackable_desc']) . "</td>\n <td><input type=\"text\" name=\"stackable\" size=\"6\" maxlength=\"5\" value=\"{$item['stackable']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['bag_family'], $lang_item_edit['bag_family_desc']) . "</td>"; $bagfamily = array(0 => "", 1 => "", 2 => "", 3 => "", 6 => "", 7 => "", 8 => "", 9 => "", 10 => "", 12 => ""); $bagfamily[$item['BagFamily']] = " selected=\"selected\" "; $output .= "<td><select name=\"BagFamily\">\n <option value=\"0\" {$bagfamily[0]}>0 - {$lang_item['none']}</option>\n <option value=\"1\" {$bagfamily[1]}>1 - {$lang_item['arrows']}</option>\n <option value=\"2\" {$bagfamily[2]}>2 - {$lang_item['bullets']}</option>\n <option value=\"3\" {$bagfamily[3]}>3 - {$lang_item['soul_shards']}</option>\n <option value=\"6\" {$bagfamily[6]}>6 - {$lang_item['herbs']}</option>\n <option value=\"7\" {$bagfamily[7]}>7 - {$lang_item['enchanting']}</option>\n <option value=\"8\" {$bagfamily[8]}>8 - {$lang_item['engineering']}</option>\n <option value=\"9\" {$bagfamily[9]}>9 - {$lang_item['keys']}</option>\n <option value=\"10\" {$bagfamily[10]}>10 - {$lang_item['gems']}</option>\n <option value=\"12\" {$bagfamily[12]}>12 - {$lang_item['mining']}</option>\n </select></td>\n <td>" . makeinfocell($lang_item_edit['bag_slots'], $lang_item_edit['bag_slots_desc']) . "</td>\n <td><input type=\"text\" name=\"ContainerSlots\" size=\"10\" maxlength=\"3\" value=\"{$item['ContainerSlots']}\" /></td>\n </tr>\n <tr>\n\n <tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['materials']}:</td></tr>"; unset($bagfamily); $Material = array(-1 => "", 0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => "", 6 => "", 7 => "", 8 => ""); $Material[$item['Material']] = " selected=\"selected\" "; $output .= "<tr>\n <td>" . makeinfocell($lang_item_edit['material'], $lang_item_edit['material_desc']) . "</td>\n <td colspan=\"2\"><select name=\"Material\">\n <option value=\"-1\" {$Material[-1]}>-1 - {$lang_item_edit['consumables']}</option>\n <option value=\"0\" {$Material[0]}>0 - {$lang_item_edit['none']}</option>\n <option value=\"1\" {$Material[1]}>1 - {$lang_item_edit['metal']}</option>\n <option value=\"2\" {$Material[2]}>2 - {$lang_item_edit['wood']}</option>\n <option value=\"3\" {$Material[3]}>3 - {$lang_item_edit['liquid']}</option>\n <option value=\"4\" {$Material[4]}>4 - {$lang_item_edit['jewelry']}</option>\n <option value=\"5\" {$Material[5]}>5 - {$lang_item_edit['chain']}</option>\n <option value=\"6\" {$Material[6]}>6 - {$lang_item_edit['plate']}</option>\n <option value=\"7\" {$Material[7]}>7 - {$lang_item_edit['cloth']}</option>\n <option value=\"8\" {$Material[8]}>8 - {$lang_item_edit['leather']}</option>\n </select></td>"; unset($Material); $PageMaterial = array(0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => ""); $PageMaterial[$item['PageMaterial']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['page_material'], $lang_item_edit['page_material_desc']) . "</td>\n <td colspan=\"2\"><select name=\"PageMaterial\">\n <option value=\"0\" {$PageMaterial[0]}>0 - {$lang_item_edit['none']}</option>\n <option value=\"1\" {$PageMaterial[1]}>1 - {$lang_item_edit['parchment']}</option>\n <option value=\"2\" {$PageMaterial[2]}>2 - {$lang_item_edit['stone']}</option>\n <option value=\"3\" {$PageMaterial[3]}>3 - {$lang_item_edit['marble']}</option>\n <option value=\"4\" {$PageMaterial[4]}>4 - {$lang_item_edit['silver']}</option>\n <option value=\"5\" {$PageMaterial[5]}>5 - {$lang_item_edit['bronze']}</option>\n </select></td>"; unset($PageMaterial); $output .= "<td>" . makeinfocell($lang_item_edit['max_durability'], $lang_item_edit['max_durability_desc']) . "</td>\n <td><input type=\"text\" name=\"MaxDurability\" size=\"8\" maxlength=\"30\" value=\"{$item['MaxDurability']}\" /></td>\n</tr>\n\n<tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['RandomProperty']}:</td></tr>\n<tr>\n <td colspan=\"2\">" . makeinfocell($lang_item_edit['RandomProperty'], $lang_item_edit['RandomProperty_desc']) . "</td>\n <td colspan=\"2\"><input type=\"text\" name=\"RandomProperty\" size=\"8\" maxlength=\"30\" value=\"{$item['RandomProperty']}\" /></td>\n\n <td colspan=\"2\">" . makeinfocell($lang_item_edit['RandomSuffix'], $lang_item_edit['RandomSuffix_desc']) . "</td>\n <td colspan=\"2\"><input type=\"text\" name=\"RandomSuffix\" size=\"8\" maxlength=\"10\" value=\"{$item['RandomSuffix']}\" /></td>\n</tr>\n\n\n<tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['other']}:</td></tr>\n <tr>\n <td>" . makeinfocell($lang_item_edit['area'], $lang_item_edit['area_desc']) . "</td>\n <td><input type=\"text\" name=\"area\" size=\"8\" maxlength=\"10\" value=\"{$item['area']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['map'], $lang_item_edit['map_desc']) . "</td>\n <td><input type=\"text\" name=\"Map\" size=\"8\" maxlength=\"10\" value=\"{$item['Map']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['page_text'], $lang_item_edit['page_text_desc']) . "</td>\n <td><input type=\"text\" name=\"PageText\" size=\"6\" maxlength=\"30\" value=\"{$item['PageText']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['unk0'], $lang_item_edit['unk0_desc']) . "</td>\n <td><input type=\"text\" name=\"unk0\" size=\"8\" maxlength=\"10\" value=\"{$item['unk0']}\" /></td>\n </tr>\n <tr>\n\n <tr>\n <td colspan=\"2\">" . makeinfocell($lang_item_edit['disenchant_id'], $lang_item_edit['disenchant_id_desc']) . "</td>\n <td><input type=\"text\" name=\"DisenchantID\" size=\"10\" maxlength=\"10\" value=\"{$item['DisenchantID']}\" /></td>\n\n <td colspan=\"2\">" . makeinfocell($lang_item_edit['req_skill_disenchant'], $lang_item_edit['req_skill_disenchant_desc']) . "</td>\n <td><input type=\"text\" name=\"RequiredDisenchantSkill\" size=\"10\" maxlength=\"10\" value=\"{$item['RequiredDisenchantSkill']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['lock_id'], $lang_item_edit['lock_id_desc']) . "</td>\n <td><input type=\"text\" name=\"lockid\" size=\"8\" maxlength=\"30\" value=\"{$item['lockid']}\" /></td>\n </tr>"; $LanguageID = array(0 => "", 1 => "", 2 => "", 3 => "", 6 => "", 7 => "", 8 => "", 9 => "", 10 => "", 11 => "", 12 => "", 13 => "", 14 => "", 33 => ""); $LanguageID[$item['LanguageID']] = " selected=\"selected\" "; $output .= "<tr>\n <td>" . makeinfocell($lang_item_edit['lang_id'], $lang_item_edit['lang_id_desc']) . "</td>\n <td colspan=\"2\"><select name=\"LanguageID\">\n <option value=\"0\" {$LanguageID[0]}>0 - {$lang_item_edit['other']}</option>\n <option value=\"1\" {$LanguageID[1]}>1 - Orcish</option>\n <option value=\"2\" {$LanguageID[2]}>2 - Darnassian</option>\n <option value=\"3\" {$LanguageID[3]}>3 - Taurahe</option>\n <option value=\"6\" {$LanguageID[6]}>6 - Dwarvish</option>\n <option value=\"7\" {$LanguageID[7]}>7 - Common</option>\n <option value=\"8\" {$LanguageID[8]}>8 - Demonic</option>\n <option value=\"9\" {$LanguageID[9]}>9 - Titan</option>\n <option value=\"10\" {$LanguageID[10]}>10 - Thelassian</option>\n <option value=\"11\" {$LanguageID[11]}>11 - Draconic</option>\n <option value=\"12\" {$LanguageID[12]}>12 - Kalimag</option>\n <option value=\"13\" {$LanguageID[13]}>13 - Gnomish</option>\n <option value=\"14\" {$LanguageID[14]}>14 - Troll</option>\n <option value=\"33\" {$LanguageID[33]}>33 - Gutterspeak</option>\n </select></td>"; unset($LanguageID); $sheath = array(0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => "", 7 => ""); $sheath[$item['sheath']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['sheath'], $lang_item_edit['sheath_desc']) . "</td>\n <td colspan=\"2\"><select name=\"sheath\">\n <option value=\"0\" {$sheath[0]}>0 - {$lang_item_edit['other']}</option>\n <option value=\"1\" {$sheath[1]}>1 - {$lang_item['sword_2h']}</option>\n <option value=\"2\" {$sheath[2]}>2 - {$lang_item['staff']}</option>\n <option value=\"3\" {$sheath[3]}>3 - {$lang_item['sword_1h']}</option>\n <option value=\"4\" {$sheath[4]}>4 - {$lang_item['shield']}</option>\n <option value=\"5\" {$sheath[5]}>5 - {$lang_item['rod']}</option>\n <option value=\"7\" {$sheath[7]}>7 - {$lang_item['off_hand']}</option>\n </select></td>\n\n <td>" . makeinfocell($lang_item_edit['totem_category'], $lang_item_edit['totem_category_desc']) . "</td>\n <td><input type=\"text\" name=\"TotemCategory\" size=\"8\" maxlength=\"10\" value=\"{$item['TotemCategory']}\" /></td>\n </tr>\n\n </table><br /><br />\n </div>"; unset($sheath); $output .= "<div id=\"pane3\">\n <br /><br /><table class=\"lined\" style=\"width: 720px;\">\n <tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['stats']}:</td></tr>\n <tr>\n\n <td>" . makeinfocell($lang_item_edit['stat_type'] . " 1", $lang_item_edit['stat_type_desc']) . "</td>\n <td><select name=\"stat_type1\">"; output_status_options($item['stat_type1']); $output .= "</select></td>\n\n <td><input type=\"text\" name=\"stat_value1\" size=\"10\" maxlength=\"6\" value=\"{$item['stat_value1']}\" /></td>\n <td>" . makeinfocell($lang_item_edit['stat_type'] . " 2", $lang_item_edit['stat_type_desc']) . "</td>\n <td><select name=\"stat_type2\">"; output_status_options($item['stat_type2']); $output .= "</select></td>\n\n <td><input type=\"text\" name=\"stat_value2\" size=\"10\" maxlength=\"6\" value=\"{$item['stat_value2']}\" /></td>\n </tr>\n <tr>\n <td>" . makeinfocell($lang_item_edit['stat_type'] . " 3", $lang_item_edit['stat_type_desc']) . "</td>\n <td><select name=\"stat_type3\">"; output_status_options($item['stat_type3']); $output .= "</select></td>\n\n <td><input type=\"text\" name=\"stat_value3\" size=\"10\" maxlength=\"6\" value=\"{$item['stat_value3']}\" /></td>\n <td>" . makeinfocell($lang_item_edit['stat_type'] . " 4", $lang_item_edit['stat_type_desc']) . "</td>\n <td><select name=\"stat_type4\">"; output_status_options($item['stat_type4']); $output .= "</select></td>\n\n <td><input type=\"text\" name=\"stat_value4\" size=\"10\" maxlength=\"6\" value=\"{$item['stat_value4']}\" /></td>\n </tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['stat_type'] . " 5", $lang_item_edit['stat_type_desc']) . "</td>\n <td><select name=\"stat_type5\">"; output_status_options($item['stat_type5']); $output .= "</select></td>\n\n <td><input type=\"text\" name=\"stat_value5\" size=\"10\" maxlength=\"6\" value=\"{$item['stat_value5']}\" /></td>\n <td>" . makeinfocell($lang_item_edit['stat_type'] . " 6", $lang_item_edit['stat_type_desc']) . "</td>\n <td><select name=\"stat_type6\">"; output_status_options($item['stat_type1']); $output .= "</select></td>\n\n <td><input type=\"text\" name=\"stat_value6\" size=\"10\" maxlength=\"6\" value=\"{$item['stat_value6']}\" /></td>\n </tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['stat_type'] . " 7", $lang_item_edit['stat_type_desc']) . "</td>\n <td><select name=\"stat_type7\">"; output_status_options($item['stat_type7']); $output .= "</select></td>\n <td><input type=\"text\" name=\"stat_value7\" size=\"10\" maxlength=\"6\" value=\"{$item['stat_value7']}\" /></td>\n <td>" . makeinfocell($lang_item_edit['stat_type'] . " 8", $lang_item_edit['stat_type_desc']) . "</td>\n <td><select name=\"stat_type8\">"; output_status_options($item['stat_type8']); $output .= "</select></td>\n\n <td><input type=\"text\" name=\"stat_value8\" size=\"10\" maxlength=\"6\" value=\"{$item['stat_value8']}\" /></td>\n </tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['stat_type'] . " 9", $lang_item_edit['stat_type_desc']) . "</td>\n <td><select name=\"stat_type9\">"; output_status_options($item['stat_type9']); $output .= "</select></td>\n <td><input type=\"text\" name=\"stat_value9\" size=\"10\" maxlength=\"6\" value=\"{$item['stat_value9']}\" /></td>\n <td>" . makeinfocell($lang_item_edit['stat_type'] . " 10", $lang_item_edit['stat_type_desc']) . "</td>\n <td><select name=\"stat_type10\">"; output_status_options($item['stat_type10']); $output .= "</select></td>\n\n <td><input type=\"text\" name=\"stat_value10\" size=\"10\" maxlength=\"6\" value=\"{$item['stat_value10']}\" /></td>\n </tr>\n\n <tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['resis_armor']}:</td></tr>\n <tr>\n <td colspan=\"2\">" . makeinfocell($lang_item['armor'], $lang_item_edit['armor_desc']) . "</td>\n <td><input type=\"text\" name=\"armor\" size=\"10\" maxlength=\"30\" value=\"{$item['armor']}\" /></td>\n\n <td colspan=\"2\">" . makeinfocell($lang_item['block'], $lang_item_edit['block_desc']) . "</td>\n <td><input type=\"text\" name=\"block\" size=\"10\" maxlength=\"30\" value=\"{$item['block']}\" /></td>\n </tr>\n <tr>\n <td colspan=\"2\">" . makeinfocell($lang_item['res_holy'], $lang_item_edit['res_holy_desc']) . "</td>\n <td><input type=\"text\" name=\"holy_res\" size=\"10\" maxlength=\"30\" value=\"{$item['holy_res']}\" /></td>\n\n <td colspan=\"2\">" . makeinfocell($lang_item['res_fire'], $lang_item_edit['res_fire_desc']) . "</td>\n <td><input type=\"text\" name=\"fire_res\" size=\"10\" maxlength=\"30\" value=\"{$item['fire_res']}\" /></td>\n </tr>\n <tr>\n <td colspan=\"2\">" . makeinfocell($lang_item['res_nature'], $lang_item_edit['res_nature_desc']) . "</td>\n <td><input type=\"text\" name=\"nature_res\" size=\"10\" maxlength=\"30\" value=\"{$item['nature_res']}\" /></td>\n\n <td colspan=\"2\">" . makeinfocell($lang_item['res_frost'], $lang_item_edit['res_frost_desc']) . "</td>\n <td><input type=\"text\" name=\"frost_res\" size=\"10\" maxlength=\"30\" value=\"{$item['frost_res']}\" /></td>\n </tr>\n <tr>\n <td colspan=\"2\">" . makeinfocell($lang_item['res_shadow'], $lang_item_edit['res_shadow_desc']) . "</td>\n <td><input type=\"text\" name=\"shadow_res\" size=\"10\" maxlength=\"30\" value=\"{$item['shadow_res']}\" /></td>\n\n <td colspan=\"2\">" . makeinfocell($lang_item['res_arcane'], $lang_item_edit['res_arcane_desc']) . "</td>\n <td><input type=\"text\" name=\"arcane_res\" size=\"10\" maxlength=\"30\" value=\"{$item['arcane_res']}\" /></td>\n </tr>\n\n </table><br /><br />\n </div>"; $output .= "<div id=\"pane4\">\n <br /><br /><table class=\"lined\" style=\"width: 720px;\">\n <tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['weapon_properties']}:</td></tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['delay'], $lang_item_edit['delay_desc']) . "</td>\n <td colspan=\"2\"><input type=\"text\" name=\"delay\" size=\"10\" maxlength=\"11\" value=\"{$item['delay']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['ranged_mod'], $lang_item_edit['ranged_mod_desc']) . "</td>\n <td colspan=\"2\"><input type=\"text\" name=\"RangedModRange\" size=\"10\" maxlength=\"40\" value=\"{$item['RangedModRange']}\" /></td>\n</tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['armor_dmg_mod'], $lang_item_edit['armor_dmg_mod_desc']) . "</td>\n <td colspan=\"2\"><input type=\"text\" name=\"ArmorDamageModifier\" size=\"10\" maxlength=\"40\" value=\"{$item['ArmorDamageModifier']}\" /></td>"; $ammo_type = array(0 => "", 2 => "", 3 => ""); $ammo_type[$item['ammo_type']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['ammo_type'], $lang_item_edit['ammo_type_desc']) . "</td>\n <td colspan=\"2\"><select name=\"ammo_type\">\n <option value=\"0\" {$ammo_type[0]}>0 - {$lang_item['none']}</option>\n <option value=\"2\" {$ammo_type[2]}>2 - {$lang_item['arrows']}</option>\n <option value=\"3\" {$ammo_type[3]}>3 - {$lang_item['bullets']}</option>\n </select></td>\n</tr>\n<tr class=\"large_bold\"><td colspan=\"8\" class=\"hidden\" align=\"left\">{$lang_item_edit['weapon_damage']}:</td></tr>\n<tr>"; unset($ammo_type); $output .= "<td>" . makeinfocell($lang_item_edit['damage_type'] . " 1", $lang_item_edit['damage_type_desc']) . "</td>\n <td colspan=\"2\"><select name=\"dmg_type1\">"; output_dmgtype_options($item['dmg_type1']); $output .= "</select></td>\n\n <td>" . makeinfocell($lang_item_edit['dmg_min_max'], $lang_item_edit['dmg_min_max_desc']) . "</td>\n <td colspan=\"4\"><input type=\"text\" name=\"dmg_min1\" size=\"8\" maxlength=\"45\" value=\"{$item['dmg_min1']}\" /> - <input type=\"text\" name=\"dmg_max1\" size=\"8\" maxlength=\"45\" value=\"{$item['dmg_max1']}\" /></td>\n\n</tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['damage_type'] . " 2", $lang_item_edit['damage_type_desc']) . "</td>\n <td colspan=\"2\"><select name=\"dmg_type2\">"; output_dmgtype_options($item['dmg_type2']); $output .= "</select></td>\n\n <td>" . makeinfocell($lang_item_edit['dmg_min_max'], $lang_item_edit['dmg_min_max_desc']) . "</td>\n <td colspan=\"4\"><input type=\"text\" name=\"dmg_min2\" size=\"8\" maxlength=\"45\" value=\"{$item['dmg_min2']}\" /> - <input type=\"text\" name=\"dmg_max2\" size=\"8\" maxlength=\"45\" value=\"{$item['dmg_max2']}\" /></td>\n\n</tr>\n</table><br /><br />\n </div>"; $output .= "<div id=\"pane5\">\n <br /><br /><table class=\"lined\" style=\"width: 720px;\">\n<tr>\n <td colspan=\"2\">{$lang_item_edit['item_spell']} 1</td>\n <td>" . makeinfocell($lang_item_edit['spell_id'], $lang_item_edit['spell_id_desc']) . "</td>\n <td><input type=\"text\" name=\"spellid_1\" size=\"6\" maxlength=\"30\" value=\"{$item['spellid_1']}\" /></td>"; $spelltrigger_1 = array(0 => "", 1 => "", 2 => "", 4 => ""); $spelltrigger_1[$item['spelltrigger_1']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['spell_trigger'], $lang_item_edit['spell_trigger_desc']) . "</td>\n <td><select name=\"spelltrigger_1\">\n <option value=\"0\" {$spelltrigger_1[0]}>0: {$lang_item['spell_use']}</option>\n <option value=\"1\" {$spelltrigger_1[1]}>1: {$lang_item['spell_equip']}</option>\n <option value=\"2\" {$spelltrigger_1[2]}>2: {$lang_item['spell_coh']}</option>\n <option value=\"4\" {$spelltrigger_1[4]}>4: {$lang_item['soul_stone']}</option>\n </select></td>\n <td>" . makeinfocell($lang_item_edit['spell_charges'], $lang_item_edit['spell_charges_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcharges_1\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcharges_1']}\" /></td>\n</tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['spell_cooldown'], $lang_item_edit['spell_cooldown_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcooldown_1\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcooldown_1']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['spell_category'], $lang_item_edit['spell_category_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcategory_1\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcategory_1']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['spell_category_cooldown'], $lang_item_edit['spell_category_cooldown_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcategorycooldown_1\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcategorycooldown_1']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['ppm_rate'], $lang_item_edit['ppm_rate_desc']) . "</td>\n <td><input type=\"text\" name=\"spellppmRate_1\" size=\"6\" maxlength=\"30\" value=\"{$item['spellppmRate_1']}\" /></td>\n</tr>\n<tr><td colspan=\"6\" class=\"hidden\"></td></tr>\n<tr>\n <td colspan=\"2\">{$lang_item_edit['item_spell']} 2</td>\n <td>" . makeinfocell($lang_item_edit['spell_id'], $lang_item_edit['spell_id_desc']) . "</td>\n <td><input type=\"text\" name=\"spellid_2\" size=\"6\" maxlength=\"30\" value=\"{$item['spellid_2']}\" /></td>"; unset($spelltrigger_1); $spelltrigger_2 = array(0 => "", 1 => "", 2 => "", 4 => ""); $spelltrigger_2[$item['spelltrigger_2']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['spell_trigger'], $lang_item_edit['spell_trigger_desc']) . "</td>\n <td><select name=\"spelltrigger_2\">\n <option value=\"0\" {$spelltrigger_2[0]}>0: {$lang_item['spell_use']}</option>\n <option value=\"1\" {$spelltrigger_2[1]}>1: {$lang_item['spell_equip']}</option>\n <option value=\"2\" {$spelltrigger_2[2]}>2: {$lang_item['spell_coh']}</option>\n <option value=\"4\" {$spelltrigger_2[4]}>4: {$lang_item['soul_stone']}</option>\n </select></td>\n <td>" . makeinfocell($lang_item_edit['spell_charges'], $lang_item_edit['spell_charges_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcharges_2\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcharges_2']}\" /></td>\n</tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['spell_cooldown'], $lang_item_edit['spell_cooldown_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcooldown_2\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcooldown_2']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['spell_category'], $lang_item_edit['spell_category_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcategory_2\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcategory_2']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['spell_category_cooldown'], $lang_item_edit['spell_category_cooldown_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcategorycooldown_2\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcategorycooldown_2']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['ppm_rate'], $lang_item_edit['ppm_rate_desc']) . "</td>\n <td><input type=\"text\" name=\"spellppmRate_2\" size=\"6\" maxlength=\"30\" value=\"{$item['spellppmRate_2']}\" /></td>\n</tr>\n<tr><td colspan=\"6\" class=\"hidden\"></td></tr>\n<tr>\n <td colspan=\"2\">{$lang_item_edit['item_spell']} 3</td>\n <td>" . makeinfocell($lang_item_edit['spell_id'], $lang_item_edit['spell_id_desc']) . "</td>\n <td><input type=\"text\" name=\"spellid_3\" size=\"6\" maxlength=\"30\" value=\"{$item['spellid_3']}\" /></td>"; unset($spelltrigger_2); $spelltrigger_3 = array(0 => "", 1 => "", 2 => "", 4 => ""); $spelltrigger_3[$item['spelltrigger_3']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['spell_trigger'], $lang_item_edit['spell_trigger_desc']) . "</td>\n <td><select name=\"spelltrigger_3\">\n <option value=\"0\" {$spelltrigger_3[0]}>0: {$lang_item['spell_use']}</option>\n <option value=\"1\" {$spelltrigger_3[1]}>1: {$lang_item['spell_equip']}</option>\n <option value=\"2\" {$spelltrigger_3[2]}>2: {$lang_item['spell_coh']}</option>\n <option value=\"4\" {$spelltrigger_3[4]}>4: {$lang_item['soul_stone']}</option>\n </select></td>\n <td>" . makeinfocell($lang_item_edit['spell_charges'], $lang_item_edit['spell_charges_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcharges_3\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcharges_3']}\" /></td>\n</tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['spell_cooldown'], $lang_item_edit['spell_cooldown_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcooldown_3\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcooldown_3']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['spell_category'], $lang_item_edit['spell_category_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcategory_3\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcategory_3']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['spell_category_cooldown'], $lang_item_edit['spell_category_cooldown_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcategorycooldown_3\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcategorycooldown_3']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['ppm_rate'], $lang_item_edit['ppm_rate_desc']) . "</td>\n <td><input type=\"text\" name=\"spellppmRate_3\" size=\"6\" maxlength=\"30\" value=\"{$item['spellppmRate_3']}\" /></td>\n</tr>\n<tr><td colspan=\"6\" class=\"hidden\"></td></tr>\n<tr>\n <td colspan=\"2\">{$lang_item_edit['item_spell']} 4</td>\n <td>" . makeinfocell($lang_item_edit['spell_id'], $lang_item_edit['spell_id_desc']) . "</td>\n <td><input type=\"text\" name=\"spellid_4\" size=\"6\" maxlength=\"30\" value=\"{$item['spellid_4']}\" /></td>"; unset($spelltrigger_3); $spelltrigger_4 = array(0 => "", 1 => "", 2 => "", 4 => ""); $spelltrigger_4[$item['spelltrigger_4']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['spell_trigger'], $lang_item_edit['spell_trigger_desc']) . "</td>\n <td><select name=\"spelltrigger_4\">\n <option value=\"0\" {$spelltrigger_4[0]}>0: {$lang_item['spell_use']}</option>\n <option value=\"1\" {$spelltrigger_4[1]}>1: {$lang_item['spell_equip']}</option>\n <option value=\"2\" {$spelltrigger_4[2]}>2: {$lang_item['spell_coh']}</option>\n <option value=\"4\" {$spelltrigger_4[4]}>4: {$lang_item['soul_stone']}</option>\n </select></td>\n <td>" . makeinfocell($lang_item_edit['spell_charges'], $lang_item_edit['spell_charges_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcharges_4\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcharges_4']}\" /></td>\n</tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['spell_cooldown'], $lang_item_edit['spell_cooldown_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcooldown_4\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcooldown_4']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['spell_category'], $lang_item_edit['spell_category_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcategory_4\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcategory_4']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['spell_category_cooldown'], $lang_item_edit['spell_category_cooldown_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcategorycooldown_4\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcategorycooldown_4']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['ppm_rate'], $lang_item_edit['ppm_rate_desc']) . "</td>\n <td><input type=\"text\" name=\"spellppmRate_4\" size=\"6\" maxlength=\"30\" value=\"{$item['spellppmRate_4']}\" /></td>\n</tr>\n<tr><td colspan=\"6\" class=\"hidden\"></td></tr>\n<tr>\n <td colspan=\"2\">{$lang_item_edit['item_spell']} 5</td>\n <td>" . makeinfocell($lang_item_edit['spell_id'], $lang_item_edit['spell_id_desc']) . "</td>\n <td><input type=\"text\" name=\"spellid_5\" size=\"6\" maxlength=\"30\" value=\"{$item['spellid_5']}\" /></td>"; unset($spelltrigger_4); $spelltrigger_5 = array(0 => "", 1 => "", 2 => "", 4 => ""); $spelltrigger_5[$item['spelltrigger_5']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['spell_trigger'], $lang_item_edit['spell_trigger_desc']) . "</td>\n <td><select name=\"spelltrigger_5\">\n <option value=\"0\" {$spelltrigger_5[0]}>0: {$lang_item['spell_use']}</option>\n <option value=\"1\" {$spelltrigger_5[1]}>1: {$lang_item['spell_equip']}</option>\n <option value=\"2\" {$spelltrigger_5[2]}>2: {$lang_item['spell_coh']}</option>\n <option value=\"4\" {$spelltrigger_5[4]}>4: {$lang_item['soul_stone']}</option>\n </select></td>\n <td>" . makeinfocell($lang_item_edit['spell_charges'], $lang_item_edit['spell_charges_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcharges_5\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcharges_5']}\" /></td>\n</tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['spell_cooldown'], $lang_item_edit['spell_cooldown_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcooldown_5\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcooldown_5']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['spell_category'], $lang_item_edit['spell_category_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcategory_5\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcategory_5']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['spell_category_cooldown'], $lang_item_edit['spell_category_cooldown_desc']) . "</td>\n <td><input type=\"text\" name=\"spellcategorycooldown_5\" size=\"6\" maxlength=\"30\" value=\"{$item['spellcategorycooldown_5']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['ppm_rate'], $lang_item_edit['ppm_rate_desc']) . "</td>\n <td><input type=\"text\" name=\"spellppmRate_5\" size=\"6\" maxlength=\"30\" value=\"{$item['spellppmRate_5']}\" /></td>\n</tr>\n\n</table>\n </div>"; unset($spelltrigger_5); $output .= "<div id=\"pane6\">\n <br /><br /><table class=\"lined\" style=\"width: 720px;\">\n <tr>"; $AllowableClass = array(-1 => "", 1 => "", 2 => "", 4 => "", 8 => "", 16 => "", 32 => "", 64 => "", 128 => "", 256 => "", 512 => "", 1024 => ""); if ($item['AllowableClass'] == -1) { $AllowableClass[-1] = " selected=\"selected\" "; } else { if ($item['AllowableClass'] & 1) { $AllowableClass[1] = " selected=\"selected\" "; } if ($item['AllowableClass'] & 2) { $AllowableClass[2] = " selected=\"selected\" "; } if ($item['AllowableClass'] & 4) { $AllowableClass[4] = " selected=\"selected\" "; } if ($item['AllowableClass'] & 8) { $AllowableClass[8] = " selected=\"selected\" "; } if ($item['AllowableClass'] & 16) { $AllowableClass[16] = " selected=\"selected\" "; } if ($item['AllowableClass'] & 32) { $AllowableClass[32] = " selected=\"selected\" "; } if ($item['AllowableClass'] & 64) { $AllowableClass[64] = " selected=\"selected\" "; } if ($item['AllowableClass'] & 128) { $AllowableClass[128] = " selected=\"selected\" "; } if ($item['AllowableClass'] & 256) { $AllowableClass[256] = " selected=\"selected\" "; } if ($item['AllowableClass'] & 512) { $AllowableClass[512] = " selected=\"selected\" "; } if ($item['AllowableClass'] & 1024) { $AllowableClass[1024] = " selected=\"selected\" "; } } $output .= "<td>" . makeinfocell($lang_item_edit['allow_class'], $lang_item_edit['allow_class_desc']) . "</td>\n <td><select multiple=\"multiple\" name=\"AllowableClass[]\" size=\"5\">\n <option value=\"-1\" {$AllowableClass[-1]}>-1 - {$lang_item_edit['all']}</option>\n <option value=\"1\" {$AllowableClass[1]}>1 - {$lang_id_tab['warrior']}</option>\n <option value=\"2\" {$AllowableClass[2]}>2 - {$lang_id_tab['paladin']}</option>\n <option value=\"4\" {$AllowableClass[4]}>4 - {$lang_id_tab['hunter']}</option>\n <option value=\"8\" {$AllowableClass[8]}>8 - {$lang_id_tab['rogue']}</option>\n <option value=\"16\" {$AllowableClass[16]}>16 - {$lang_id_tab['priest']}</option>\n <option value=\"32\" {$AllowableClass[32]}>32 - FUTURE_1</option>\n <option value=\"64\" {$AllowableClass[64]}>64 - {$lang_id_tab['shaman']}</option>\n <option value=\"128\" {$AllowableClass[128]}>128 - {$lang_id_tab['mage']}</option>\n <option value=\"256\" {$AllowableClass[256]}>256 - {$lang_id_tab['warlock']}</option>\n <option value=\"512\" {$AllowableClass[512]}>512 - FUTURE_2</option>\n <option value=\"1024\" {$AllowableClass[1024]}>1024 - {$lang_id_tab['druid']}</option>\n </select></td>"; unset($AllowableClass); $AllowableRace = array(-1 => "", 1 => "", 2 => "", 4 => "", 8 => "", 16 => "", 32 => "", 64 => "", 128 => "", 256 => "", 512 => ""); if ($item['AllowableRace'] == -1) { $AllowableRace[-1] = " selected=\"selected\" "; } else { if ($item['AllowableRace'] & 1) { $AllowableRace[1] = " selected=\"selected\" "; } if ($item['AllowableRace'] & 2) { $AllowableRace[2] = " selected=\"selected\" "; } if ($item['AllowableRace'] & 4) { $AllowableRace[4] = " selected=\"selected\" "; } if ($item['AllowableRace'] & 8) { $AllowableRace[8] = " selected=\"selected\" "; } if ($item['AllowableRace'] & 16) { $AllowableRace[16] = " selected=\"selected\" "; } if ($item['AllowableRace'] & 32) { $AllowableRace[32] = " selected=\"selected\" "; } if ($item['AllowableRace'] & 64) { $AllowableRace[64] = " selected=\"selected\" "; } if ($item['AllowableRace'] & 128) { $AllowableRace[128] = " selected=\"selected\" "; } if ($item['AllowableRace'] & 256) { $AllowableRace[256] = " selected=\"selected\" "; } if ($item['AllowableRace'] & 512) { $AllowableRace[512] = " selected=\"selected\" "; } } $output .= "<td>" . makeinfocell($lang_item_edit['allow_race'], $lang_item_edit['allow_race_desc']) . "</td>\n <td><select multiple=\"multiple\" name=\"AllowableRace[]\" size=\"5\">\n <option value=\"-1\" {$AllowableRace[-1]}>-1 - {$lang_item_edit['all']}</option>\n <option value=\"1\" {$AllowableRace[1]}>1 - {$lang_id_tab['human']}</option>\n <option value=\"2\" {$AllowableRace[2]}>2 - {$lang_id_tab['orc']}</option>\n <option value=\"4\" {$AllowableRace[4]}>4 - {$lang_id_tab['dwarf']}</option>\n <option value=\"8\" {$AllowableRace[8]}>8 - {$lang_id_tab['nightelf']}</option>\n <option value=\"16\" {$AllowableRace[16]}>16 - {$lang_id_tab['undead']}</option>\n <option value=\"32\" {$AllowableRace[32]}>32 - {$lang_id_tab['tauren']}</option>\n <option value=\"64\" {$AllowableRace[64]}>64 - {$lang_id_tab['gnome']}</option>\n <option value=\"128\" {$AllowableRace[128]}>128 - {$lang_id_tab['troll']}</option>\n <option value=\"256\" {$AllowableRace[256]}>256 - {$lang_id_tab['draenei']}</option>\n <option value=\"512\" {$AllowableRace[512]}>512 - {$lang_id_tab['bloodelf']}</option>\n </select></td>\n</tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['req_skill'], $lang_item_edit['req_skill_desc']) . "</td>\n <td><input type=\"text\" name=\"RequiredSkill\" size=\"15\" maxlength=\"30\" value=\"{$item['RequiredSkill']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['req_skill_rank'], $lang_item_edit['req_skill_rank_desc']) . "</td>\n <td><input type=\"text\" name=\"RequiredSkillRank\" size=\"15\" maxlength=\"30\" value=\"{$item['RequiredSkillRank']}\" /></td>\n</tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['req_spell'], $lang_item_edit['req_spell_desc']) . "</td>\n <td><input type=\"text\" name=\"requiredspell\" size=\"15\" maxlength=\"30\" value=\"{$item['requiredspell']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['req_honor_rank'], $lang_item_edit['req_honor_rank_desc']) . "</td>\n <td><input type=\"text\" name=\"requiredhonorrank\" size=\"15\" maxlength=\"30\" value=\"{$item['requiredhonorrank']}\" /></td>\n</tr>\n<tr>\n <td>" . makeinfocell($lang_item_edit['req_rep_faction'], $lang_item_edit['req_rep_faction_desc']) . "</td>\n <td><input type=\"text\" name=\"RequiredReputationFaction\" size=\"15\" maxlength=\"30\" value=\"{$item['RequiredReputationFaction']}\" /></td>"; unset($AllowableRace); $RequiredReputationRank = array(0 => "", 1 => "", 2 => "", 3 => "", 4 => "", 5 => "", 6 => "", 7 => ""); $RequiredReputationRank[$item['RequiredReputationRank']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['req_rep_rank'], $lang_item_edit['req_rep_rank_desc']) . "</td>\n <td><select name=\"RequiredReputationRank\">\n <option value=\"0\" {$RequiredReputationRank[0]}>0 - {$lang_item_edit['hated']}</option>\n <option value=\"1\" {$RequiredReputationRank[1]}>1 - {$lang_item_edit['hostile']}</option>\n <option value=\"2\" {$RequiredReputationRank[2]}>2 - {$lang_item_edit['unfriendly']}</option>\n <option value=\"3\" {$RequiredReputationRank[3]}>3 - {$lang_item_edit['neutral']}</option>\n <option value=\"4\" {$RequiredReputationRank[4]}>4 - {$lang_item_edit['friendly']}</option>\n <option value=\"5\" {$RequiredReputationRank[5]}>5 - {$lang_item_edit['honored']}</option>\n <option value=\"6\" {$RequiredReputationRank[6]}>6 - {$lang_item_edit['reverted']}</option>\n <option value=\"7\" {$RequiredReputationRank[7]}>7 - {$lang_item_edit['exalted']}</option>\n </select></td>\n</tr>\n<tr>\n <td colspan=\"2\">" . makeinfocell($lang_item_edit['req_city_rank'], $lang_item_edit['req_city_rank_desc']) . "</td>\n <td colspan=\"2\"><input type=\"text\" name=\"RequiredCityRank\" size=\"15\" maxlength=\"30\" value=\"{$item['RequiredCityRank']}\" /></td>\n</tr>\n\n </table><br /><br />\n </div>"; unset($RequiredReputationRank); $output .= "<div id=\"pane7\">\n <br /><br /><table class=\"lined\" style=\"width: 720px;\">\n<tr>"; $socketColor_1 = array(0 => "", 1 => "", 2 => "", 4 => "", 8 => ""); $socketColor_1[$item['socketColor_1']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['socket_color'] . " 1", $lang_item_edit['socket_color_desc']) . "</td>\n <td><select name=\"socketColor_1\">\n <option value=\"0\" {$socketColor_1[0]}>0: {$lang_item['none']}</option>\n <option value=\"1\" {$socketColor_1[1]}>1: {$lang_item['socket_meta']}</option>\n <option value=\"2\" {$socketColor_1[2]}>2: {$lang_item['socket_red']}</option>\n <option value=\"4\" {$socketColor_1[4]}>4: {$lang_item['socket_yellow']}</option>\n <option value=\"8\" {$socketColor_1[8]}>8: {$lang_item['socket_blue']}</option>\n </select></td>\n <td>" . makeinfocell($lang_item_edit['socket_content'] . " 1", $lang_item_edit['socket_content_desc']) . "</td>\n <td><input type=\"text\" name=\"socketContent_1\" size=\"15\" maxlength=\"10\" value=\"{$item['socketContent_1']}\" /></td>\n</tr>\n<tr>"; unset($socketColor_1); $socketColor_2 = array(0 => "", 1 => "", 2 => "", 4 => "", 8 => ""); $socketColor_2[$item['socketColor_2']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['socket_color'] . " 2", $lang_item_edit['socket_color_desc']) . "</td>\n <td><select name=\"socketColor_2\">\n <option value=\"0\" {$socketColor_2[0]}>0: {$lang_item['none']}</option>\n <option value=\"1\" {$socketColor_2[1]}>1: {$lang_item['socket_meta']}</option>\n <option value=\"2\" {$socketColor_2[2]}>2: {$lang_item['socket_red']}</option>\n <option value=\"4\" {$socketColor_2[4]}>4: {$lang_item['socket_yellow']}</option>\n <option value=\"8\" {$socketColor_2[8]}>8: {$lang_item['socket_blue']}</option>\n </select></td>\n\n <td>" . makeinfocell($lang_item_edit['socket_content'] . " 2", $lang_item_edit['socket_content_desc']) . "</td>\n <td><input type=\"text\" name=\"socketContent_2\" size=\"15\" maxlength=\"10\" value=\"{$item['socketContent_2']}\" /></td>\n</tr>\n<tr>"; unset($socketColor_2); $socketColor_3 = array(0 => "", 1 => "", 2 => "", 4 => "", 8 => ""); $socketColor_3[$item['socketColor_3']] = " selected=\"selected\" "; $output .= "<td>" . makeinfocell($lang_item_edit['socket_color'] . " 3", $lang_item_edit['socket_color_desc']) . "</td>\n <td><select name=\"socketColor_3\">\n <option value=\"0\" {$socketColor_3[0]}>0: {$lang_item['none']}</option>\n <option value=\"1\" {$socketColor_3[1]}>1: {$lang_item['socket_meta']}</option>\n <option value=\"2\" {$socketColor_3[2]}>2: {$lang_item['socket_red']}</option>\n <option value=\"4\" {$socketColor_3[4]}>4: {$lang_item['socket_yellow']}</option>\n <option value=\"8\" {$socketColor_3[8]}>8: {$lang_item['socket_blue']}</option>\n </select></td>\n\n <td>" . makeinfocell($lang_item_edit['socket_content'] . " 3", $lang_item_edit['socket_content_desc']) . "</td>\n <td><input type=\"text\" name=\"socketContent_3\" size=\"15\" maxlength=\"10\" value=\"{$item['socketContent_3']}\" /></td>\n</tr>\n\n<tr>\n <td>" . makeinfocell($lang_item_edit['socket_bonus'], $lang_item_edit['socket_bonus_desc']) . "</td>\n <td><input type=\"text\" name=\"socketBonus\" size=\"15\" maxlength=\"10\" value=\"{$item['socketBonus']}\" /></td>\n\n <td>" . makeinfocell($lang_item_edit['gem_properties'], $lang_item_edit['gem_properties_desc']) . "</td>\n <td><input type=\"text\" name=\"GemProperties\" size=\"15\" maxlength=\"10\" value=\"{$item['GemProperties']}\" /></td>\n</tr>\n\n </table><br /><br />\n </div>"; $output .= "<div id=\"pane8\">\n <br /><br /><table class=\"lined\" style=\"width: 720px;\">\n <tr class=\"large_bold\"><td colspan=\"5\" class=\"hidden\" align=\"left\">{$lang_item_edit['dropped_by']}: {$lang_item_edit['top_x']}</td></tr>\n <tr>\n <th width=\"1%\">ID</th>\n <th width=\"35%\">{$lang_item_edit['mob_name']}</th>\n <th width=\"10%\">{$lang_item_edit['mob_level']}</th>\n <th width=\"25%\">{$lang_item_edit['mob_drop_chance']}</th>\n <th width=\"25%\">{$lang_item_edit['mob_quest_drop_chance']}</th>\n </tr>"; $result2 = $sql->query("SELECT entry,ChanceOrQuestChance,`groupid` FROM creature_loot_template WHERE item = {$item['entry']} ORDER BY `groupid`,ChanceOrQuestChance DESC LIMIT 5"); while ($info = $sql->fetch_row($result2)) { $result3 = $sql->query("SELECT creature_template.entry,IFNULL(" . ($deplang != 0 ? "name_loc{$deplang}" : "NULL") . ",`name`) as name,maxlevel FROM creature_template LEFT JOIN locales_creature ON creature_template.entry = locales_creature.entry WHERE lootid = {$info[0]} LIMIT 1"); while ($mob = $sql->fetch_row($result3)) { $output .= "<tr><td>"; if ($user_lvl >= $action_permission['delete']) { $output .= "<a class=\"tooltip\" href=\"creature.php?action=edit&entry={$mob['0']}&error=4\" target=\"_blank\">{$mob['0']}</a>"; } else { $output .= "{$mob['0']}"; } $output .= "</td>\n <td><a class=\"tooltip\" href=\"{$creature_datasite}{$mob['0']}\" target=\"_blank\">{$mob['1']}</a></td>\n <td>{$mob['2']}</td>\n <td>{$info['1']}%</td>\n <td>{$info['2']}%</td></tr>"; } } $result2 = $sql->query("SELECT creature_template.entry,IFNULL(" . ($deplang != 0 ? "name_loc{$deplang}" : "NULL") . ",`name`) as name,maxlevel FROM creature_template LEFT JOIN locales_creature ON creature_template.entry = locales_creature.entry WHERE creature_template.entry IN (SELECT entry FROM npc_vendor WHERE item = {$item['entry']}) ORDER BY maxlevel DESC LIMIT 5"); if ($sql->num_rows($result2)) { $output .= "<tr class=\"large_bold\"><td colspan=\"4\" class=\"hidden\" align=\"left\">{$lang_item_edit['sold_by']}: {$lang_item_edit['limit_x']}</td></tr>"; while ($mob = $sql->fetch_row($result2)) { $output .= "<tr>\n <td width=\"10%\">"; if ($user_lvl >= $action_permission['delete']) { $output .= "<a class=\"tooltip\" href=\"creature.php?action=edit&entry={$mob['0']}&error=4\" target=\"_blank\">{$mob['0']}</a>"; } else { $output .= "{$mob['0']}"; } $output .= "\n <td width=\"10%\">{$mob['2']}</td>\n <td width=\"80%\" colspan=\"2\" align=\"left\">\n <a class=\"tooltip\" href=\"{$creature_datasite}{$mob['0']}\" target=\"_blank\">{$mob['1']}</a></td>\n </td></tr>"; } } $result2 = $sql->query("SELECT quest_template.entry,IFNULL(" . ($deplang != 0 ? "title_loc{$deplang}" : "NULL") . ",`title`) as title,QuestLevel FROM quest_template LEFT JOIN locales_quest ON quest_template.entry = locales_quest.entry WHERE ( SrcItemId = {$item['entry']} OR ReqItemId1 = {$item['entry']} OR\n ReqItemId2 = {$item['entry']} OR ReqItemId3 = {$item['entry']} OR ReqItemId4 = {$item['entry']} OR RewItemId1 = {$item['entry']} OR\n RewItemId2 = {$item['entry']} OR RewItemId3 = {$item['entry']} OR RewItemId4 = {$item['entry']} ) ORDER BY QuestLevel DESC"); if ($sql->num_rows($result2)) { $output .= "<tr class=\"large_bold\"><td colspan=\"4\" class=\"hidden\" align=\"left\">{$lang_item_edit['involved_in_quests']}:</td></tr>"; while ($quest = $sql->fetch_row($result2)) { $output .= "<tr><td width=\"20%\">id: {$quest['0']}</td>\n <td width=\"80%\" colspan=\"3\" align=\"left\"><a class=\"tooltip\" href=\"{$quest_datasite}{$quest['0']}\" target=\"_blank\">({$quest['2']}) {$quest['1']}</a></td></tr>"; } } $result2 = $sql->query("SELECT quest_template.entry,IFNULL(" . ($deplang != 0 ? "title_loc{$deplang}" : "NULL") . ",`title`) as title,QuestLevel FROM quest_template LEFT JOIN locales_quest ON quest_template.entry = locales_quest.entry WHERE ( RewChoiceItemId1 = {$item['entry']} OR RewChoiceItemId2 = {$item['entry']} OR\n RewChoiceItemId3 = {$item['entry']} OR RewChoiceItemId4 = {$item['entry']} OR RewChoiceItemId5 = {$item['entry']} OR RewChoiceItemId6 = {$item['entry']} )\n ORDER BY QuestLevel DESC"); if ($sql->num_rows($result2)) { $output .= "<tr class=\"large_bold\"><td colspan=\"4\" class=\"hidden\" align=\"left\">{$lang_item_edit['reward_from_quest']}:</td></tr>"; while ($quest = $sql->fetch_row($result2)) { $output .= "<tr><td width=\"20%\">id: {$quest['0']}</td>\n <td width=\"80%\" colspan=\"3\" align=\"left\"><a class=\"tooltip\" href=\"{$quest_datasite}{$quest['0']}\" target=\"_blank\">({$quest['2']}) {$quest['1']}</a></td></tr>"; } } $output .= "</tr></table><br /><br />\n </div>"; if ($item['DisenchantID']) { $output .= "<div id=\"pane9\">\n <br /><br /><table class=\"lined\" style=\"width: 720px;\">\n <tr class=\"large_bold\"><td colspan=\"6\" class=\"hidden\" align=\"left\">{$lang_item_edit['disenchant_templ']}: {$item['DisenchantID']}</td></tr>\n <tr><td colspan=\"6\">"; $cel_counter = 0; $row_flag = 0; $output .= "<table class=\"hidden\" align=\"center\"><tr>"; $result1 = $sql->query("SELECT item,ChanceOrQuestChance,`groupid`,mincountOrRef,maxcount,lootcondition,condition_value1, condition_value2 FROM disenchant_loot_template WHERE entry = {$item['DisenchantID']} ORDER BY ChanceOrQuestChance DESC"); while ($item = $sql->fetch_row($result1)) { $cel_counter++; $tooltip = get_item_name($item[0]) . " ({$item['0']})<br />{$lang_item_edit['drop_chance']}: {$item['1']}%<br />{$lang_item_edit['quest_drop_chance']}: {$item['2']}%<br />{$lang_item_edit['drop_chance']}: {$item['3']}-{$item['4']}<br />{$lang_item_edit['lootcondition']}: {$item['5']}<br />{$lang_item_edit['condition_value1']}: {$item['6']}<br />{$lang_item_edit['condition_value2']}: {$item['7']}"; $output .= "<td>"; $output .= maketooltip("<img src=\"" . get_item_icon($item[0]) . "\" class=\"icon_border\" alt=\"\" />", "{$item_datasite}{$item['0']}", $tooltip, "item_tooltip"); $output .= "<br /><input type=\"checkbox\" name=\"del_de_items[]\" value=\"{$item['0']}\" /></td>"; if ($cel_counter >= 16) { $cel_counter = 0; $output .= "</tr><tr>"; $row_flag++; } } if ($row_flag) { $output .= "<td colspan=\"" . (16 - $cel_counter) . "\"></td>"; } $output .= "</td></tr></table>\n </td>\n</tr>\n<tr class=\"large_bold\"><td colspan=\"6\" class=\"hidden\" align=\"left\">{$lang_item_edit['add_items_to_templ']}:</td></tr>\n<tr>\n<td>" . makeinfocell($lang_item_edit['loot_item_id'], $lang_item_edit['loot_item_id_desc']) . "</td>\n <td><input type=\"text\" name=\"de_item\" size=\"8\" maxlength=\"10\" value=\"\" /></td>\n<td>" . makeinfocell($lang_item_edit['loot_drop_chance'], $lang_item_edit['loot_drop_chance_desc']) . "</td>\n <td><input type=\"text\" name=\"de_ChanceOrQuestChance\" size=\"8\" maxlength=\"11\" value=\"0\" /></td>\n<td>" . makeinfocell($lang_item_edit['loot_quest_drop_chance'], $lang_item_edit['loot_quest_drop_chance_desc']) . "</td>\n <td><input type=\"text\" name=\"de_groupid\" size=\"8\" maxlength=\"10\" value=\"0\" /></td>\n</tr>\n<tr>\n<td>" . makeinfocell($lang_item_edit['min_count'], $lang_item_edit['min_count_desc']) . "</td>\n <td><input type=\"text\" name=\"de_mincountOrRef\" size=\"8\" maxlength=\"3\" value=\"1\" /></td>\n<td>" . makeinfocell($lang_item_edit['max_count'], $lang_item_edit['max_count_desc']) . "</td>\n <td><input type=\"text\" name=\"de_maxcount\" size=\"8\" maxlength=\"3\" value=\"1\" /></td>\n</tr>\n<tr>\n<td>" . makeinfocell($lang_item_edit['lootcondition'], $lang_item_edit['lootcondition_desc']) . "</td>\n <td><input type=\"text\" name=\"de_lootcondition\" size=\"8\" maxlength=\"3\" value=\"0\" /></td>\n<td>" . makeinfocell($lang_item_edit['condition_value1'], $lang_item_edit['condition_value1_desc']) . "</td>\n <td><input type=\"text\" name=\"de_condition_value1\" size=\"8\" maxlength=\"3\" value=\"0\" /></td>\n<td>" . makeinfocell($lang_item_edit['condition_value2'], $lang_item_edit['condition_value2_desc']) . "</td>\n <td><input type=\"text\" name=\"de_condition_value2\" size=\"8\" maxlength=\"3\" value=\"0\" /></td>\n</tr>\n</table>\n</div>"; } $output .= "</div>\n</div>\n<br />\n</form>\n\n<script type=\"text/javascript\">setupPanes(\"container\", \"tab1\")</script>"; unset($socketColor_3); $output .= "\n <table class=\"hidden\">\n <tr>\n <td>"; if ($user_lvl >= $action_permission['delete']) { makebutton($lang_item_edit['del_item'], "item.php?action=delete&entry={$entry}\" type=\"wrn", 180); } $output .= "\n </td>\n <td>"; if ($user_lvl >= $action_permission['update']) { makebutton($lang_item_edit['update'], "javascript:do_submit('form1',0)\" type=\"wrn", 180); } $output .= "\n </td>\n <td>"; if ($user_lvl >= $action_permission['insert']) { makebutton($lang_item_edit['export_sql'], "javascript:do_submit('form1',1)", 180); } $output .= "\n </td>\n <td>"; makebutton($lang_global['back'], "javascript:window.history.back()", 130); $output .= "\n </td>\n <td>"; makebutton($lang_item_edit['new_search'], "item.php", 130); $output .= "\n </td>\n </tr>\n </table>\n </center>\n"; } else { error($lang_item_edit['item_not_found']); exit; } }
function dobackup() { global $lang_backup, $backup_dir, $tables_backup_realmd, $tables_backup_characters, $output, $realm_db, $characters_db, $realm_id, $tab_backup_user_realmd, $tab_backup_user_characters; if (empty($_GET['backup_action']) || empty($_GET['backup_from_to'])) { redirect("backup.php?error=1"); } else { $backup_action = addslashes($_GET['backup_action']); $backup_from_to = addslashes($_GET['backup_from_to']); } if ("load" == $backup_action && "file" == $backup_from_to) { if (!eregi("(\\.(sql|qbquery))\$", $_FILES["uploaded_file"]["name"])) { error($lang_backup['upload_sql_file_only']); } $uploaded_filename = str_replace(" ", "_", $_FILES["uploaded_file"]["name"]); $uploaded_filename = preg_replace("/[^_A-Za-z0-9-\\.]/i", '', $uploaded_filename); $file_name_new = $uploaded_filename . "_" . date("m.d.y_H.i.s") . ".sql"; move_uploaded_file($_FILES["uploaded_file"]["tmp_name"], "{$backup_dir}/{$file_name_new}") or die(error("{$lang_backup['upload_err_write_permission']} {$backup_dir}")); if (file_exists("{$backup_dir}/{$file_name_new}")) { require_once "libs/db_lib/sql_lib.php"; $use_db = addslashes($_POST['use_db']); if ($use_db == $realm_db['name']) { $queries = run_sql_script($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name'], "{$backup_dir}/{$file_name_new}", true); } else { foreach ($characters_db as $db) { if ($use_db == $db['name']) { $queries = run_sql_script($db['addr'], $db['user'], $db['pass'], $db['name'], "{$backup_dir}/{$file_name_new}", true); } } } redirect("backup.php?error=4&tot={$queries}"); } else { error($lang_backup['file_not_found']); } } elseif ("load" == $backup_action && "web" == $backup_from_to) { if (empty($_POST['selected_file_name'])) { redirect("backup.php?error=1"); } else { $file_name = addslashes($_POST['selected_file_name']); } if (file_exists("{$backup_dir}/{$file_name}")) { require_once "libs/db_lib/sql_lib.php"; $use_db = addslashes($_POST['use_db']); if ($use_db == $realm_db['name']) { $queries = run_sql_script($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name'], "{$backup_dir}/{$file_name}", false); } else { foreach ($characters_db as $db) { if ($use_db == $db['name']) { $queries = run_sql_script($db['addr'], $db['user'], $db['pass'], $db['name'], "{$backup_dir}/{$file_name}", false); } } } redirect("backup.php?error=4&tot={$queries}"); } else { error($lang_backup['file_not_found']); } } elseif ("save" == $backup_action && "file" == $backup_from_to) { //save and send to user $struc_backup = addslashes($_GET['struc_backup']); $save_all_realms = addslashes($_GET['save_all_realms']); if ($save_all_realms) { $temp_id = "all_realms"; } else { $temp_id = "realmid_" . $realm_id; } $file_name_new = $temp_id . "_backup_" . date("m.d.y_H.i.s") . ".sql"; $fp = fopen("{$backup_dir}/{$file_name_new}", 'w') or die(error($lang_backup['file_write_err'])); fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$realm_db['name']};\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "USE {$realm_db['name']};\n\n") or die(error($lang_backup['file_write_err'])); fclose($fp); require_once "libs/db_lib/sql_lib.php"; foreach ($tables_backup_realmd as $value) { sql_table_dump($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name'], $value, $struc_backup, "{$backup_dir}/{$file_name_new}"); } if ($save_all_realms) { foreach ($characters_db as $db) { $fp = fopen("{$backup_dir}/{$file_name_new}", 'r+') or die(error($lang_backup['file_write_err'])); fseek($fp, 0, SEEK_END); fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$db['name']};\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "USE {$db['name']};\n\n") or die(error($lang_backup['file_write_err'])); fclose($fp); foreach ($tables_backup_characters as $value) { sql_table_dump($db['addr'], $db['user'], $db['pass'], $db['name'], $value, $struc_backup, "{$backup_dir}/{$file_name_new}"); } } } else { $fp = fopen("{$backup_dir}/{$file_name_new}", 'r+') or die(error($lang_backup['file_write_err'])); fseek($fp, 0, SEEK_END); fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$characters_db[$realm_id]['name']};\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "USE {$characters_db[$realm_id]['name']};\n\n") or die(error($lang_backup['file_write_err'])); fclose($fp); foreach ($tables_backup_characters as $value) { sql_table_dump($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name'], $value, $struc_backup, "{$backup_dir}/{$file_name_new}"); } } Header("Content-type: application/octet-stream"); Header("Content-Disposition: attachment; filename={$file_name_new}"); $fp = fopen("{$backup_dir}/{$file_name_new}", 'r') or die(error($lang_backup['file_write_err'])); while (!feof($fp)) { $output_file = fread($fp, 1024); echo $output_file; } fclose($fp); unlink("{$backup_dir}/{$file_name_new}"); exit; } elseif ("save" == $backup_action && "web" == $backup_from_to) { //save backup to web/backup folder $struc_backup = addslashes($_GET['struc_backup']); $save_all_realms = addslashes($_GET['save_all_realms']); $file_name_new = $realm_db['name'] . "_backup_" . date("m.d.y_H.i.s") . ".sql"; $fp = fopen("{$backup_dir}/{$file_name_new}", 'w') or die(error($lang_backup['file_write_err'])); fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$realm_db['name']};\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "USE {$realm_db['name']};\n\n") or die(error($lang_backup['file_write_err'])); fclose($fp); require_once "libs/db_lib/sql_lib.php"; foreach ($tables_backup_realmd as $value) { sql_table_dump($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name'], $value, $struc_backup, "{$backup_dir}/{$file_name_new}"); } fclose($fp); if ($save_all_realms) { foreach ($characters_db as $db) { $file_name_new = $db['name'] . "_backup_" . date("m.d.y_H.i.s") . ".sql"; $fp = fopen("{$backup_dir}/{$file_name_new}", 'w') or die(error($lang_backup['file_write_err'])); fseek($fp, 0, SEEK_END); fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$db['name']};\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "USE {$db['name']};\n\n") or die(error($lang_backup['file_write_err'])); fclose($fp); foreach ($tables_backup_characters as $value) { sql_table_dump($db['addr'], $db['user'], $db['pass'], $db['name'], $value, $struc_backup, "{$backup_dir}/{$file_name_new}"); } fclose($fp); } } else { $file_name_new = $characters_db[$realm_id]['name'] . "_backup_" . date("m.d.y_H.i.s") . ".sql"; $fp = fopen("{$backup_dir}/{$file_name_new}", 'w') or die(error($lang_backup['file_write_err'])); fseek($fp, 0, SEEK_END); fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$characters_db[$realm_id]['name']};\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "USE {$characters_db[$realm_id]['name']};\n\n") or die(error($lang_backup['file_write_err'])); fclose($fp); foreach ($tables_backup_characters as $value) { sql_table_dump($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name'], $value, $struc_backup, "{$backup_dir}/{$file_name_new}"); } fclose($fp); } redirect("backup.php?error=2"); exit; } elseif ("save" == $backup_action && "acc_on_file" == $backup_from_to) { //save evry account in different file $struc_backup = addslashes($_GET['struc_backup']); $save_all_realms = addslashes($_GET['save_all_realms']); $sql = new SQL(); $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $query = $sql->query("SELECT id FROM account"); $subdir = "{$backup_dir}/accounts/" . date("m_d_y_H_i_s"); mkdir($subdir, 0750); while ($acc = $sql->fetch_array($query)) { $file_name_new = $acc[0] . "_{$realm_db['name']}.sql"; $fp = fopen("{$subdir}/{$file_name_new}", 'w') or die(error($lang_backup['file_write_err'])); fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$realm_db['name']};\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "USE {$realm_db['name']};\n\n") or die(error($lang_backup['file_write_err'])); $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); foreach ($tab_backup_user_realmd as $value) { $acc_query = $sql->query("SELECT * FROM {$value['0']} WHERE {$value['1']} = {$acc['0']}"); $num_fields = $sql->num_fields($acc_query); $numrow = $sql->num_rows($acc_query); $result = "-- Dumping data for {$value['0']} " . date("m.d.y_H.i.s") . "\n"; $result .= "LOCK TABLES {$value['0']} WRITE;\n"; $result .= "DELETE FROM {$value['0']} WHERE {$value['1']} = {$acc['0']};\n"; if ($numrow) { $result .= "INSERT INTO {$value['0']} ("; for ($count = 0; $count < $num_fields; $count++) { $result .= "`" . $sql->field_name($acc_query, $count) . "`"; if ($count < $num_fields - 1) { $result .= ","; } } $result .= ") VALUES \n"; for ($i = 0; $i < $numrow; $i++) { $result .= "\t("; $row = $sql->fetch_row($acc_query); for ($j = 0; $j < $num_fields; $j++) { $row[$j] = addslashes($row[$j]); $row[$j] = ereg_replace("\n", "\\n", $row[$j]); if (isset($row[$j])) { if ($sql->field_type($acc_query, $j) == "int") { $result .= "{$row[$j]}"; } else { $result .= "'{$row[$j]}'"; } } else { $result .= "''"; } if ($j < $num_fields - 1) { $result .= ","; } } if ($i < $numrow - 1) { $result .= "),\n"; } } $result .= ");\n"; } $result .= "UNLOCK TABLES;\n"; $result .= "\n"; fwrite($fp, $result) or die(error($lang_backup['file_write_err'])); } fclose($fp); foreach ($characters_db as $db) { $file_name_new = $acc[0] . "_{$db['name']}.sql"; $fp = fopen("{$subdir}/{$file_name_new}", 'w') or die(error($lang_backup['file_write_err'])); fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$db['name']};\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "USE {$db['name']};\n\n") or die(error($lang_backup['file_write_err'])); $sql->connect($db['addr'], $db['user'], $db['pass'], $db['name']); $all_char_query = $sql->query("SELECT guid,name FROM `characters` WHERE account = {$acc['0']}"); while ($char = $sql->fetch_array($all_char_query)) { fwrite($fp, "-- Dumping data for character {$char['1']}\n") or die(error($lang_backup['file_write_err'])); foreach ($tab_backup_user_characters as $value) { $char_query = $sql->query("SELECT * FROM {$value['0']} WHERE {$value['1']} = {$char['0']}"); $num_fields = $sql->num_fields($char_query); $numrow = $sql->num_rows($char_query); $result = "LOCK TABLES {$value['0']} WRITE;\n"; $result .= "DELETE FROM {$value['0']} WHERE {$value['1']} = {$char['0']};\n"; if ($numrow) { $result .= "INSERT INTO {$value['0']} ("; for ($count = 0; $count < $num_fields; $count++) { $result .= "`" . $sql->field_name($char_query, $count) . "`"; if ($count < $num_fields - 1) { $result .= ","; } } $result .= ") VALUES \n"; for ($i = 0; $i < $numrow; $i++) { $result .= "\t("; $row = $sql->fetch_row($char_query); for ($j = 0; $j < $num_fields; $j++) { $row[$j] = addslashes($row[$j]); $row[$j] = ereg_replace("\n", "\\n", $row[$j]); if (isset($row[$j])) { if ($sql->field_type($char_query, $j) == "int") { $result .= "{$row[$j]}"; } else { $result .= "'{$row[$j]}'"; } } else { $result .= "''"; } if ($j < $num_fields - 1) { $result .= ","; } } if ($i < $numrow - 1) { $result .= "),\n"; } } $result .= ");\n"; } $result .= "UNLOCK TABLES;\n"; $result .= "\n"; fwrite($fp, $result) or die(error($lang_backup['file_write_err'])); } } fclose($fp); } } $sql->close(); unset($sql); redirect("backup.php?error=2"); } elseif ("load" == $backup_action && "acc_on_file" == $backup_from_to) { //load saved account if (empty($_POST['selected_file_name']) || empty($_POST['file_dir'])) { redirect("backup.php?error=1"); } else { $file_name = addslashes($_POST['selected_file_name']); $file_dir = addslashes($_POST['file_dir']); $use_db = addslashes($_POST['use_db']); } $file_tmp = "{$backup_dir}/accounts/{$file_dir}/" . $file_name . "_{$use_db}.sql"; if (file_exists($file_tmp)) { require_once "libs/db_lib/sql_lib.php"; if ($use_db == $realm_db['name']) { $queries = run_sql_script($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name'], "{$backup_dir}/accounts/{$file_dir}/{$file_name}.sql", true); } else { foreach ($characters_db as $db) { if ($use_db == $db['name']) { $queries = run_sql_script($db['addr'], $db['user'], $db['pass'], $db['name'], "{$backup_dir}/accounts/{$file_dir}/{$file_name}.sql", true); } } } redirect("backup.php?error=4&tot={$queries}"); } else { error($lang_backup['file_not_found']); } } else { //non of the options = error redirect("backup.php?error=1"); } }
function edit_ticket() { global $lang_global, $lang_ticket, $output, $characters_db, $realm_id, $action_permission; valid_login($action_permission['update']); if (!isset($_GET['id'])) { redirect("Location: ticket.php?error=1"); } $sqlc = new SQL(); $sqlc->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $id = $sqlc->quote_smart($_GET['id']); if (is_numeric($id)) { } else { redirect("ticket.php?error=1"); } $query = $sqlc->query("SELECT gm_tickets.guid, gm_tickets.message text, `characters`.name\r\n FROM gm_tickets,`characters`\r\n LEFT JOIN gm_tickets k1 ON k1.`guid`=`characters`.`guid`\r\n WHERE gm_tickets.guid = `characters`.`guid` AND gm_tickets.guid = '{$id}'"); if ($ticket = $sqlc->fetch_row($query)) { $output .= "\r\n <center>\r\n <fieldset style=\"width: 550px;\">\r\n <legend>{$lang_ticket['edit_reply']}</legend>\r\n <form method=\"post\" action=\"ticket.php?action=do_edit_ticket\" name=\"form\">\r\n <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\r\n <table class=\"flat\">\r\n <tr>\r\n <td>{$lang_ticket['ticket_id']}</td>\r\n <td>{$id}</td>\r\n </tr>\r\n <tr>\r\n <td>{$lang_ticket['submitted_by']}:</td>\r\n <td><a href=\"char.php?id={$ticket['0']}\">" . htmlentities($ticket[2]) . "</a></td>\r\n </tr>\r\n <tr>\r\n <td valign=\"top\">{$lang_ticket['ticket_text']}</td>\r\n <td><textarea name=\"new_text\" rows=\"5\" cols=\"40\">" . htmlentities($ticket[1]) . "</textarea></td>\r\n </tr>\r\n <tr>\r\n <td>"; makebutton($lang_ticket['update'], "javascript:do_submit()\" type=\"wrn", 130); $output .= "\r\n </td>\r\n <td>\r\n <table class=\"hidden\">\r\n <tr>\r\n <td>"; makebutton($lang_ticket['send_ingame_mail'], "mail.php?type=ingame_mail&to={$ticket['2']}", 130); $output .= "\r\n </td>\r\n <td>"; makebutton($lang_global['back'], "ticket.php\" type=\"def", 130); $output .= "\r\n </td>\r\n </tr>\r\n </table>"; $output .= "\r\n </td>\r\n </tr>\r\n </table>\r\n </form>\r\n </fieldset>\r\n <br /><br />\r\n </center>"; } else { error($lang_global['err_no_records_found']); } }
function get_item_tooltip($item_id) { global $lang_item, $lang_id_tab, $world_db, $realm_id, $language; if ($item_id) { $sqlw = new SQL(); $sqlw->connect($world_db[$realm_id]['addr'], $world_db[$realm_id]['user'], $world_db[$realm_id]['pass'], $world_db[$realm_id]['name']); $deplang = get_lang_id(); $result_1 = $sqlw->query("SELECT stat_type1,stat_value1,stat_type2,\r\n stat_value2,stat_type3,stat_value3,stat_type4,stat_value4,stat_type5,\r\n stat_value5,stat_type6,stat_value6,stat_type7,stat_value7,stat_type8,\r\n stat_value8,stat_type9,stat_value9,stat_type10,stat_value10,armor,\r\n holy_res,fire_res,nature_res,frost_res,arcane_res,shadow_res,spellid_1,\r\n spellid_2,spellid_3,spellid_4,spellid_5,\r\n IFNULL(" . ($deplang != 0 ? "name_loc{$deplang}" : "NULL") . ",name),class,subclass,\r\n Quality,RequiredLevel,dmg_min1,dmg_max1,dmg_type1,dmg_min2,dmg_max2,\r\n dmg_type2,delay,bonding,description,itemset,item_template.entry,\r\n InventoryType,ItemLevel,displayid,maxcount,spelltrigger_1,spelltrigger_2,\r\n spelltrigger_3,spelltrigger_4,spelltrigger_5,ContainerSlots,\r\n spellcharges_1,spellcharges_2,spellcharges_3,spellcharges_4,\r\n spellcharges_5,AllowableClass,socketColor_1,socketColor_2,socketColor_3,\r\n RandomProperty,RandomSuffix\r\n FROM item_template LEFT JOIN locales_item ON item_template.entry = locales_item.entry\r\n WHERE item_template.entry = '{$item_id}' LIMIT 1"); if ($item = $sqlw->fetch_row($result_1)) { $tooltip = ""; $itemname = htmlspecialchars($item[32]); switch ($item[35]) { case 0: //Grey Poor $tooltip .= "<font color='#b2c2b9' class='large'>{$itemname}</font><br />"; break; case 1: //White Common $tooltip .= "<font color='white' class='large'>{$itemname}</font><br />"; break; case 2: //Green Uncommon $tooltip .= "<font color='#1eff00' class='large'>{$itemname}</font><br />"; break; case 3: //Blue Rare $tooltip .= "<font color='#0070dd' class='large'>{$itemname}</font><br />"; break; case 4: //Purple Epic $tooltip .= "<font color='#a335ee' class='large'>{$itemname}</font><br />"; break; case 5: //Orange Legendary $tooltip .= "<font color='orange' class='large'>{$itemname}</font><br />"; break; case 6: //Red Artifact $tooltip .= "<font color='red' class='large'>{$itemname}</font><br />"; break; default: } $tooltip .= "<font color='white'>"; switch ($item[53]) { case 1: //Binds when Picked Up $tooltip .= "{$lang_item['bop']}<br />"; break; case 2: //Binds when Equipped $tooltip .= "{$lang_item['boe']}<br />"; break; case 3: //Binds when Used $tooltip .= "{$lang_item['bou']}<br />"; break; case 4: //Quest Item $tooltip .= "{$lang_item['quest_item']}<br />"; break; default: } if ($item[60]) { $tooltip .= "{$lang_item['unique']}<br />"; } $tooltip .= "<br />"; switch ($item[57]) { case 1: $tooltip .= "{$lang_item['head']} - "; break; case 2: $tooltip .= "{$lang_item['neck']} - "; break; case 3: $tooltip .= "{$lang_item['shoulder']} - "; break; case 4: $tooltip .= "{$lang_item['shirt']} - "; break; case 5: $tooltip .= "{$lang_item['chest']} - "; break; case 6: $tooltip .= "{$lang_item['belt']} - "; break; case 7: $tooltip .= "{$lang_item['legs']} - "; break; case 8: $tooltip .= "{$lang_item['feet']} - "; break; case 9: $tooltip .= "{$lang_item['wrist']} - "; break; case 10: $tooltip .= "{$lang_item['gloves']} - "; break; case 11: $tooltip .= "{$lang_item['finger']} - "; break; case 12: $tooltip .= "{$lang_item['trinket']} - "; break; case 13: $tooltip .= "{$lang_item['one_hand']} - "; break; case 14: $tooltip .= "{$lang_item['off_hand']} - "; break; case 16: $tooltip .= "{$lang_item['back']} - "; break; case 18: $tooltip .= "{$lang_item['bag']}"; break; case 19: $tooltip .= "{$lang_item['tabard']} - "; break; case 20: $tooltip .= "{$lang_item['robe']} - "; break; case 21: $tooltip .= "{$lang_item['main_hand']} - "; break; case 23: $tooltip .= "{$lang_item['tome']} - "; break; default: } switch ($item[33]) { case 0: //Consumable $tooltip .= "{$lang_item['consumable']}<br />"; break; case 2: //Weapon switch ($item[34]) { case 0: $tooltip .= "{$lang_item['axe_1h']}<br />"; break; case 1: $tooltip .= "{$lang_item['axe_2h']}<br />"; break; case 2: $tooltip .= "{$lang_item['bow']}<br />"; break; case 3: $tooltip .= "{$lang_item['rifle']}<br />"; break; case 4: $tooltip .= "{$lang_item['mace_1h']}<br />"; break; case 5: $tooltip .= "{$lang_item['mace_2h']}<br />"; break; case 6: $tooltip .= "{$lang_item['polearm']}<br />"; break; case 7: $tooltip .= "{$lang_item['sword_1h']}<br />"; break; case 8: $tooltip .= "{$lang_item['sword_2h']}<br />"; break; case 10: $tooltip .= "{$lang_item['staff']}<br />"; break; case 11: $tooltip .= "{$lang_item['exotic_1h']}<br />"; break; case 12: $tooltip .= "{$lang_item['exotic_2h']}<br />"; break; case 13: $tooltip .= "{$lang_item['fist_weapon']}<br />"; break; case 14: $tooltip .= "{$lang_item['misc_weapon']}<br />"; break; case 15: $tooltip .= "{$lang_item['dagger']}<br />"; break; case 16: $tooltip .= "{$lang_item['thrown']}<br />"; break; case 17: $tooltip .= "{$lang_item['spear']}<br />"; break; case 18: $tooltip .= "{$lang_item['crossbow']}<br />"; break; case 19: $tooltip .= "{$lang_item['wand']}<br />"; break; case 20: $tooltip .= "{$lang_item['fishing_pole']}<br />"; break; default: } break; case 4: //Armor switch ($item[34]) { case 0: $tooltip .= "{$lang_item['misc']}<br />"; break; case 1: $tooltip .= "{$lang_item['cloth']}<br />"; break; case 2: $tooltip .= "{$lang_item['leather']}<br />"; break; case 3: $tooltip .= "{$lang_item['mail']}<br />"; break; case 4: $tooltip .= "{$lang_item['plate']}<br />"; break; case 6: $tooltip .= "{$lang_item['shield']}<br />"; break; default: } break; case 6: //Projectile switch ($item[34]) { case 2: $tooltip .= "{$lang_item['arrows']}<br />"; break; case 3: $tooltip .= "{$lang_item['bullets']}<br />"; break; default: } break; case 7: //Trade Goods switch ($item[34]) { case 0: $tooltip .= "{$lang_item['trade_goods']}<br />"; break; case 1: $tooltip .= "{$lang_item['parts']}<br />"; break; case 2: $tooltip .= "{$lang_item['explosives']}<br />"; break; case 3: $tooltip .= "{$lang_item['devices']}<br />"; break; default: } break; case 9: //Recipe switch ($item[34]) { case 0: $tooltip .= "{$lang_item['book']}<br />"; break; case 1: $tooltip .= "{$lang_item['LW_pattern']}<br />"; break; case 2: $tooltip .= "{$lang_item['tailoring_pattern']}<br />"; break; case 3: $tooltip .= "{$lang_item['ENG_Schematic']}<br />"; break; case 4: $tooltip .= "{$lang_item['BS_plans']}<br />"; break; case 5: $tooltip .= "{$lang_item['cooking_recipe']}<br />"; break; case 6: $tooltip .= "{$lang_item['alchemy_recipe']}<br />"; break; case 7: $tooltip .= "{$lang_item['FA_manual']}<br />"; break; case 8: $tooltip .= "{$lang_item['ench_formula']}<br />"; break; case 9: $tooltip .= "{$lang_item['JC_formula']}<br />"; break; default: } break; case 11: //Quiver switch ($item[34]) { case 2: $tooltip .= " {$lang_item['quiver']}<br />"; break; case 3: $tooltip .= " {$lang_item['ammo_pouch']}<br />"; break; default: } break; case 12: //Quest if ($item[53] != 4) { $tooltip .= "{$lang_item['quest_item']}<br />"; } break; case 13: //key switch ($item[34]) { case 0: $tooltip .= "{$lang_item['key']}<br />"; break; case 1: $tooltip .= "{$lang_item['lockpick']}<br />"; break; default: } break; default: } $tooltip .= "{$item['20']} {$lang_item['armor']}<br />"; for ($f = 37; $f <= 51; $f += 3) { $dmg_type = $item[$f + 2]; $min_dmg_value = $item[$f]; $max_dmg_value = $item[$f + 1]; if ($min_dmg_value && $max_dmg_value) { switch ($dmg_type) { case 0: // Physical $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['damage']}<br />(" . ($item[52] ? round(($min_dmg_value + $max_dmg_value) / 2 / ($item[52] / 1000), 2) : $min_dmg_value) . " DPS) {$lang_item['speed']} : " . $item[52] / 1000 . "<br />"; break; case 1: // Holy $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['holy_dmg']}<br />"; break; case 2: // Fire $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['fire_dmg']}<br />"; break; case 3: // Nature $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['nature_dmg']}<br />"; break; case 4: // Frost $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['frost_dmg']}<br />"; break; case 5: // Shadow $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['shadow_dmg']}<br />"; break; case 6: // Arcane $tooltip .= "{$min_dmg_value} - {$max_dmg_value} {$lang_item['arcane_dmg']}<br />"; break; default: } } } //basic status for ($s = 0; $s <= 18; $s += 2) { $stat_value = $item[$s + 1]; if ($item[$s] && $stat_value) { switch ($item[$s]) { case 1: $tooltip .= "+{$stat_value} {$lang_item['health']}<br />"; break; case 2: $tooltip .= "+{$stat_value} {$lang_item['mana']}<br />"; break; case 3: $tooltip .= "+{$stat_value} {$lang_item['agility']}<br />"; break; case 4: $tooltip .= "+{$stat_value} {$lang_item['strength']}<br />"; break; case 5: $tooltip .= "+{$stat_value} {$lang_item['intellect']}<br />"; break; case 6: $tooltip .= "+{$stat_value} {$lang_item['spirit']}<br />"; break; case 7: $tooltip .= "+{$stat_value} {$lang_item['stamina']}<br />"; break; default: $flag_rating = 1; } } } if ($item[21]) { $tooltip .= "{$item['21']} {$lang_item['res_holy']}<br />"; } if ($item[25]) { $tooltip .= "{$item['25']} {$lang_item['res_arcane']}<br />"; } if ($item[22]) { $tooltip .= "{$item['22']} {$lang_item['res_fire']}<br />"; } if ($item[23]) { $tooltip .= "{$item['23']} {$lang_item['res_nature']}<br />"; } if ($item[24]) { $tooltip .= "{$item['24']} {$lang_item['res_frost']}<br />"; } if ($item[26]) { $tooltip .= "{$item['26']} {$lang_item['res_shadow']}<br />"; } //sockets for ($p = 72; $p <= 74; $p++) { if ($item[$p]) { switch ($item[$p]) { case 1: $tooltip .= "<img src='img/socket_meta.gif' alt='' /><font color='gray'> {$lang_item['socket_meta']}</font><br />"; break; case 2: $tooltip .= "<img src='img/socket_red.gif' alt='' /><font color='red'> {$lang_item['socket_red']}</font><br />"; break; case 4: $tooltip .= "<img src='img/socket_yellow.gif' alt='' /><font color='yellow'> {$lang_item['socket_yellow']}</font><br />"; break; case 8: $tooltip .= "<img src='img/socket_blue.gif' alt='' /><font color='blue'> {$lang_item['socket_blue']}</font><br />"; break; default: } } } //level requierment if ($item[36]) { $tooltip .= "{$lang_item['lvl_req']} {$item['36']}<br />"; } //allowable classes if ($item[71] && $item[71] != -1 && $item[71] != 1503) { $tooltip .= "{$lang_item['class']}:"; if ($item[71] & 1) { $tooltip .= " {$lang_id_tab['warrior']} "; } if ($item[71] & 2) { $tooltip .= " {$lang_id_tab['paladin']} "; } if ($item[71] & 4) { $tooltip .= " {$lang_id_tab['hunter']} "; } if ($item[71] & 8) { $tooltip .= " {$lang_id_tab['rogue']} "; } if ($item[71] & 16) { $tooltip .= " {$lang_id_tab['priest']} "; } if ($item[71] & 64) { $tooltip .= " {$lang_id_tab['shaman']} "; } if ($item[71] & 128) { $tooltip .= " {$lang_id_tab['mage']} "; } if ($item[71] & 256) { $tooltip .= " {$lang_id_tab['warlock']} "; } if ($item[71] & 1024) { $tooltip .= " {$lang_id_tab['druid']} "; } $tooltip .= "<br />"; } //number of bag slots if ($item[66]) { $tooltip .= " {$item['66']} {$lang_item['slots']}<br />"; } $tooltip .= "</font><br /><font color='#1eff00'>"; //random enchantments if ($item[75] || $item[76]) { $tooltip .= "< Random enchantment ><br />"; } //Ratings additions. if (isset($flag_rating)) { for ($s = 0; $s <= 18; $s += 2) { $stat_type = $item[$s]; $stat_value = $item[$s + 1]; if ($stat_type && $stat_value) { switch ($stat_type) { case 12: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['DEFENCE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 13: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['DODGE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 14: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['PARRY_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 15: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SHIELD_BLOCK_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 16: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['MELEE_HIT_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 17: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RANGED_HIT_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 18: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SPELL_HIT_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 19: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['MELEE_CS_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 20: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RANGED_CS_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 21: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SPELL_CS_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 22: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['MELEE_HA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 23: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RANGED_HA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 24: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SPELL_HA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 25: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['MELEE_CA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 26: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RANGED_CA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 27: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SPELL_CA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 28: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['MELEE_HASTE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 29: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RANGED_HASTE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 30: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['SPELL_HASTE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 31: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['HIT_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 32: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['CS_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 33: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['HA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 34: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['CA_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 35: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['RESILIENCE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; case 36: $tooltip .= "{$lang_item['spell_equip']}: {$lang_item['improves']} {$lang_item['HASTE_RATING']} {$lang_item['rating_by']} {$stat_value}.<br />"; break; default: } } } } //add equip spellid to status for ($s1 = 27; $s1 <= 31; $s1++) { if ($item[$s1]) { switch ($item[$s1 + 34]) { case 0: $tooltip .= "{$lang_item['spell_use']}: "; break; case 1: $tooltip .= "{$lang_item['spell_equip']}: "; break; case 2: $tooltip .= "{$lang_item['spell_coh']}: "; break; default: } $tooltip .= " {$item[$s1]}<br />"; if ($item[$s1]) { if ($item[$s1 + 40]) { $tooltip .= abs($item[$s1 + 40]) . " {$lang_item['charges']}.<br />"; } } } } $tooltip .= "</font>"; if ($item[55]) { include_once "id_tab.php"; $tooltip .= "<br /><font color='orange'>{$lang_item['item_set']} : " . get_itemset_name($item[55]) . " ({$item['55']})</font>"; } if ($item[54]) { $tooltip .= "<br /><font color='orange'>''" . str_replace("\"", " '", $item[54]) . "'</font>"; } } else { $tooltip = "Item ID: {$item_id} Not Found"; } return $tooltip; } else { return NULL; } }
function forum_move_topic() { global $forum_skeleton, $forum_lang, $maxqueries, $user_lvl, $user_id, $output, $mmfpm_db; $mysql = new SQL(); $link = $mysql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); if (!isset($_GET["id"])) { error($forum_lang["no_such_topic"]); } else { $id = $mysql->quote_smart($_GET["id"]); } $topic = $mysql->query("SELECT id,topic,authorid,forum, name FROM mm_forum_posts WHERE id = '{$id}';"); // 0 1 2 3 4 if ($mysql->num_rows($topic) == 0) { error($forum_lang["no_such_topic"]); } $topic = $mysql->fetch_row($topic); if ($user_lvl == 0) { error($forum_lang["no_access"]); } $fid = $topic[3]; $cat = 0; foreach ($forum_skeleton as $cid => $category) { foreach ($category["forums"] as $fid_ => $forum) { if ($fid_ == $fid) { $cat = $cid; } } } if (empty($forum_skeleton[$cat]["forums"][$fid])) { // No such forum.. error($forum_lang["no_such_forum"]); } $forum = $forum_skeleton[$cat]["forums"][$fid]; $output .= "<div class=\"top\"><h1>{$forum_lang["forums"]}</h1>{$forum_lang["you_are_here"]} : <a href=\"forum.php\">{$forum_lang["forum_index"]}</a> -> <a href=\"forum.php?action=view_forum&id={$fid}\">{$forum["name"]}</a> -> <a href=\"forum.php?action=view_topic&id={$topic[1]}\">{$topic[4]}</a> -> {$forum_lang["move"]}!</div><center><table class=\"lined\">\r\n <tr><td>{$forum_lang["where"]} : <form action=\"forum.php?action=do_move_topic\" method=\"POST\" name=\"form\"><select name=\"forum\">"; foreach ($forum_skeleton as $category) { foreach ($category["forums"] as $fid_ => $forum) { if ($fid_ != $fid) { $output .= "<option value='{$fid_}'>{$forum["name"]}</option>"; } else { $output .= "<option value='{$fid_}' selected>{$forum["name"]}</option>"; } } } $output .= "</select><input type=\"hidden\" name=\"id\" value=\"{$id}\" /></form></td></tr></table><table class=\"hidden\"><tr><td>"; makebutton($forum_lang["back"], "javascript:window.history.back()", 120); makebutton($forum_lang["confirm"], "javascript:do_submit()", 120); $output .= "</td></tr></table></center>"; $mysql->close(); // Queries : 1 }
function do_edit_char() { global $lang_global, $lang_char, $output, $realm_db, $characters_db, $realm_id, $action_permission, $user_lvl, $world_db; valid_login($action_permission['delete']); if (empty($_GET['id']) || empty($_GET['name'])) { error($lang_global['empty_fields']); } $sql = new SQL(); $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $id = $sql->quote_smart($_GET['id']); $result = $sql->query("SELECT account, online FROM characters WHERE guid = '{$id}'"); if ($sql->num_rows($result)) { //we cannot edit online chars if (!$sql->result($result, 0, 'online')) { //resrict by owner's gmlvl $owner_acc_id = $sql->result($result, 0, 'account'); $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $query = $sql->query("SELECT gmlevel FROM account_access WHERE id ='{$owner_acc_id}' and (`RealmID` = {$realm_id} or `RealmID` = -1)"); $owner_gmlvl = $sql->result($query, 0, 'gmlevel'); $new_owner_name = $_GET['owner_name']; $query = $sql->query("SELECT id FROM account WHERE username ='******'"); $new_owner_acc_id = $sql->result($query, 0, 'id'); if ($owner_acc_id != $new_owner_acc_id) { $max_players = $sql->query("SELECT numchars FROM realmcharacters WHERE acctid ='{$new_owner_acc_id}'"); $max_players = $max_players[0]; if ($max_players <= 9) { $result = $sql->query("UPDATE `{$characters_db[$realm_id]['name']}`.`characters` SET account = {$new_owner_acc_id} WHERE guid = {$id}"); } else { redirect("char_edit.php?action=edit_char&id={$id}&error=5"); } } if ($user_lvl > $owner_gmlvl) { if (isset($_GET['check'])) { $check = $sql->quote_smart($_GET['check']); } else { $check = NULL; } $new_name = $sql->quote_smart($_GET['name']); if (isset($_GET['tot_time'])) { $new_tot_time = $sql->quote_smart($_GET['tot_time']); } else { $new_tot_time = 0; } if (isset($_GET['money'])) { $new_money = $sql->quote_smart($_GET['money']); } else { $new_money = 0; } if (isset($_GET['arena_points'])) { $new_arena_points = $sql->quote_smart($_GET['arena_points']); } else { $new_arena_points = 0; } if (isset($_GET['honor_points'])) { $new_honor_points = $sql->quote_smart($_GET['honor_points']); } else { $new_honor_points = 0; } if (isset($_GET['total_kills'])) { $new_total_kills = $sql->quote_smart($_GET['total_kills']); } else { $new_total_kills = 0; } if (!is_numeric($new_tot_time) || !is_numeric($new_money) || !is_numeric($new_arena_points) || !is_numeric($new_honor_points)) { error($lang_char['use_numeric']); } $x = isset($_GET['x']) ? $sql->quote_smart($_GET['x']) : 0; $y = isset($_GET['y']) ? $sql->quote_smart($_GET['y']) : 0; $z = isset($_GET['z']) ? $sql->quote_smart($_GET['z']) : 0; $map = isset($_GET['map']) ? $sql->quote_smart($_GET['map']) : 0; $tp_to = isset($_GET['tp_to']) ? $sql->quote_smart($_GET['tp_to']) : 0; $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $result = $sql->query("SELECT equipmentCache FROM characters WHERE guid = '{$id}'"); $char = $sql->fetch_row($result); $eq_data = explode(' ', $char[0]); //some items need to be deleted if ($check) { $item_offset = array("a0" => EQ_DATA_OFFSET_EQU_HEAD, "a1" => EQ_DATA_OFFSET_EQU_NECK, "a2" => EQ_DATA_OFFSET_EQU_SHOULDER, "a3" => EQ_DATA_OFFSET_EQU_SHIRT, "a4" => EQ_DATA_OFFSET_EQU_CHEST, "a5" => EQ_DATA_OFFSET_EQU_BELT, "a6" => EQ_DATA_OFFSET_EQU_LEGS, "a7" => EQ_DATA_OFFSET_EQU_FEET, "a8" => EQ_DATA_OFFSET_EQU_WRIST, "a9" => EQ_DATA_OFFSET_EQU_GLOVES, "a10" => EQ_DATA_OFFSET_EQU_FINGER1, "a11" => EQ_DATA_OFFSET_EQU_FINGER2, "a12" => EQ_DATA_OFFSET_EQU_TRINKET1, "a13" => EQ_DATA_OFFSET_EQU_TRINKET2, "a14" => EQ_DATA_OFFSET_EQU_BACK, "a15" => EQ_DATA_OFFSET_EQU_MAIN_HAND, "a16" => EQ_DATA_OFFSET_EQU_OFF_HAND, "a17" => EQ_DATA_OFFSET_EQU_RANGED, "a18" => EQ_DATA_OFFSET_EQU_TABARD); foreach ($check as $item_num) { //deleting equiped items if ($item_num[0] == "a") { $eq_data[$item_offset[$item_num]] = 0; sscanf($item_num, "a%d", $item_num); $result = $sql->query("SELECT item FROM character_inventory WHERE guid = '{$id}' AND slot = {$item_num} AND bag = 0"); $item_inst_id = $sql->result($result, 0, 'item'); $sql->query("DELETE FROM character_inventory WHERE guid = '{$id}' AND slot = {$item_num} AND bag = 0"); $sql->query("DELETE FROM item_instance WHERE guid = '{$item_inst_id}' AND owner_guid = '{$id}'"); } else { //deleting inv/bank items $sql->query("DELETE FROM character_inventory WHERE guid = '{$id}' AND item = '{$item_num}'"); $sql->query("DELETE FROM item_instance WHERE guid = '{$item_num}' AND owner_guid = '{$id}'"); } } } $data = implode(' ', $eq_data); if ($tp_to) { $query = $sql->query("SELECT map, position_x, position_y, position_z, orientation FROM `" . $world_db[$realm_id]['name'] . "`.`game_tele` WHERE LOWER(name) = '" . strtolower($tp_to) . "'"); $tele = $sql->fetch_row($query); if ($tele) { $teleport = "map='{$tele['0']}', position_x='{$tele['1']}', position_y='{$tele['2']}', position_z='{$tele['3']}', orientation='{$tele['4']}',"; } else { error($lang_char['no_tp_location']); } } else { $teleport = "map='{$map}', position_x='{$x}', position_y='{$y}', position_z='{$z}',"; } $result = $sql->query("UPDATE characters SET equipmentCache = '{$data}', name = '{$new_name}', {$teleport} totaltime = '{$new_tot_time}', money = '{$new_money}', arenaPoints = '{$new_arena_points}', totalHonorPoints = '{$new_honor_points}', totalKills = '{$new_total_kills}' WHERE guid = {$id}"); $sql->close(); unset($sql); if ($result) { redirect("char_edit.php?action=edit_char&id={$id}&error=3"); } else { redirect("char_edit.php?action=edit_char&id={$id}&error=4"); } } else { $sql->close(); unset($sql); error($lang_char['no_permission']); } } else { $sql->close(); unset($sql); redirect("char_edit.php?action=edit_char&id={$id}&error=2"); } } else { error($lang_char['no_char_found']); } $sql->close(); unset($sql); }
function get_side() { global $user_id, $characters_db, $realm_id; $mysql2 = new SQL(); $mysql2->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $result = $mysql2->query("SELECT race FROM `characters` WHERE account = '{$user_id}';"); if (!$mysql2->num_rows($result)) { return "NO"; } $a = 0; $h = 0; while ($race = $mysql2->fetch_row($result)) { if ($race[0] == 1 || $race[0] == 3 || $race[0] == 4 || $race[0] == 7 || $race[0] == 11) { $a++; } else { if ($race[0] == 2 || $race[0] == 5 || $race[0] == 6 || $race[0] == 8 || $race[0] == 10) { $h++; } else { continue; } } } $mysql2->close(); if ($a != 0 && $h == 0) { return "A"; } else { if ($a == 0 && $h != 0) { return "H"; } else { return "NO"; } } $mysql2->close(); }
function view_team() { global $lang_arenateam, $lang_global, $output, $characters_db, $realm_id, $realm_db, $mmfpm_db, $action_permission, $user_lvl, $user_id, $showcountryflag; if (!isset($_GET['id'])) { redirect("arenateam.php?error=1"); } $sqlc = new SQL(); $sqlc->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $arenateam_id = $sqlc->quote_smart($_GET['id']); $query = $sqlc->query("SELECT arenateamid, name, type FROM arena_team WHERE arenateamid = '{$arenateam_id}'"); $arenateam_data = $sqlc->fetch_row($query); $query = $sqlc->query("SELECT arenateamid, rating, weekGames, weekWins, seasonGames, seasonWins, rank FROM arena_team WHERE arenateamid = '{$arenateam_id}'"); $arenateamstats_data = $sqlc->fetch_row($query); $rating_offset = 1550; if ($arenateam_data[2] == 3) { $rating_offset += 6; } else { if ($arenateam_data[2] == 5) { $rating_offset += 12; } } $members = $sqlc->query("SELECT arena_team_member.guid,characters.name, arena_team_member.personalRating, level, arena_team_member.weekGames, arena_team_member.weekWins, arena_team_member.seasonGames, arena_team_member.seasonWins, characters.race, characters.class, characters.online, characters.account, characters.logout_time, gender, account FROM arena_team_member,characters LEFT JOIN arena_team_member k1 ON k1.guid=characters.guid AND k1.arenateamid='{$arenateam_id}' WHERE arena_team_member.arenateamid = '{$arenateam_id}' AND arena_team_member.guid=characters.guid ORDER BY characters.name"); $total_members = $sqlc->num_rows($members); $losses_week = $arenateamstats_data[2] - $arenateamstats_data[3]; if ($arenateamstats_data[2]) { $winperc_week = round(10000 * $arenateamstats_data[3] / $arenateamstats_data[2]) / 100; } else { $winperc_week = $arenateamstats_data[2]; } $losses_season = $arenateamstats_data[4] - $arenateamstats_data[5]; if ($arenateamstats_data[4]) { $winperc_season = round(10000 * $arenateamstats_data[5] / $arenateamstats_data[4]) / 100; } else { $winperc_season = $arenateamstats_data[4]; } $output .= "\r\n <script type=\"text/javascript\">\r\n answerbox.btn_ok='{$lang_global['yes_low']}';\r\n answerbox.btn_cancel='{$lang_global['no']}';\r\n </script>\r\n <center>\r\n <fieldset>\r\n <legend>{$lang_arenateam['arenateam']} ({$arenateam_data[2]}v{$arenateam_data[2]})</legend>\r\n <table class=\"lined\" style=\"width: 100%;\">\r\n <tr class=\"bold\">\r\n <td colspan=\"" . ($showcountryflag ? 14 : 13) . "\">" . htmlentities($arenateam_data[1]) . "</td>\r\n </tr>\r\n <tr>\r\n <td colspan=\"" . ($showcountryflag ? 14 : 13) . "\">{$lang_arenateam['tot_members']}: {$total_members}</td>\r\n </tr>\r\n <tr>\r\n <td colspan=\"4\">{$lang_arenateam['this_week']}</td>\r\n <td colspan=\"2\">{$lang_arenateam['games_played']} : {$arenateamstats_data['2']}</td>\r\n <td colspan=\"2\">{$lang_arenateam['games_won']} : {$arenateamstats_data['3']}</td>\r\n <td colspan=\"2\">{$lang_arenateam['games_lost']} : {$losses_week}</td>\r\n <td colspan=\"" . ($showcountryflag ? 4 : 3) . "\">{$lang_arenateam['ratio']} : {$winperc_week} %</td>\r\n </tr>\r\n <tr>\r\n <td colspan=\"4\">{$lang_arenateam['this_season']}</td>\r\n <td colspan=\"2\">{$lang_arenateam['games_played']} : {$arenateamstats_data['4']}</td>\r\n <td colspan=\"2\">{$lang_arenateam['games_won']} : {$arenateamstats_data['5']}</td>\r\n <td colspan=\"2\">{$lang_arenateam['games_lost']} : {$losses_season}</td>\r\n <td colspan=\"" . ($showcountryflag ? 4 : 3) . "\">{$lang_arenateam['ratio']} : {$winperc_season} %</td>\r\n </tr>\r\n <tr>\r\n <td colspan=\"" . ($showcountryflag ? 14 : 13) . "\">{$lang_arenateam['standings']} {$arenateamstats_data[6]} ({$arenateamstats_data[1]})</td>\r\n </tr>\r\n <tr>\r\n <th width=\"1%\">{$lang_arenateam['remove']}</th>\r\n <th width=\"1%\">{$lang_arenateam['name']}</th>\r\n <th width=\"1%\">Race</th>\r\n <th width=\"1%\">Class</th>\r\n <th width=\"1%\">Personal Rating</th>\r\n <th width=\"1%\">Last Login (Days)</th>\r\n <th width=\"1%\">Online</th>\r\n <th width=\"1%\">{$lang_arenateam['played_week']}</th>\r\n <th width=\"1%\">{$lang_arenateam['wons_week']}</th>\r\n <th width=\"1%\">Win %</th>\r\n <th width=\"1%\">{$lang_arenateam['played_season']}</th>\r\n <th width=\"1%\">{$lang_arenateam['wons_season']}</th>\r\n <th width=\"1%\">Win %</th>"; if ($showcountryflag) { require_once 'libs/misc_lib.php'; $sqlr = new SQL(); $sqlr->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $sqlm = new SQL(); $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); $output .= "\r\n <th width=\"1%\">{$lang_global['country']}</th>"; } $output .= "\r\n </tr>"; while ($member = $sqlc->fetch_row($members)) { $accid = $member[11]; $output .= "\r\n <tr>"; if ($user_lvl >= $action_permission['delete'] || $accid == $user_id) { $output .= "\r\n <td><img src=\"img/aff_cross.png\" alt=\"\" onclick=\"answerBox('{$lang_global['delete']}: <font color=white>{$member[1]}</font><br />{$lang_global['are_you_sure']}', 'arenateam.php?action=rem_char_from_team&id={$member['0']}&arenateam_id={$arenateam_id}');\" style=\"cursor:pointer;\" /></td>"; } else { $output .= "\r\n <td> </td>"; } if ($member[4]) { $ww_pct = round(10000 * $member[5] / $member[4]) / 100; } else { $ww_pct = $member[4]; } if ($member[6]) { $ws_pct = round(10000 * $member[7] / $member[6]) / 100; } else { $ws_pct = $member[6]; } $output .= "\r\n <td><a href=\"char.php?id={$member['0']}\">" . htmlentities($member[1]) . "</a></td>\r\n <td><img src='img/c_icons/{$member[8]}-{$member[13]}.gif' onmousemove='toolTip(\"" . char_get_race_name($member[8]) . "\",\"item_tooltip\")' onmouseout='toolTip()' /></td>\r\n <td><img src='img/c_icons/{$member[9]}.gif' onmousemove='toolTip(\"" . char_get_class_name($member[9]) . "\",\"item_tooltip\")' onmouseout='toolTip()' /></td>\r\n <td>{$member['2']}</td>\r\n <td>" . get_days_with_color($member[12]) . "</td>\r\n <td>" . ($member[10] ? "<img src=\"img/up.gif\" alt=\"\" />" : "-") . "</td>\r\n <td>{$member['4']}</td>\r\n <td>{$member['5']}</td>\r\n <td>{$ww_pct} %</td>\r\n <td>{$member['6']}</td>\r\n <td>{$member['7']}</td>\r\n <td>{$ws_pct} %</td>"; if ($showcountryflag) { $country = misc_get_country_by_account($member[14], $sqlr, $sqlm); $output .= "\r\n <td>" . ($country['code'] ? "<img src='img/flags/" . $country['code'] . ".png' onmousemove='toolTip(\"" . $country['country'] . "\",\"item_tooltip\")' onmouseout='toolTip()' alt=\"\" />" : "-") . "</td>"; } $output .= "\r\n </tr>"; } $output .= "\r\n </table>\r\n <br />\r\n <table class=\"hidden\">\r\n <tr>\r\n <td>"; if ($user_lvl >= $action_permission['delete']) { makebutton($lang_arenateam['del_team'], "arenateam.php?action=del_team&id={$arenateam_id}\" type=\"wrn", 180); $output .= "\r\n </td>\r\n <td>"; makebutton($lang_arenateam['arenateams'], "arenateam.php\" type=\"def", 130); $output .= "\r\n </td>\r\n </tr>\r\n <tr>\r\n </tr>"; } else { makebutton($lang_arenateam['arenateams'], "arenateam.php", 130); $output .= "\r\n </td>\r\n </tr>"; } $output .= "\r\n </table>\r\n </fieldset>\r\n </center>"; }
function forum_view_topic(&$sqlr, &$sqlc, &$sqlm) { global $enablesidecheck, $forum_skeleton, $maxqueries, $forum_lang, $user_lvl, $user_id, $output, $realm_db, $characters_db, $mmfpm_db, $realm_id; if ($enablesidecheck) { $side = get_side(); } // Better to use it here instead of call it many time in the loop :) $sqlm = new SQL(); $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); //==========================$_GET and SECURE================================= if (isset($_GET['id'])) { $id = $sqlm->quote_smart($_GET['id']); $post = false; } else { if (isset($_GET['postid'])) { $id = $sqlm->quote_smart($_GET['postid']); $post = true; } else { error($forum_lang['no_such_topic']); } } if (!isset($_GET['page'])) { $page = 0; } else { $page = $sqlm->quote_smart($_GET['page']); } // Fok you mathafoker haxorz //==========================$_GET and SECURE end============================= $start = $maxqueries * $page; if (!$post) { $posts = $sqlm->query(' SELECT id, authorid, authorname, forum, name, text, time, annouced, sticked, closed FROM mm_forum_posts WHERE topic = ' . $id . ' ORDER BY id ASC LIMIT ' . $start . ', ' . $maxqueries . ''); $sqlr = new SQL(); $sqlr->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); // need to update this query to use ' instead of " $query = "\r\n\t\t\tSELECT account, name, gender, race, class, level,\r\n\t\t\t\t(SELECT gmlevel\r\n\t\t\t\tFROM `{$realm_db['name']}`.account\r\n\t\t\t\tWHERE `{$realm_db['name']}`.account.id = `{$characters_db[$realm_id]['name']}`.characters.account) as gmlevel\r\n\t\t\tFROM `{$characters_db[$realm_id]['name']}`.characters\r\n\t\t\tWHERE totaltime IN \r\n\t\t\t\t(SELECT MAX(totaltime)\r\n\t\t\t\tFROM `{$characters_db[$realm_id]['name']}`.characters\r\n\t\t\t\tWHERE account IN ("; while ($post = $sqlm->fetch_row($posts)) { $query .= "{$post['1']},"; } mysql_data_seek($posts, 0); $query .= "\r\n\t\t\t\t\t0)\r\n\t\t\t\tGROUP BY account);"; $sqlc = new SQL(); $sqlc->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $results = $sqlc->query($query); while ($avatar = $sqlc->fetch_assoc($results)) { $char_gender = str_pad(dechex($avatar['gender']), 8, 0, STR_PAD_LEFT); $avatars[$avatar['account']]['name'] = $avatar['name']; $avatars[$avatar['account']]['sex'] = $char_gender['race']; $avatars[$avatar['account']]['race'] = $avatar['race']; $avatars[$avatar['account']]['class'] = $avatar['class']; $avatars[$avatar['account']]['level'] = $avatar['level']; $avatars[$avatar['account']]['gm'] = $avatar['gmlevel']; } $replies = $sqlm->num_rows($posts); if ($replies == 0) { error($forum_lang['no_such_topic']); } $post = $sqlm->fetch_assoc($posts); $fid = $post['forum']; $cat = 0; $cid = $sqlm->query(' SELECT category, name, description, side_access, level_post_topic, level_read, level_post FROM mm_forum_categories'); while ($category = $sqlm->fetch_assoc($cid)) { $fid_ = $sqlm->query(' SELECT forum, category, name, description, side_access, level_post_topic, level_read, level_post FROM mm_forum_forums WHERE category = ' . $category['category'] . ''); while ($forum = $sqlm->fetch_assoc($fid_)) { if ($forum['forum'] == $fid) { $cat = $forum['category']; } if (empty($forum['forum'])) { error($forum_lang['no_such_forum']); } if ($category['level_read'] > $user_lvl || $forum['level_read'] > $user_lvl) { error($forum_lang['no_access']); } if ($user_lvl == 0 && $enablesidecheck) { if ($category['side_access'] != 'ALL') { // Not an all side forum if ($side == 'NO') { // No char continue; } else { if ($category['side_access'] != $side) { // Forumside different of the user side continue; } } } if ($forum['side_access'] != 'ALL') { // Not an all side forum if ($side == 'NO') { // No char continue; } else { if ($forum['side_access'] != $side) { // Forumside different of the user side continue; } } } } } } $post['name'] = htmlspecialchars($post['name']); $post['text'] = htmlspecialchars($post['text']); $post['text'] = bbcode_parse1($post['text']); $output .= ' <div class="top"> <h1>' . $forum_lang['forums'] . '</h1> </div> <center> <fieldset> <legend> <a href="forum.php">' . $forum_lang['forum_index'] . '</a> -> <a href="forum.php?action=view_forum&id=' . $forum['forum'] . '">' . $forum['name'] . '</a> -> <a href="forum.php?action=view_topic&id=' . $id . '">' . $post['name'] . '</a> </legend> <table class="lined"> <tr> <th style="width:15%;">' . $forum_lang['info'] . '</th> <th style="text-align:left;">' . $forum_lang['text'] . '</th>'; if ($user_lvl > 0) { $output .= ' <th style="width:50%;text-align:right;">'; if ($post['sticked'] == "1") { if ($post['annouced'] == "1") { // Annoucement $output .= ' ' . $forum_lang['annoucement'] . ''; } else { // Sticky $output .= ' ' . $forum_lang['sticky'] . ''; } } else { if ($post['annouced'] == "1") { // Annoucement $output .= ' ' . $forum_lang['annoucement'] . ''; } else { // Normal Topic $output .= ' ' . $forum_lang['normal'] . ''; } } if ($post['closed'] == "1") { $output .= ' </th>'; } } if (isset($avatars[$post['authorid']])) { $avatar = gen_avatar_panel($avatars[$post['authorid']]['level'], $avatars[$post['authorid']]['sex'], $avatars[$post['authorid']]['race'], $avatars[$post['authorid']]['class'], 1, $avatars[$post['authorid']]['gm']); } else { $avatar = ""; } $output .= ' <tr> <td colspan="3" align="left"> ' . $post['time'] . ' </td> </tr> </tr>'; $output .= ' <tr> <td style="width:15%;text-align:center;"><center>' . $avatar . '</center>' . $forum_lang['author'] . ' : '; if ($user_lvl > 0) { $output .= ' <a href="user.php?action=edit_user&error=11&id=' . $post['authorid'] . '">'; } if (isset($avatars[$post['authorid']])) { $output .= $avatars[$post['authorid']]['name']; } else { $output .= $post['authorname']; } if ($user_lvl > 0) { $output .= ' </a>'; } $output .= ' </td> <td colspan="2" style="text-align:left">' . $post['text'] . '<br /> <div style="text-align:right\\"> </td> </tr>'; if ($user_lvl > 0) { $output .= ' <tr> <th colspan="3" align="right">'; if ($post['sticked'] == "1") { if ($post['annouced'] == "1") { // Annoucement $output .= ' <a href="forum.php?action=edit_announce&id=' . $post['id'] . '&state=0"><img src="img/forums/unannounce.png" border="0" alt="' . $forum_lang['down'] . '" /></a>'; } else { // Sticky $output .= ' <a href="forum.php?action=edit_stick&id=' . $post['id'] . '&state=0"><img src="img/forums/unstick.png" border="0" alt="' . $forum_lang['down'] . '" /></a> <a href="forum.php?action=edit_announce&id=' . $post['id'] . '&state=1"><img src="img/forums/announce.png" border="0" alt="' . $forum_lang["up"] . '" /></a>'; } } else { if ($post['annouced'] == "1") { // Annoucement $output .= ' <a href="forum.php?action=edit_announce&id=' . $post['id'] . '&state=0"><img src="img/forums/unannounce.png" border="0" alt="' . $forum_lang['down'] . '" /></a>'; } else { // Normal Topic $output .= ' <a href="forum.php?action=edit_stick&id=' . $post['id'] . '&state=1"><img src="img/forums/stick.png" border="0" alt="' . $forum_lang['up'] . '" /></a>'; } } if ($post['closed'] == "1") { $output .= ' <a href="forum.php?action=edit_close&id=' . $post['id'] . '&state=0"><img src="img/forums/lock.png" border="0" alt=\\"' . $forum_lang['open'] . '" /></a>'; } else { $output .= ' <a href="forum.php?action=edit_close&id=' . $post['id'] . '&state=1"><img src="img/forums/unlock.png" border="0" alt="' . $forum_lang['close'] . '" /></a>'; } $output .= ' <a href="forum.php?action=move_topic&id=' . $post['id'] . '"><img src="img/forums/move.png" border="0" alt="' . $forum_lang['move'] . '" /></a> <a href="forum.php?action=edit_post&id=' . $post['id'] . '"><img src="img/forums/edit.png" border="0" alt="' . $forum_lang["edit"] . '" /></a> <a href="forum.php?action=delete_post&id=' . $post['id'] . '"><img src="img/forums/delete.png" border="0" alt="' . $forum_lang["delete"] . '" /></a> </th> </tr>'; } $closed = $post['closed']; while ($post = $sqlm->fetch_assoc($posts)) { $post['text'] = htmlspecialchars($post['text']); $post['text'] = bbcode_parse1($post['text']); if (isset($avatars[$post['authorid']])) { $avatar = gen_avatar_panel($avatars[$post['authorid']]['level'], $avatars[$post['authorid']]['sex'], $avatars[$post['authorid']]['race'], $avatars[$post['authorid']]['class'], 1, $avatars[$post['authorid']]['gm']); } else { $avatar = ""; } $output .= ' <tr> <td colspan="3" align="left"> ' . $post['time'] . ' </td> </tr> <tr> <td style="width:15%;text-align:center;"> <center>' . $avatar . '</center>' . $forum_lang['author'] . ' : '; if ($user_lvl > 0) { $output .= ' <a href="user.php?action=edit_user&error=11&id=' . $post['authorid'] . '">'; } if (isset($avatars[$post['authorid']])) { $output .= $avatars[$post['authorid']]['name']; } else { $output .= $post['authorname']; } $output .= ' </a>'; $output .= ' </td> <td colspan="2" style="text-align:left;">' . $post['text'] . '<br />'; $output .= ' </td> </tr>'; if ($user_lvl > 0 || $user_id == $post['authorid']) { $output .= ' <tr> <th colspan="3" align="right"> <a href="forum.php?action=edit_post&id=' . $post['id'] . '"><img src="img/forums/edit.png" border="0" alt="' . $forum_lang['edit'] . '"></a> <a href="forum.php?action=delete_post&id=' . $post['id'] . '"><img src="img/forums/delete.png" border="0" alt="' . $forum_lang['delete'] . '"></a> </th> </tr>'; } } $totalposts = $sqlm->query(' SELECT id FROM mm_forum_posts WHERE topic = ' . $id . ''); $totalposts = $sqlm->num_rows($totalposts); $pages = ceil($totalposts / $maxqueries); $output .= ' <tr> <td align="right" colspan="3">' . $forum_lang['pages'] . ' : '; for ($x = 1; $x <= $pages; $x++) { $y = $x - 1; $output .= ' <a href="forum.php?action=view_topic&id=' . $id . '&page=' . $y . '">' . $x . '</a>'; } $output .= ' </td> </tr> </table> </fieldset> <br />'; $category = $sqlm->query(' SELECT category, name, description, side_access, level_post_topic, level_read, level_post FROM mm_forum_categories'); // Quick reply form if (($user_lvl > 0 || !$closed) && ($category['level_post'] <= $user_lvl && $forum['level_post'] <= $user_lvl)) { $output .= ' <form action="forum.php?action=do_add_post" method="POST" name="form"> <fieldset> <legend> ' . $forum_lang['quick_reply'] . ' </legend> <table class="lined"> <tr> <td align="left" colspan="3">'; bbcode_add_editor(); $output .= ' </td> </tr> <tr> <td colspan="3"> <TEXTAREA ID="msg" NAME="msg" ROWS=8 COLS=93></TEXTAREA><br/> <input type="hidden" name="forum" value="' . $fid . '"> <input type="hidden" name="topic" value="' . $id . '"> </td> </tr> <tr> <td align="left">'; makebutton($forum_lang['post'], "javascript:do_submit()", 100); $output .= ' </td> </tr> </table> </fieldset> </form>'; } $output .= ' </center>'; $sqlm->close(); } else { $output .= ' <div class="top"> <h1>Stand by...</h1> </div>'; // Get post id $post = $sqlm->query(' SELECT topic, id FROM mm_forum_posts WHERE id = ' . $id . ''); if ($sqlm->num_rows($post) == 0) { error($forum_lang['no_such_topic']); } $post = $sqlm->fetch_assoc($post); if ($post['id'] == $post['authorid']) { redirect('forum.php?action=view_topic&id=' . $id . ''); } $topic = $post['id']; // Get posts in topic $posts = $sqlm->query(' SELECT id FROM mm_forum_posts WHERE topic = ' . $topic . ''); $replies = $sqlm->num_rows($posts); if ($replies == 0) { error($forum_lang['no_such_topic']); } $row = 0; // Find the row of our post, so we could have his ratio (topic x/total topics) and knew the page to show while ($post = $sqlm->fetch_row($posts)) { $row++; if ($topic == $id) { break; } } $page = 0; while ($page * $maxqueries < $row) { $page++; } $page--; $sqlm->close(); redirect('forum.php?action=view_topic&id=' . $topic . '&page=' . $page . ''); } // Queries : 2 with id || 2 (+2) with postid }
/** * count of rows in a table * * @param string name of table to analyze * @return NULL, or an array(count, min_date, max_date) */ public static function table_stat($table) { global $context; // accept foreign user profiles if ($table == 'users') { $connection = $context['users_connection']; } else { $connection = $context['connection']; } // query the database $query = "SELECT count(*), min(edit_date), max(edit_date) FROM " . SQL::table_name($table); if ($result = SQL::query($query)) { if ($row = SQL::fetch_row($result)) { return $row; } } return NULL; }
function do_edit_char() { global $lang_global, $lang_char, $output, $realm_db, $characters_db, $realm_id, $action_permission, $user_lvl, $world_db; valid_login($action_permission['delete']); if (empty($_GET['id']) || empty($_GET['name'])) { error($lang_global['empty_fields']); } $sql = new SQL(); $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $id = $sql->quote_smart($_GET['id']); $result = $sql->query("SELECT account,online FROM `characters` WHERE guid = '{$id}'"); if ($sql->num_rows($result)) { //we cannot edit online chars if (!$sql->result($result, 0, 'online')) { //resrict by owner's gmlvl $owner_acc_id = $sql->result($result, 0, 'account'); $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $query = $sql->query("SELECT gmlevel FROM account WHERE id ='{$owner_acc_id}'"); $owner_gmlvl = $sql->result($query, 0, 'gmlevel'); $new_owner_name = $_GET['owner_name']; $query = $sql->query("SELECT id FROM account WHERE username ='******'"); $new_owner_acc_id = $sql->result($query, 0, 'id'); if ($owner_acc_id != $new_owner_acc_id) { $max_players = $sql->query("SELECT numchars FROM realmcharacters WHERE acctid ='{$new_owner_acc_id}'"); $max_players = $max_players[0]; if ($max_players <= 9) { $result = $sql->query("UPDATE `{$characters_db[$realm_id]['name']}`.`characters` SET account = {$new_owner_acc_id} WHERE guid = '{$id}'"); } else { redirect("char_edit.php?action=edit_char&id={$id}&error=5"); } } if ($user_lvl > $owner_gmlvl) { if (isset($_GET['check'])) { $check = $sql->quote_smart($_GET['check']); } else { $check = NULL; } $new_name = $sql->quote_smart($_GET['name']); if (isset($_GET['tot_time'])) { $new_tot_time = $sql->quote_smart($_GET['tot_time']); } else { $new_tot_time = 0; } if (isset($_GET['res_holy'])) { $new_res_holy = $sql->quote_smart($_GET['res_holy']); } else { $new_res_holy = 0; } if (isset($_GET['res_arcane'])) { $new_res_arcane = $sql->quote_smart($_GET['res_arcane']); } else { $new_res_arcane = 0; } if (isset($_GET['res_fire'])) { $new_res_fire = $sql->quote_smart($_GET['res_fire']); } else { $new_res_fire = 0; } if (isset($_GET['res_nature'])) { $new_res_nature = $sql->quote_smart($_GET['res_nature']); } else { $new_res_nature = 0; } if (isset($_GET['res_frost'])) { $new_res_frost = $sql->quote_smart($_GET['res_frost']); } else { $new_res_frost = 0; } if (isset($_GET['res_shadow'])) { $new_res_shadow = $sql->quote_smart($_GET['res_shadow']); } else { $new_res_shadow = 0; } if (isset($_GET['attack_power'])) { $new_attack_power = $sql->quote_smart($_GET['attack_power']); } else { $new_attack_power = 0; } if (isset($_GET['range_attack_power'])) { $new_range_attack_power = $sql->quote_smart($_GET['range_attack_power']); } else { $new_range_attack_power = 0; } if (isset($_GET['money'])) { $new_money = $sql->quote_smart($_GET['money']); } else { $new_money = 0; } if (isset($_GET['arena_points'])) { $new_arena_points = $sql->quote_smart($_GET['arena_points']); } else { $new_arena_points = 0; } if (isset($_GET['honor_points'])) { $new_honor_points = $sql->quote_smart($_GET['honor_points']); } else { $new_honor_points = 0; } if (isset($_GET['total_kills'])) { $new_total_kills = $sql->quote_smart($_GET['total_kills']); } else { $new_total_kills = 0; } if (!is_numeric($new_tot_time) || !is_numeric($new_res_holy) || !is_numeric($new_res_arcane) || !is_numeric($new_res_fire) || !is_numeric($new_res_nature) || !is_numeric($new_res_frost) || !is_numeric($new_res_shadow) || !is_numeric($new_attack_power) || !is_numeric($new_range_attack_power) || !is_numeric($new_money) || !is_numeric($new_arena_points) || !is_numeric($new_honor_points)) { error($lang_char['use_numeric']); } if (isset($_GET['health'])) { $new_health = $sql->quote_smart($_GET['health']); } else { $new_health = 1; } if (isset($_GET['mana'])) { $new_mana = $sql->quote_smart($_GET['mana']); } else { $new_mana = 0; } if (isset($_GET['str'])) { $new_str = $sql->quote_smart($_GET['str']); } else { $new_str = 1; } if (isset($_GET['agi'])) { $new_agi = $sql->quote_smart($_GET['agi']); } else { $new_agi = 1; } if (isset($_GET['sta'])) { $new_sta = $sql->quote_smart($_GET['sta']); } else { $new_sta = 1; } if (isset($_GET['int'])) { $new_int = $sql->quote_smart($_GET['int']); } else { $new_int = 1; } if (isset($_GET['spi'])) { $new_spi = $sql->quote_smart($_GET['spi']); } else { $new_spi = 1; } if (isset($_GET['exp'])) { $new_exp = $sql->quote_smart($_GET['exp']); } else { $new_exp = 0; } if (isset($_GET['armor'])) { $new_armor = $sql->quote_smart($_GET['armor']); } else { $new_armor = 0; } if (isset($_GET['block'])) { $new_block = $sql->quote_smart($_GET['block']); } else { $new_block = 0; } if (isset($_GET['dodge'])) { $new_dodge = $sql->quote_smart($_GET['dodge']); } else { $new_dodge = 0; } if (isset($_GET['parry'])) { $new_parry = $sql->quote_smart($_GET['parry']); } else { $new_parry = 0; } if (isset($_GET['crit'])) { $new_crit = $sql->quote_smart($_GET['crit']); } else { $new_crit = 0; } if (isset($_GET['range_crit'])) { $new_range_crit = $sql->quote_smart($_GET['range_crit']); } else { $new_range_crit = 0; } if (!is_numeric($new_health) || !is_numeric($new_mana) || !is_numeric($new_str) || !is_numeric($new_agi) || !is_numeric($new_sta) || !is_numeric($new_int) || !is_numeric($new_spi) || !is_numeric($new_exp) || !is_numeric($new_armor) || !is_numeric($new_block) || !is_numeric($new_dodge) || !is_numeric($new_parry) || !is_numeric($new_crit) || !is_numeric($new_range_crit)) { error($lang_char['use_numeric']); } $x = isset($_GET['x']) ? $sql->quote_smart($_GET['x']) : 0; $y = isset($_GET['y']) ? $sql->quote_smart($_GET['y']) : 0; $z = isset($_GET['z']) ? $sql->quote_smart($_GET['z']) : 0; $map = isset($_GET['map']) ? $sql->quote_smart($_GET['map']) : 0; $tp_to = isset($_GET['tp_to']) ? $sql->quote_smart($_GET['tp_to']) : 0; $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $result = $sql->query("SELECT data FROM `characters` WHERE guid = '{$id}'"); $char = $sql->fetch_row($result); $char_data = explode(' ', $char[0]); $char_data[CHAR_DATA_OFFSET_AP] = $new_attack_power; $char_data[CHAR_DATA_OFFSET_RANGED_AP] = $new_range_attack_power; $char[31] = $new_exp; $char[30] = $new_money; $char[15] = $new_arena_points; $char[16] = $new_honor_points; $char[19] = $new_total_kills; $char[22] = $new_health; $char[23] = $new_mana; $char_data[CHAR_DATA_OFFSET_STR] = $new_str; $char_data[CHAR_DATA_OFFSET_AGI] = $new_agi; $char_data[CHAR_DATA_OFFSET_STA] = $new_sta; $char_data[CHAR_DATA_OFFSET_INT] = $new_int; $char_data[CHAR_DATA_OFFSET_SPI] = $new_spi; $char_data[CHAR_DATA_OFFSET_ARMOR] = $new_armor; $char_data[CHAR_DATA_OFFSET_RES_HOLY] = $new_res_holy; $char_data[CHAR_DATA_OFFSET_RES_ARCANE] = $new_res_arcane; $char_data[CHAR_DATA_OFFSET_RES_FIRE] = $new_res_fire; $char_data[CHAR_DATA_OFFSET_RES_NATURE] = $new_res_nature; $char_data[CHAR_DATA_OFFSET_RES_FROST] = $new_res_frost; $char_data[CHAR_DATA_OFFSET_RES_SHADOW] = $new_res_shadow; $new_block = unpack("L", pack("f", $new_block)); $char_data[CHAR_DATA_OFFSET_BLOCK] = $new_block[1]; $new_dodge = unpack("L", pack("f", $new_dodge)); $char_data[CHAR_DATA_OFFSET_DODGE] = $new_dodge[1]; $new_parry = unpack("L", pack("f", $new_parry)); $char_data[CHAR_DATA_OFFSET_PARRY] = $new_parry[1]; $new_crit = unpack("L", pack("f", $new_crit)); $char_data[CHAR_DATA_OFFSET_MELEE_CRIT] = $new_crit[1]; $new_range_crit = unpack("L", pack("f", $new_range_crit)); $char_data[CHAR_DATA_OFFSET_RANGE_CRIT] = $new_range_crit[1]; //some items need to be deleted if ($check) { $item_offset = array("a0" => CHAR_DATA_OFFSET_EQU_HEAD, "a1" => CHAR_DATA_OFFSET_EQU_NECK, "a2" => CHAR_DATA_OFFSET_EQU_SHOULDER, "a3" => CHAR_DATA_OFFSET_EQU_SHIRT, "a4" => CHAR_DATA_OFFSET_EQU_CHEST, "a5" => CHAR_DATA_OFFSET_EQU_BELT, "a6" => CHAR_DATA_OFFSET_EQU_LEGS, "a7" => CHAR_DATA_OFFSET_EQU_FEET, "a8" => CHAR_DATA_OFFSET_EQU_WRIST, "a9" => CHAR_DATA_OFFSET_EQU_GLOVES, "a10" => CHAR_DATA_OFFSET_EQU_FINGER1, "a11" => CHAR_DATA_OFFSET_EQU_FINGER2, "a12" => CHAR_DATA_OFFSET_EQU_TRINKET1, "a13" => CHAR_DATA_OFFSET_EQU_TRINKET2, "a14" => CHAR_DATA_OFFSET_EQU_BACK, "a15" => CHAR_DATA_OFFSET_EQU_MAIN_HAND, "a16" => CHAR_DATA_OFFSET_EQU_OFF_HAND, "a17" => CHAR_DATA_OFFSET_EQU_RANGED, "a18" => CHAR_DATA_OFFSET_EQU_TABARD); foreach ($check as $item_num) { //deleting equiped items if ($item_num[0] == "a") { $char_data[$item_offset[$item_num]] = 0; sscanf($item_num, "a%d", $item_num); $result = $sql->query("SELECT item FROM character_inventory WHERE guid = '{$id}' AND slot = {$item_num} AND bag = 0"); $item_inst_id = $sql->result($result, 0, 'item'); $sql->query("DELETE FROM character_inventory WHERE guid = '{$id}' AND slot = {$item_num} AND bag = 0"); $sql->query("DELETE FROM item_instance WHERE guid = '{$item_inst_id}' AND owner_guid = '{$id}'"); $sql->query("DELETE FROM item_text WHERE id = '{$item_inst_id}'"); } else { //deleting inv/bank items $sql->query("DELETE FROM character_inventory WHERE guid = '{$id}' AND item = '{$item_num}'"); $sql->query("DELETE FROM item_instance WHERE guid = '{$item_num}' AND owner_guid = '{$id}'"); $sql->query("DELETE FROM item_text WHERE id = '{$item_num}'"); } } } $data = implode(" ", $char_data); if ($tp_to) { $query = $sql->query("SELECT map, position_x, position_y, position_z, orientation FROM `" . $world_db[$realm_id]['name'] . "`.`game_tele` WHERE LOWER(name) = '" . strtolower($tp_to) . "'"); $tele = $sql->fetch_row($query); if ($tele) { $teleport = "map='{$tele['0']}', position_x='{$tele['1']}', position_y='{$tele['2']}', position_z='{$tele['3']}', orientation='{$tele['4']}',"; } else { error($lang_char['no_tp_location']); } } else { $teleport = "map='{$map}', position_x='{$x}', position_y='{$y}', position_z='{$z}',"; } $result = $sql->query("UPDATE `characters` SET data = '{$data}', name = '{$new_name}', totaltime = '{$new_tot_time}', money = '{$new_money}', health = '{$new_health}', power1 = '{$new_mana}', xp = '{$new_exp}', arenaPoints = '{$new_arena_points}', totalHonorPoints = '{$new_honor_points}', totalKills = '{$new_total_kills}' WHERE guid = '{$id}'"); $sql->close(); unset($sql); if ($result) { redirect("char_edit.php?action=edit_char&id={$id}&error=3"); } else { redirect("char_edit.php?action=edit_char&id={$id}&error=4"); } } else { $sql->close(); unset($sql); error($lang_char['no_permission']); } } else { $sql->close(); unset($sql); redirect("char_edit.php?action=edit_char&id={$id}&error=2"); } } else { error($lang_char['no_char_found']); } $sql->close(); unset($sql); }
function send_mail() { global $lang_global, $output, $realm_db, $characters_db, $realm_id, $user_name, $from_mail, $mailer_type, $smtp_cfg; if (empty($_POST['body']) || empty($_POST['subject']) || empty($_POST['type']) || empty($_POST['group_sign']) || empty($_POST['group_send'])) { redirect("mail.php?error=1"); } $sqlr = new SQL(); $sqlr->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $sqlc = new SQL(); $sqlc->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $body = explode("\n", $_POST['body']); $subject = $sqlc->quote_smart($_POST['subject']); if (isset($_POST['to']) && $_POST['to'] != '') { $to = $sqlc->quote_smart($_POST['to']); } else { $to = 0; if (!isset($_POST['group_value']) || $_POST['group_value'] === '') { redirect("mail.php?error=1"); } else { $group_value = $sqlc->quote_smart($_POST['group_value']); $group_sign = $sqlc->quote_smart($_POST['group_sign']); $group_send = $sqlc->quote_smart($_POST['group_send']); } } $type = addslashes($_POST['type']); $att_gold = $sqlc->quote_smart($_POST['money']); $att_item = $sqlc->quote_smart($_POST['att_item']); $att_stack = $sqlc->quote_smart($_POST['att_stack']); switch ($type) { case "email": require_once "libs/mailer/class.phpmailer.php"; $mail = new PHPMailer(); $mail->Mailer = $mailer_type; if ($mailer_type == "smtp") { $mail->Host = $smtp_cfg['host']; $mail->Port = $smtp_cfg['port']; if ($smtp_cfg['user'] != '') { $mail->SMTPAuth = true; $mail->Username = $smtp_cfg['user']; $mail->Password = $smtp_cfg['pass']; } } $value = NULL; for ($i = 0; $i < count($body); $i++) { $value .= $body[$i] . "\r\n"; } $body = $value; $mail->From = $from_mail; $mail->FromName = $user_name; $mail->Subject = $subject; $mail->IsHTML(true); $body = str_replace("\n", "<br />", $body); $body = str_replace("\r", " ", $body); $body = str_replace(array("\r\n", "\n", "\r"), '<br />', $body); $body = preg_replace("/([^\\/=\"\\]])((http|ftp)+(s)?:\\/\\/[^<>\\s]+)/i", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $body); $body = preg_replace('/([^\\/=\\"\\]])(www\\.)(\\S+)/', '\\1<a href="http://\\2\\3" target="_blank">\\2\\3</a>', $body); $mail->Body = $body; $mail->WordWrap = 50; if ($to) { //single Recipient $mail->AddAddress($to); if (!$mail->Send()) { $mail->ClearAddresses(); redirect("mail.php?error=3&mail_err=" . $mail->ErrorInfo); } else { $mail->ClearAddresses(); redirect("mail.php?error=2"); } } elseif (isset($group_value)) { //group send $email_array = array(); switch ($group_send) { case "gm_level": $result = $sqlr->query("SELECT email FROM account WHERE gmlevel {$group_sign} '{$group_value}'"); while ($user = $sqlr->fetch_row($result)) { if ($user[0] != "") { array_push($email_array, $user[0]); } } break; case "locked": $result = $sqlr->query("SELECT email FROM account WHERE locked {$group_sign} '{$group_value}'"); while ($user = $sqlr->fetch_row($result)) { if ($user[0] != "") { array_push($email_array, $user[0]); } } break; case "banned": $que = $sqlr->query("SELECT id FROM account_banned"); while ($banned = $sql->fetch_row($que)) { $result = $sqlr->query("SELECT email FROM account WHERE id = '{$banned['0']}'"); if ($sqlr->result($result, 0, 'email')) { array_push($email_array, $sql->result($result, 0, 'email')); } } break; default: redirect("mail.php?error=5"); break; } foreach ($email_array as $mail_addr) { $mail->AddAddress($mail_addr); if (!$mail->Send()) { $mail->ClearAddresses(); redirect("mail.php?error=3&mail_err=" . $mail->ErrorInfo); } else { $mail->ClearAddresses(); } } redirect("mail.php?error=2"); } else { redirect("mail.php?error=1"); } break; case "ingame_mail": $value = NULL; for ($i = 0; $i < count($body); $i++) { $value .= $body[$i] . " "; } $body = $value; $body = str_replace("\r", " ", $body); if ($to) { //single Recipient $result = $sqlc->query("SELECT name FROM characters WHERE name = '{$to}'"); if ($sqlc->num_rows($result) == 1) { $receiver = $sqlc->result($result, 0, 'name'); $mails = array(); array_push($mails, array($receiver, $subject, $body, $att_gold, $att_item, $att_stack)); send_ingame_mail($realm_id, $mails); } else { redirect("mail.php?error=4"); } redirect("mail.php?error=2"); break; } elseif (isset($group_value)) { //group send $char_array = array(); switch ($group_send) { case "gm_level": $result = $sqlr->query("SELECT id FROM account WHERE gmlevel {$group_sign} '{$group_value}'"); while ($acc = $sqlc->fetch_row($result)) { $result_2 = $sqlc->query("SELECT name FROM `characters` WHERE account = '{$acc['0']}'"); while ($char = $sqlc->fetch_row($result_2)) { array_push($char_array, $char[0]); } } break; case "online": $result = $sqlc->query("SELECT name FROM `characters` WHERE online {$group_sign} '{$group_value}'"); while ($user = $sqlc->fetch_row($result)) { array_push($char_array, $user[0]); } break; case "char_level": $result = $sqlc->query("SELECT name FROM `characters` WHERE SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) {$group_sign} '{$group_value}'"); while ($user = $sqlc->fetch_row($result)) { array_push($char_array, $user[0]); } break; default: redirect("mail.php?error=5"); } $mails = array(); foreach ($char_array as $receiver) { array_push($mails, array($receiver, $subject, $body, $att_gold, $att_item, $att_stack)); } send_ingame_mail($realm_id, $mails); redirect("mail.php?error=2"); } break; default: redirect("mail.php?error=1"); } }
function forum_do_add_post(&$sqlm) { global $enablesidecheck, $forum_skeleton, $forum_lang, $minfloodtime, $user_lvl, $user_name, $user_id, $mmfpm_db; if ($enablesidecheck) { $side = get_side(); } // Better to use it here instead of call it many time in the loop :) $sqlm = new SQL(); $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); if ($minfloodtime > 0) { $userposts = $sqlm->query(' SELECT time FROM mm_forum_posts WHERE authorid = ' . $user_id . ' ORDER BY id DESC LIMIT 1'); if ($sqlm->num_rows($userposts) != 0) { $mintimeb4post = $sqlm->fetch_assoc($userposts); $mintimeb4post = time() - strtotime($mintimeb4post['time']); if ($mintimeb4post < $minfloodtime) { error($forum_lang['please_wait']); } } } //==========================$_POST and SECURE================================= if (!isset($_POST['forum'])) { error($forum_lang['no_such_forum']); } else { $forum = $sqlm->quote_smart($_POST['forum']); } //==========================$_POST and SECURE end============================= $cat = 0; foreach ($forum_skeleton as $cid => $category) { foreach ($category['forums'] as $fid => $forum_) { if ($fid == $forum) { $cat = $cid; } } } if (empty($forum_skeleton[$cat]['forums'][$forum])) { error($forum_lang['no_such_forum']); } $forum_ = $forum_skeleton[$cat]['forums'][$forum]; if (($user_lvl > 0 || !$closed) && ($forum_skeleton[$cat]['level_post'] > $user_lvl || $forum_['level_post'] > $user_lvl)) { error($forum_lang['no_access']); } if ($user_lvl == 0 && $enablesidecheck) { if ($forum_skeleton[$cat]['side_access'] != 'ALL') { // Not an all side forum if ($side == 'NO') { // No char continue; } else { if ($forum_skeleton[$cat]['side_access'] != $side) { // Forumside different of the user side continue; } } } if ($forum_['side_access'] != 'ALL') { // Not an all side forum if ($side == 'NO') { // No char continue; } else { if ($forum_['side_access'] != $side) { // Forumside different of the user side continue; } } } } //==========================$_POST and SECURE================================= if (!isset($_POST['topic'])) { error($forum_lang['no_such_topic']); } else { $topic = $sqlm->quote_smart($_POST['topic']); } // $_POST['msg'] = htmlspecialchars($_POST['msg']); $msg = trim($sqlm->quote_smart($_POST['msg']), " "); //==========================$_POST and SECURE end============================= $msg = str_replace('\\n', '<br />', $msg); // $msg = str_replace('\r', '<br />', $msg); if (strlen($msg) < 5) { $sqlm->close(); error($forum_lang['msg_too_short']); } $name = $sqlm->query(' SELECT name FROM mm_forum_posts WHERE id = ' . $topic . ''); $name = $sqlm->fetch_row($name); $name = $sqlm->quote_smart($name[0]); $time = date("m/d/y H:i:s"); $sqlm->query(' INSERT INTO mm_forum_posts (authorid, authorname, forum, topic, name, text, time) VALUES (\'' . $user_id . '\', \'' . $user_name . '\', \'' . $forum . '\', \'' . $topic . '\', \'' . $name . '\', \'' . $msg . '\', \'' . $time . '\')'); $id = $sqlm->insert_id(); $sqlm->query(' UPDATE mm_forum_posts SET lastpost = ' . $id . ' WHERE id = ' . $topic . ''); $sqlm->close(); redirect('forum.php?action=view_topic&id=' . $topic . ''); // Queries : 4 }
function edit_user() { global $lang_edit, $lang_global, $output, $realm_db, $characters_db, $realm_id, $mmfpm_db, $user_name, $user_id, $lang_id_tab, $gm_level_arr, $ren_char, $total_points; mysql_connect($realm_db['addr'], $realm_db['user'], $realm_db['pass']); mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']); $referred_by = mysql_fetch_row(mysql_query("SELECT `InvitedBy` FROM point_system_invites WHERE `PlayersAccount` = '{$user_name}';")); $referred_by = $referred_by[0]; $total_points = mysql_fetch_row(mysql_query("SELECT `points` FROM point_system WHERE `accountid` = '{$user_id}';")); $total_points = $total_points[0]; if ($total_points <= 0) { $total_points = (int) 0; } $datetime = date("Y-m-d H:i:s"); //################################################################################ ############################## // INVITE SYSTEM //################################################################################ ############################## $invite_points = 2; $write_invited = 1; mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']); $rewarded = mysql_fetch_row(mysql_query("SELECT `Rewarded` FROM point_system_invites WHERE `PlayersAccount` = '{$user_name}';")); $rewarded = $rewarded[0]; if ($rewarded != NULL) { if ($rewarded == 0) { if ($referred_by != NULL) { mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']); $total_points = mysql_fetch_row(mysql_query("SELECT `points` FROM point_system WHERE `accountid` = '{$user_id}';")); $total_points = $total_points[0]; if ($total_points == NULL) { $total_points = -1; } if ($total_points >= 0) { mysql_select_db($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $RightLevel = mysql_fetch_row(mysql_query("SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED) AS `lvl` FROM `characters` WHERE account='{$user_id}' AND (SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED)) >= '45' ORDER BY `lvl` DESC LIMIT 1;")); if ($RightLevel[0] != NULL) { mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']); mysql_query("UPDATE point_system SET `points` = ({$total_points} + {$write_invited}) WHERE `accountid` = '{$user_id}';"); mysql_query("INSERT INTO point_system_requests (`username`, `request`, `date`, `code`, `treated`) VALUES ('{$user_name}', 'Got {$write_invited} Points', '{$datetime}', 'For Writing a Reffer', 'Yes');"); mysql_query("UPDATE point_system_invites SET `Rewarded` = '1' WHERE `PlayersAccount` = '{$user_name}';"); $output .= "You Received {$write_invited} Points for Writing who invited you!<br>"; } } if ($total_points == -1) { mysql_select_db($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $RightLevel = mysql_fetch_row(mysql_query("SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED) AS `lvl` FROM `characters` WHERE account='{$user_id}' AND (SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED)) >= '45' ORDER BY `lvl` DESC LIMIT 1;")); if ($RightLevel[0] != NULL) { mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']); mysql_query("INSERT INTO point_system (`accountid`, `points`) VALUES ('{$user_id}', '{$write_invited}');"); mysql_query("INSERT INTO point_system_requests (`username`, `request`, `date`, `code`, `treated`) VALUES ('{$user_name}', 'Created {$write_invited} Points', '{$datetime}', 'For Writing a Reffer', 'Yes');"); mysql_query("UPDATE point_system_invites SET `Rewarded` = '1' WHERE `PlayersAccount` = '{$user_name}';"); $output .= "You Received {$write_invited} Points for Writing who invited you! (NEW)<br>"; } } } } } mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']); $HasPoints = mysql_fetch_row(mysql_query("SELECT `PlayersAccount`,`Treated` FROM point_system_invites WHERE `InviterAccount` = '{$user_name}' AND `Treated` = 0 LIMIT 1;")); if ($HasPoints != NULL) { $HasPoint = $HasPoints[1]; $PlayersAccount = $HasPoints[0]; mysql_select_db($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $iIP = mysql_fetch_row(mysql_query("SELECT `last_ip` FROM account WHERE `username` = '{$PlayersAccount}';")); $pIP = mysql_fetch_row(mysql_query("SELECT `last_ip` FROM account WHERE `username` = '{$user_name}';")); if ($HasPoint != 1) { if ($iIP[0] != $pIP[0]) { mysql_select_db($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $PlayersAccountID = mysql_fetch_row(mysql_query("SELECT `id` FROM account WHERE `username` = '{$PlayersAccount}';")); $PlayersAccountID = $PlayersAccountID[0]; mysql_select_db($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $RightLevel = mysql_fetch_row(mysql_query("SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED) AS `lvl` FROM `characters` WHERE account='{$PlayersAccountID}' AND (SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED)) >= '45' ORDER BY `lvl` DESC LIMIT 1;")); if ($user_id < $PlayersAccountID) { if ($RightLevel[0] != NULL) { $output .= "You received points for account {$PlayersAccount} who has a player level {$RightLevel['0']}<br>"; mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']); $total_points = mysql_fetch_row(mysql_query("SELECT `points` FROM point_system WHERE `accountid` = '{$user_id}';")); $total_points = $total_points[0]; if ($total_points == NULL) { $total_points = -1; } if ($total_points >= 0) { mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']); mysql_query("UPDATE point_system SET `points` = ({$total_points} + {$invite_points}) WHERE `accountid` = '{$user_id}';"); mysql_query("INSERT INTO point_system_requests (`username`, `request`, `date`, `code`, `treated`) VALUES ('{$user_name}', 'Added {$invite_points} Points', '{$datetime}', 'Invited {$PlayersAccount}', 'Yes');"); mysql_query("UPDATE point_system_invites SET `Treated` = '1' WHERE `PlayersAccount` = '{$PlayersAccount}';"); $output .= "You Received {$invite_points} Points for Inviting a Friend, Good JOB!"; } if ($total_points == -1) { mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']); mysql_query("INSERT INTO point_system (`accountid`, `points`) VALUES ('{$user_id}', '{$invite_points}');"); mysql_query("INSERT INTO point_system_requests (`username`, `request`, `date`, `code`, `treated`) VALUES ('{$user_name}', 'Created {$invite_points} Points', '{$datetime}', 'Invited {$PlayersAccount}', 'Yes');"); mysql_query("UPDATE point_system_invites SET `Treated` = '1' WHERE `PlayersAccount` = '{$PlayersAccount}';"); $output .= "You Received {$invite_points} Points for Inviting a Friend, Good JOB! (NEW)"; } } else { mysql_select_db($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $RightLevel = mysql_fetch_row(mysql_query("SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED) AS `lvl` FROM `characters` WHERE account='{$PlayersAccountID}' AND (SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED)) >= '45' ORDER BY `lvl` DESC LIMIT 1;")); mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']); mysql_query("UPDATE point_system_invites SET `Treated` = '1' WHERE `PlayersAccount` = '{$PlayersAccount}';"); $output .= "Players you invited did not reach correct level for points"; if ($RightLevel != NULL) { mysql_query("UPDATE point_system_invites SET `Treated` = '0' WHERE `PlayersAccount` = '{$PlayersAccount}';"); } } } else { $output .= "Inviter is older than you"; mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']); mysql_query("UPDATE point_system_invites SET `Treated` = '1' WHERE `PlayersAccount` = '{$PlayersAccount}';"); } } else { $output .= "Same comp Same IP"; } } else { $output .= "All invite points has been treated"; } } else { $output .= "No New Points to add"; } //################################################################################ ############################## // PRINT //################################################################################ ############################## $sql = new SQL(); $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $result = $sql->query("SELECT email,gmlevel,joindate,expansion FROM account WHERE username ='******'"); if ($acc = $sql->fetch_row($result)) { require_once "scripts/id_tab.php"; $output .= "<center>\r\n <script type=\"text/javascript\" src=\"js/sha1.js\"></script>\r\n <script type=\"text/javascript\">\r\n function do_submit_data () {\r\n document.form.pass.value = hex_sha1('" . strtoupper($user_name) . ":'+document.form.user_pass.value.toUpperCase());\r\n document.form.user_pass.value = '0';\r\n do_submit();\r\n }\r\n\r\n\r\n\r\n</script>\r\n <fieldset style=\"width: 600px;\">\r\n <legend>Credit Panel</legend>\r\n <form method=\"post\" action=\"credit.php?action=getitem\" name=\"form\">\r\n <input type=\"hidden\" name=\"pass\" value=\"\" maxlength=\"256\" />\r\n <table class=\"flat\">\r\n <tr>\r\n <td>Your Credits:</td>\r\n <td>{$total_points}</td>\r\n <tr>\r\n <td>VIP Level</td>\r\n <td>" . get_gm_level($acc[1]) . " ( {$acc['1']} )</td>"; if ($acc[1] == 0) { $output .= "<td><a href=\"credit.php?action=getvip\">Upgrade(20)</td>"; } if ($acc[1] != 0) { if ($acc[1] >= 3) { $output .= "<td><a href=\"credit.php?action=extvip\">Extend VIP(20)</td>"; } else { $output .= "<td><a href=\"credit.php?action=getvip\">Upgrade</td><td><a href=\"credit.php?action=extvip\">Extend VIP(20)</td>"; } } $output .= "</tr>\r\n <td>Request Item:</td></tr><tr>\r\n <td>\r\n <select name=\"items\"> \r\n <option value=\"error\">Please select an item</option>\r\n <option value=\"Phoenix\">Phoenix(20)</option>\r\n <option value=\"Bag\">36 Slot Bag(20)</option>\r\n <option value=\"Raven\">Raven Lord(15)</option>\r\n <option value=\"PrimalNether\">Primal Nether(5)</option>\r\n <option value=\"NetherVortex\">Nether Vortex(8)</option>\r\n <option value=\"MercilessD\">Merciless Nether Drake(25)</option>\r\n <option value=\"Murloc\">Murloc Costume(5)</option>\r\n <option value=\"Tiger60\">Swift Spectral Tiger For lvl 60(20)</option>\r\n <option value=\"Tiger30\">Swift Spectral Tiger For lvl 30(15)</option>\r\n <option value=\"Ogre\">Carved Ogre Idol(5)</option>\r\n <option value=\"FlyingBroom\">Swift Flying Broom(20)</option>\r\n <option value=\"BattleBear\">Big Battle Bear(15)</option>\r\n <option value=\"XRocket\">X-51 Nether-Rocket X-TREME(25)</option>\r\n </select>\r\n </td>\r\n <td><input name=\"character\" type=\"text\" value=\"Character Name\"></input></td>\r\n <td>\r\n <input type=\"submit\" value=\"Send item\">\r\n </td></tr>\r\n <tr><td>Your chars</td>\r\n </tr>"; $result = $sql->query("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '{$user_id}'"); $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $result = $sql->query("SELECT guid,name,race,class,SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) FROM `characters` WHERE account = {$user_id}"); while ($char = $sql->fetch_array($result)) { $ren_char = $char[1]; $output .= "<tr>\r\n <td>{$char['1']} - " . get_player_race($char[2]) . " " . get_player_class($char[3]) . " | lvl {$char['4']}</td>\r\n </tr>\r\n<tr><td><a href=\"credit.php?action=rename&ren_char={$ren_char}\">Rename(6)</a></td><td><a href=\"credit.php?action=gen_char&gend_char={$ren_char}\">Change Gender(6)</a></td><td><a href=\"credit.php?action=movechar&char={$ren_char}\">Move Account(7)</a></td>"; } $output .= "</form> <tr>\r\n <form method=\"post\" action=\"credit.php?action=movepoints\" name=\"form\">\r\n <input type=\"hidden\" name=\"pass\" value=\"\" maxlength=\"256\" />\r\n <td>Transfer points to other players:</td></tr><tr>\r\n <td><input name=\"tcharacter\" type=\"text\" value=\"Character Name\"></input></td><td><input name=\"tpoints\" type=\"text\" value=\"Points\"></input></td>\r\n <td>\r\n <input type=\"submit\" value=\"Transfer\">\r\n </td></tr></form>\r\n <form method=\"post\" action=\"credit.php?action=tplayer\" name=\"form\">\r\n <tr><td>Teleport Player</td></tr><tr>\r\n <td><input name=\"tchar\" type=\"text\" value=\"Character Name\"></input></td>\r\n <td>\r\n <select name=\"tplace\"> \r\n <option value=\"error\">Please select a place</option>\r\n <option value=\"Shattrath\">Shattrath(1)</option>\r\n <option value=\"Stormwind\">Stormwind(1)</option>\r\n <option value=\"Orgrimmar\">Orgrimmar(1)</option>\r\n </select>\r\n </td>\r\n <td><input type=\"submit\" value=\"Teleport\"></td></tr>"; $output .= "</table>\r\n </fieldset>\r\n <br />\r\n\r\n <br /></center>"; } else { error($lang_global['err_no_records_found']); } $sql->close(); }
function do_repair() { global $output, $realm_db, $mmfpm_db, $world_db, $characters_db, $action_permission; valid_login($action_permission['update']); if (empty($_POST['repair_action']) && '' === $_POST['repair_action'] || empty($_POST['check'])) { redirect('repair.php?error=1'); } else { $table_list = $_POST['check']; $table_action = addslashes($_POST['repair_action']); } $sql = new SQL(); $counter = 0; foreach ($table_list as $table) { $table_data = explode('~', $table); if ($table_data[2] == $realm_db['name']) { $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); } elseif ($table_data[2] == $mmfpm_db['name']) { $sql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); } elseif ($table_data[2] == $world_db[$table_data[1]]['name']) { $sql->connect($world_db[$table_data[1]]['addr'], $world_db[$table_data[1]]['user'], $world_db[$table_data[1]]['pass']); } elseif ($table_data[2] == $characters_db[$table_data[1]]['name']) { $sql->connect($characters_db[$table_data[1]]['addr'], $characters_db[$table_data[1]]['user'], $characters_db[$table_data[1]]['pass']); } $action_result = $sql->fetch_row($sql->query('' . $table_action . ' TABLE ' . $table_data[2] . '.' . $table_data[3] . '')); if ($action_result[3] === 'OK') { ++$counter; } else { $err = $action_result[3]; } } unset($action_result); unset($table_data); unset($table); unset($table_action); unset($table_list); if ($counter) { redirect('repair.php?error=2&num=' . $counter . ''); } else { redirect('repair.php?error=4&rep_err=' . $err . ''); } }
function do_delete() { global $world_db, $realm_id; if (isset($_GET['entry'])) { $entry = $_GET['entry']; } else { redirect("game_object.php?error=1"); } $sql = new SQL(); $sql->connect($world_db[$realm_id]['addr'], $world_db[$realm_id]['user'], $world_db[$realm_id]['pass'], $world_db[$realm_id]['name']); $result = $sql->query("SELECT guid FROM gameobject WHERE id = '{$entry}'"); while ($guid = $sql->fetch_row($result)) { $result = $sql->query("DELETE FROM gameobject_respawn WHERE guid = '{$guid}'"); } $sql->query("DELETE FROM gameobject_involvedrelation WHERE id = '{$entry}'"); $sql->query("DELETE FROM gameobject_questrelation WHERE id = '{$entry}'"); $sql->query("DELETE FROM gameobject_loot_template WHERE entry = '{$data1}'"); $sql->query("DELETE FROM gameobject_template WHERE entry = '{$entry}'"); $sql->close(); redirect("game_object.php"); }
function backup_user(&$sqlr, &$sqlc) { global $lang_global, $lang_user, $output, $realm_db, $characters_db, $realm_id, $user_lvl, $backup_dir, $action_permission; valid_login($action_permission['insert']); $sqlr = new SQL(); $sqlr->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); if (isset($_GET['check'])) { $check = $sqlr->quote_smart($_GET['check']); } else { redirect("accounts.php?error=1"); } require_once "libs/tab_lib.php"; $subdir = "{$backup_dir}/accounts/" . date("m_d_y_H_i_s") . "_partial"; mkdir($subdir, 0777); for ($t = 0; $t < count($check); $t++) { if ($check[$t] != "") { $query = $sqlr->query("SELECT id FROM account WHERE id = {$check[$t]}"); $acc = $sqlr->fetch_array($query); $file_name_new = $acc[0] . "_{$realm_db['name']}.sql"; $fp = fopen("{$subdir}/{$file_name_new}", 'w') or die($lang_backup['file_write_err']); fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$realm_db['name']};\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "USE {$realm_db['name']};\n\n") or die($lang_backup['file_write_err']); foreach ($tab_backup_user_realmd as $value) { $acc_query = $sqlr->query("SELECT * FROM {$value['0']} WHERE {$value['1']} = {$acc['0']}"); $num_fields = $sqlr->num_fields($acc_query); $numrow = $sqlr->num_rows($acc_query); $result = "-- Dumping data for {$value['0']} " . date("m.d.y_H.i.s") . "\n"; $result .= "LOCK TABLES {$value['0']} WRITE;\n"; $result .= "DELETE FROM {$value['0']} WHERE {$value['1']} = {$acc['0']};\n"; if ($numrow) { $result .= "INSERT INTO {$value['0']} ("; for ($count = 0; $count < $num_fields; $count++) { $result .= "`" . $sqlr->field_name($acc_query, $count) . "`"; if ($count < $num_fields - 1) { $result .= ","; } } $result .= ") VALUES \n"; for ($i = 0; $i < $numrow; $i++) { $result .= "\t("; $row = $sqlr->fetch_row($acc_query); for ($j = 0; $j < $num_fields; $j++) { $row[$j] = addslashes($row[$j]); $row[$j] = ereg_replace("\n", "\\n", $row[$j]); if (isset($row[$j])) { if ($sqlr->field_type($acc_query, $j) == "int") { $result .= "{$row[$j]}"; } else { $result .= "'{$row[$j]}'"; } } else { $result .= "''"; } if ($j < $num_fields - 1) { $result .= ","; } } if ($i < $numrow - 1) { $result .= "),\n"; } } $result .= ");\n"; } $result .= "UNLOCK TABLES;\n"; $result .= "\n"; fwrite($fp, $result) or die(error($lang_backup['file_write_err'])); } fclose($fp); foreach ($characters_db as $db) { $file_name_new = $acc[0] . "_{$db[$realm_id]['name']}.sql"; $fp = fopen("{$subdir}/{$file_name_new}", 'w') or die(error($lang_backup['file_write_err'])); fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$db[$realm_id]['name']};\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "USE {$db[$realm_id]['name']};\n\n") or die(error($lang_backup['file_write_err'])); $all_char_query = $sqlc->query("SELECT guid,name FROM `characters` WHERE account = {$acc['0']}"); while ($char = $sqlc->fetch_array($all_char_query)) { fwrite($fp, "-- Dumping data for character {$char['1']}\n") or die(error($lang_backup['file_write_err'])); foreach ($tab_backup_user_characters as $value) { $char_query = $sqlc->query("SELECT * FROM {$value['0']} WHERE {$value['1']} = {$char['0']}"); $num_fields = $sqlc->num_fields($char_query); $numrow = $sqlc->num_rows($char_query); $result = "LOCK TABLES {$value['0']} WRITE;\n"; $result .= "DELETE FROM {$value['0']} WHERE {$value['1']} = {$char['0']};\n"; if ($numrow) { $result .= "INSERT INTO {$value['0']} ("; for ($count = 0; $count < $num_fields; $count++) { $result .= "`" . $sqlc->field_name($char_query, $count) . "`"; if ($count < $num_fields - 1) { $result .= ","; } } $result .= ") VALUES \n"; for ($i = 0; $i < $numrow; $i++) { $result .= "\t("; $row = $sqlc->fetch_row($char_query); for ($j = 0; $j < $num_fields; $j++) { $row[$j] = addslashes($row[$j]); $row[$j] = ereg_replace("\n", "\\n", $row[$j]); if (isset($row[$j])) { if ($sqlc->field_type($char_query, $j) == "int") { $result .= "{$row[$j]}"; } else { $result .= "'{$row[$j]}'"; } } else { $result .= "''"; } if ($j < $num_fields - 1) { $result .= ","; } } if ($i < $numrow - 1) { $result .= "),\n"; } } $result .= ");\n"; } $result .= "UNLOCK TABLES;\n"; $result .= "\n"; fwrite($fp, $result) or die(error($lang_backup['file_write_err'])); } } fclose($fp); } } } redirect("accounts.php?error=15"); }
/** * build one table * * Accept following variants: * - csv - to provide a downloadable csv page * - json - to provide all values in one column * - inline - to render tables within articles * - simple - the legacy fixed table * - sortable - click on column to sort the row * * @param the id of the table to build * @param string the variant to provide - default is 'simple' * @return a displayable string */ public static function build($id, $variant = 'simple') { global $context; // split parameters $attributes = preg_split("/\\s*,\\s*/", $id, 3); $id = $attributes[0]; // get the table object if (!($table = Tables::get($id))) { return NULL; } // do the SELECT statement if (!($rows = SQL::query($table['query']))) { Logger::error(sprintf(i18n::s('Error in table query %s'), $id) . BR . htmlspecialchars($table['query']) . BR . SQL::error()); return NULL; } // build the resulting string $text = ''; switch ($variant) { // produce a table readable into MS-Excel case 'csv': // comma separated values $separator = ","; // one row for the title if ($table['title']) { $label = preg_replace('/\\s/', ' ', $table['title']); // encode to ASCII $label = utf8::to_ascii($label, PRINTABLE_SAFE_ALPHABET); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); $text .= '"' . $label . '"'; $text .= "\n"; } // one row for header fields $index = 0; while ($field = SQL::fetch_field($rows)) { if ($index++) { $text .= $separator; } $label = trim(preg_replace('/\\s/', ' ', ucfirst($field->name))); // encode $label = utf8::to_ascii($label, PRINTABLE_SAFE_ALPHABET); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); $text .= '"' . $label . '"'; } $text .= "\n"; // process every table row $row_index = 0; while ($row = SQL::fetch($rows)) { // one cell at a time $index = 0; foreach ($row as $name => $value) { // glue cells if ($index++) { $text .= $separator; } // remove HTML tags $value = strip_tags(str_replace('</', ' </', str_replace(BR, ' / ', $value))); // clean spaces $label = trim(preg_replace('/\\s+/', ' ', $value)); // encode $label = utf8::to_ascii($label, PRINTABLE_SAFE_ALPHABET); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); // make a link if this is a reference if ($index == 1 && $table['with_zoom'] == 'Y') { $label = $context['url_to_home'] . $context['url_to_root'] . $label; } // quote data $text .= '"' . $label . '"'; } // new line $text .= "\n"; } return $text; // a JSON set of values // a JSON set of values case 'json': // get header labels $labels = array(); while ($field = SQL::fetch_field($rows)) { $labels[] = trim(preg_replace('/[^\\w]+/', '', ucfirst($field->name))); } // all items $data = array(); $data['items'] = array(); while ($row = SQL::fetch_row($rows)) { // all rows $datum = array(); $label = FALSE; $index = 0; $link = NULL; foreach ($row as $name => $value) { $index++; // first column is only a link if ($index == 1 && $table['with_zoom'] == 'Y') { $link = $context['url_to_home'] . $context['url_to_root'] . ltrim($value, '/'); continue; } // adjust types to not fool the json encoder if (preg_match('/^(\\+|-){0,1}[0-9]+$/', $value)) { $value = intval($value); } elseif (preg_match('/^(\\+|-){0,1}[0-9\\.,]+$/', $value)) { $value = floatval($value); } elseif (preg_match('/^(true|false)$/i', $value)) { $value = intval($value); } // ensure we have some label for SIMILE Exhibit if (!$label) { $label = $value; } // combine first and second columns if ($index == 2 && $link) { $value = Skin::build_link($link, $value, 'basic'); } // save this value $datum[$labels[$name]] = utf8::to_ascii($value, PRINTABLE_SAFE_ALPHABET); } if ($label && !in_array('label', $labels)) { $datum['label'] = utf8::to_ascii($label, PRINTABLE_SAFE_ALPHABET); } // add a tip, if any $data['items'][] = $datum; } include_once $context['path_to_root'] . 'included/json.php'; $text .= json_encode2($data); return $text; // list of facets for SIMILE Exhibit // list of facets for SIMILE Exhibit case 'json-facets': // columns are actual facets $facets = array(); $index = 0; while ($field = SQL::fetch_field($rows)) { $index++; // first column is only a link if ($index == 1 && $table['with_zoom'] == 'Y') { continue; } // first column has a link if ($index == 2 && $table['with_zoom'] == 'Y') { continue; } // column is a facet $label = '.' . trim(preg_replace('/[^\\w]+/', '', ucfirst($field->name))); $title = trim(str_replace(',', '', ucfirst($field->name))); $facets[] = '<div ex:role="facet" ex:expression="' . $label . '" ex:facetLabel="' . $title . '"></div>'; // only last columns can be faceted if (count($facets) > 7) { array_shift($facets); } } // reverse facet order $facets = array_reverse($facets); // job done $text = join("\n", $facets); return $text; // list of columns for SIMILE Exhibit // list of columns for SIMILE Exhibit case 'json-labels': // get header labels $labels = array(); $index = 0; while ($field = SQL::fetch_field($rows)) { $index++; // first column is only a link if ($index == 1 && $table['with_zoom'] == 'Y') { continue; } // column id $labels[] = '.' . trim(preg_replace('/[^\\w]+/', '', ucfirst($field->name))); // limit the number of columns put on screen if (count($labels) >= 7) { break; } } // job done $text = join(', ', $labels); return $text; // titles of columns for SIMILE Exhibit // titles of columns for SIMILE Exhibit case 'json-titles': // get header labels $labels = array(); $index = 0; while ($field = SQL::fetch_field($rows)) { $index++; // first column is only a link if ($index == 1 && $table['with_zoom'] == 'Y') { continue; } // column header $labels[] = trim(str_replace(',', '', ucfirst($field->name))); } $text = join(', ', $labels); return $text; // produce an HTML table // produce an HTML table default: case 'inline': case 'sortable': // a table with a grid $text .= Skin::table_prefix('grid'); // the title, with a menu to download the table into Excel if ($variant == 'inline') { $item_bar = array(); $item_bar += array(Tables::get_url($id) => $table['title']); $item_bar += array(Tables::get_url($id, 'fetch_as_csv') => 'CSV (Excel)'); if (Surfer::is_associate()) { $item_bar += array(Tables::get_url($id, 'edit') => i18n::s('edit')); } if (count($item_bar)) { $text .= '<caption>' . Skin::build_list($item_bar, 'menu') . "</caption>\n"; } } // column headers are clickable links $cells = array(); $index = 0; while ($field = SQL::fetch_field($rows)) { if ($index++ != 0 || $table['with_zoom'] != 'Y') { $cells[] = ucfirst($field->name); } } $text .= "\t\t" . Skin::table_row($cells, 'sortable'); // the table body $count = 0; $row_index = 0; while ($row = SQL::fetch_row($rows)) { $cells = array(); $link = ''; for ($index = 0; $index < count($row); $index++) { if ($index == 0 && $table['with_zoom'] == 'Y') { $link = $row[$index]; } elseif ($link) { $cells[] = Skin::build_link($link, $row[$index]); $link = ''; } else { $cells[] = $row[$index]; } } $text .= "\t\t" . Skin::table_row($cells, $count++); } $text .= Skin::table_suffix(); return $text; // adapted to open chart flash // adapted to open chart flash case 'chart': // get title for y series $y_title = $y2_title = $y3_title = NULL; $y_index = $y2_index = $y3_index = 0; $index = 0; while ($field = SQL::fetch_field($rows)) { // time will be used for x labels if ($index == 0 && $table['with_zoom'] == 'T') { } elseif ($index == 0 && $table['with_zoom'] == 'Y') { } elseif (!$y_title) { $y_title = '"' . ucfirst($field->name) . '"'; $y_index = $index; } elseif (!$y2_title) { $y2_title = '"' . ucfirst($field->name) . '"'; $y2_index = $index; } elseif (!$y3_title) { $y3_title = '"' . ucfirst($field->name) . '"'; $y3_index = $index; break; } $index++; } // process every table row $x_labels = array(); $y_values = array(); $y2_values = array(); $y3_values = array(); $y_min = $y_max = NULL; $count = 1; while ($row = SQL::fetch($rows)) { // one cell at a time $index = 0; foreach ($row as $name => $value) { // clean spaces $label = trim(preg_replace('/\\s/', ' ', $value)); // encode in iso8859 $label = utf8::to_iso8859($label); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); // quote data if (preg_match('/-*[^0-9\\,\\.]/', $label)) { $label = '"' . $label . '"'; } // x labels if ($index == 0) { if ($table['with_zoom'] == 'T') { array_unshift($x_labels, $label); } else { $x_labels[] = $count++; } // y value } elseif ($index == $y_index) { if ($table['with_zoom'] == 'T') { array_unshift($y_values, $label); } else { $y_values[] = $label; } if (!isset($y_min) || intval($label) < $y_min) { $y_min = intval($label); } if (!isset($y_max) || intval($label) > $y_max) { $y_max = intval($label); } // y2 value } elseif ($index == $y2_index) { if ($table['with_zoom'] == 'T') { array_unshift($y2_values, $label); } else { $y_values[] = $label; } if (!isset($y_min) || intval($label) < $y_min) { $y_min = intval($label); } if (!isset($y_max) || intval($label) > $y_max) { $y_max = intval($label); } // y3 value } elseif ($index == $y3_index) { if ($table['with_zoom'] == 'T') { array_unshift($y3_values, $label); } else { $y_values[] = $label; } if (!isset($y_min) || intval($label) < $y_min) { $y_min = intval($label); } if (!isset($y_max) || intval($label) > $y_max) { $y_max = intval($label); } // we won't process the rest break; } // next column $index++; } } // y minimum if ($y_min > 0) { $y_min = 0; } // y maximum $y_max = strval($y_max); if (strlen($y_max) == 1) { $y_max = 10; } elseif (strlen($y_max) == 2) { $y_max = (intval(substr($y_max, 0, 1)) + 1) * 10; } elseif (strlen($y_max) == 3) { $y_max = (intval(substr($y_max, 0, 2)) + 1) * 10; } else { $y_max = strval(intval(substr($y_max, 0, 2)) + 1) . substr('0000000000000000000000000000000000000000000000000000', 0, strlen($y_max) - 2); } // data series $elements = array(); if (count($y_values)) { $elements[] = '{ "type":"bar_glass", "colour":"#BF3B69", "values": [ ' . join(',', $y_values) . ' ], "text": ' . $y_title . ', "font-size": 12 }'; } if (count($y2_values)) { $elements[] = '{ "type": "line", "width": 1, "colour": "#5E4725", "values": [ ' . join(',', $y2_values) . ' ], "text": ' . $y2_title . ', "font-size": 12 }'; } if (count($y3_values)) { $elements[] = '{ "type":"bar_glass", "colour":"#5E0722", "values": [ ' . join(',', $y3_values) . ' ], "text": ' . $y3_title . ', "font-size": 12 }'; } // the full setup $text = '{ "elements": [ ' . join(',', $elements) . ' ], "x_axis": { "offset": false, "steps": 1, "labels": { "steps": 3, "rotate": 310, "labels": [ ' . join(',', $x_labels) . ' ] } }, "y_axis": { "min": ' . $y_min . ', "max": ' . $y_max . ' } }'; return $text; // first number // first number case 'column': // comma separated values $separator = ","; // process every table row while ($row = SQL::fetch($rows)) { // not always the first column $index = 0; foreach ($row as $name => $value) { $index++; // skip dates and links if ($index == 1 && $table['with_zoom'] != 'N') { continue; } // glue cells if ($text) { $text .= $separator; } // clean spaces $label = trim(preg_replace('/\\s/', ' ', $value)); // encode in iso8859 $label = utf8::to_iso8859($label); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); // quote data if (preg_match('/[^a-zA-Z0-9\\,\\.\\-_]/', $label)) { $text .= '"' . $label . '"'; } else { $text .= $label; } // only first column break; } } return $text; // produce a raw table // produce a raw table case 'raw': // comma separated values $separator = ","; // process every table row while ($row = SQL::fetch($rows)) { // one cell at a time $index = 0; foreach ($row as $name => $value) { // glue cells if ($index++) { $text .= $separator; } // clean spaces $label = trim(preg_replace('/\\s/', ' ', $value)); // encode in iso8859 $label = utf8::to_iso8859($label); // escape quotes to preserve them in the data $label = str_replace('"', '""', $label); // make a link if this is a reference if ($index == 0 && $table['with_zoom'] == 'Y') { $label = $context['url_to_home'] . $context['url_to_root'] . $label; } // quote data if (preg_match('/[^a-zA-Z0-9\\-_]/', $label)) { $text .= '"' . $label . '"'; } else { $text .= $label; } } // new line $text .= "\n"; } return $text; // a simple table // a simple table case 'simple': $text .= Skin::table_prefix('table'); // columns headers $index = 0; while ($field = SQL::fetch_field($rows)) { $cells[] = ucfirst($field->name); } $text .= Skin::table_row($cells, 'header'); // other rows while ($row = SQL::fetch_row($rows)) { $text .= Skin::table_row($row, $count++); } $text .= Skin::table_suffix(); return $text; // xml table // xml table case 'xml': $text = ''; while ($row = SQL::fetch($rows)) { $text .= ' <item>' . "\n"; foreach ($row as $name => $value) { $type = preg_replace('/[^a-z0-9]+/i', '_', $name); if (preg_match('/^[^a-z]/i', $type)) { $type = '_' . $type; } $text .= ' <' . $type . '>' . preg_replace('/&(?!(amp|#\\d+);)/i', '&', utf8::transcode(str_replace(array('left=', 'right='), '', $value))) . '</' . $type . '>' . "\n"; } $text .= ' </item>' . "\n\n"; } return '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<items>' . "\n" . $text . '</items>' . "\n"; } }
function add_tele() { global $output, $lang_tele, $lang_global, $mmfpm_db, $action_permission; valid_login($action_permission['insert']); $sqlw = new SQL(); $output .= "\n <center>\n <fieldset class=\"half_frame\">\n <legend>{$lang_tele['add_new_tele']}</legend>\n <form method=\"get\" action=\"tele.php\" name=\"form\">\n <input type=\"hidden\" name=\"action\" value=\"do_add_tele\" />\n <table class=\"flat\">\n <tr>\n <td>{$lang_tele['loc_name']}</td>\n <td><input type=\"text\" name=\"name\" size=\"42\" maxlength=\"98\" value=\"{$lang_tele['name']}\" /></td>\n </tr>\n <tr>\n <td>{$lang_tele['on_map']}</td>\n <td>\n <select name=\"map\">"; $sqlw->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); $map_query = $sqlw->query("SELECT id, name01 from dbc_map order by id"); while ($map = $sqlw->fetch_row($map_query)) { $output .= "\n <option value=\"{$map[0]}\">{$map[0]} : {$map[1]}</option>"; } unset($map); unset($map_query); $output .= "\n </select>\n </td>\n </tr>\n <tr>\n <td>{$lang_tele['position_x']}</td>\n <td><input type=\"text\" name=\"x\" size=\"42\" maxlength=\"36\" value=\"0.0000\" /></td>\n </tr>\n <tr>\n <td>{$lang_tele['position_y']}</td>\n <td><input type=\"text\" name=\"y\" size=\"42\" maxlength=\"36\" value=\"0.0000\" /></td>\n </tr>\n <tr>\n <td>{$lang_tele['position_z']}</td>\n <td><input type=\"text\" name=\"z\" size=\"42\" maxlength=\"36\" value=\"0.0000\" /></td>\n </tr>\n <tr>\n <td>{$lang_tele['orientation']}</td>\n <td><input type=\"text\" name=\"orientation\" size=\"42\" maxlength=\"36\" value=\"0\" /></td>\n </tr>\n <tr>\n <td>\n </td>\n <td>"; makebutton($lang_tele['add_new'], "javascript:do_submit()", 130); makebutton($lang_global['back'], "tele.php\" type=\"def", 130); $output .= "\n </td>\n </tr>\n </table>\n </form>\n </fieldset>\n <br /><br />\n </center>\n"; }
function delete_spwn() { global $world_db, $realm_id, $user_lvl, $action_permission; if ($user_lvl < $action_permission['delete']) { redirect("creature.php?error=9"); } if (isset($_GET['entry'])) { $entry = $_GET['entry']; } else { redirect("creature.php?error=1"); } $sql = new SQL(); $sql->connect($world_db[$realm_id]['addr'], $world_db[$realm_id]['user'], $world_db[$realm_id]['pass'], $world_db[$realm_id]['name']); $result = $sql->query("SELECT guid FROM creature WHERE id = '{$entry}'"); while ($guid = $sql->fetch_row($result)) { $sql->query("DELETE FROM creature_movement WHERE id = '{$guid}'"); } $sql->query("DELETE FROM creature WHERE id = '{$entry}'"); $sql->close(); redirect("creature.php?action=edit&entry={$entry}&error=4"); }
function run_cleanup() { global $lang_cleanup, $lang_global, $output, $realm_db, $characters_db, $realm_id, $user_lvl; if (empty($_GET['cleanup_by']) || empty($_GET['cleanup_sign'])) { redirect("cleanup.php?error=1"); } $sql = new SQL(); $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $cleanup_by = $sql->quote_smart($_GET['cleanup_by']); $cleanup_sign = $sql->quote_smart($_GET['cleanup_sign']); $cleanup_value = $sql->quote_smart($_GET['cleanup_value']); switch ($cleanup_by) { // clean by lvl case "char_lvl": $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $result = $sql->query("SELECT guid FROM `characters` WHERE level {$cleanup_sign} {$cleanup_value}"); $total_chars = $sql->num_rows($result); $output .= "<center>"; if ($total_chars) { $output .= "<h1><font class=\"error\">{$lang_global['are_you_sure']}</font></h1><br />"; $output .= "<form action=\"cleanup.php?action=docleanup\" method=\"post\" name=\"form\">\r\n <input type=\"hidden\" name=\"type\" value=\"char\" />\r\n <font class=\"bold\">{$lang_cleanup['chars_id']}: "; $pass_array = ""; while ($char = $sql->fetch_row($result)) { $output .= "<a href=\"char.php?id={$char['0']}\" target=\"_blank\">{$char['0']}, </a>"; $pass_array .= "-{$char['0']}"; } $output .= "<input type=\"hidden\" name=\"check\" value=\"{$pass_array}\" />"; $output .= "<br />{$lang_cleanup['tot_of']} {$total_chars} {$lang_global['will_be_erased']}</font><br /><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['yes'], "javascript:do_submit()", 120); makebutton($lang_global['no'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>\r\n </form>"; } else { $output .= "<h1><font class=\"error\">{$lang_global['err_no_records_found']}</font></h1><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['go_back'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>"; } $output .= "</center><br />"; break; //last loggin //last loggin case "last_login": $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $result = $sql->query("SELECT id FROM account WHERE last_login {$cleanup_sign} '{$cleanup_value}' AND gmlevel < {$user_lvl}"); $total_accounts = $sql->num_rows($result); $output .= "<center>"; if ($total_accounts) { $output .= "<h1><font class=\"error\">{$lang_global['are_you_sure']}</font></h1><br />"; $output .= "<form action=\"cleanup.php?action=docleanup\" method=\"post\" name=\"form\">\r\n <input type=\"hidden\" name=\"type\" value=\"acc\" />\r\n <font class=\"bold\">{$lang_cleanup['acc_ids']}: "; $pass_array = ""; while ($acc = $sql->fetch_row($result)) { $output .= "<a href=\"user.php?action=edit_user&id={$acc['0']}\" target=\"_blank\">{$acc['0']}, </a>"; $pass_array .= "-{$acc['0']}"; } $output .= "<input type=\"hidden\" name=\"check\" value=\"{$pass_array}\" />"; $output .= "<br />{$lang_cleanup['tot_of']} {$total_accounts} {$lang_global['will_be_erased']}</font><br /><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['yes'], "javascript:do_submit()", 120); makebutton($lang_global['no'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>\r\n </form>"; } else { $output .= "<h1><font class=\"error\">{$lang_global['err_no_records_found']}</font></h1><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['go_back'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>"; } $output .= "</center><br />"; break; //failed loggin attempts //failed loggin attempts case "failed_login": $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $result = $sql->query("SELECT id FROM account WHERE failed_logins {$cleanup_sign} {$cleanup_value} AND gmlevel < {$user_lvl}"); $total_accounts = $sql->num_rows($result); $output .= "<center>"; if ($total_accounts) { $output .= "<h1><font class=\"error\">{$lang_global['are_you_sure']}</font></h1><br />"; $output .= "<form action=\"cleanup.php?action=docleanup\" method=\"post\" name=\"form\">\r\n <input type=\"hidden\" name=\"type\" value=\"acc\" />\r\n <font class=\"bold\">{$lang_cleanup['acc_ids']}: "; $pass_array = ""; while ($acc = $sql->fetch_row($result)) { $output .= "<a href=\"user.php?action=edit_user&id={$acc['0']}\" target=\"_blank\">{$acc['0']}, </a>"; $pass_array .= "-{$acc['0']}"; } $output .= "<input type=\"hidden\" name=\"check\" value=\"{$pass_array}\" />"; $output .= "<br />{$lang_cleanup['tot_of']} {$total_accounts} {$lang_global['will_be_erased']}</font><br /><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['yes'], "javascript:do_submit()", 120); makebutton($lang_global['no'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>\r\n </form>"; } else { $output .= "<h1><font class=\"error\">{$lang_global['err_no_records_found']}</font></h1><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['go_back'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>"; } $output .= "</center><br />"; break; //clean banned accounts //clean banned accounts case "banned": $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $result = $sql->query("SELECT id FROM account_banned"); $total_accounts = $sql->num_rows($result); $output .= "<center>"; if ($total_accounts) { $output .= "<h1><font class=\"error\">{$lang_global['are_you_sure']}</font></h1><br />"; $output .= "<form action=\"cleanup.php?action=docleanup\" method=\"post\" name=\"form\">\r\n <input type=\"hidden\" name=\"type\" value=\"acc\" />\r\n <font class=\"bold\">{$lang_cleanup['acc_ids']}: "; $pass_array = ""; while ($acc = $sql->fetch_row($result)) { $output .= "<a href=\"user.php?action=edit_user&id={$acc['0']}\" target=\"_blank\">{$acc['0']}, </a>"; $pass_array .= "-{$acc['0']}"; } $output .= "<input type=\"hidden\" name=\"check\" value=\"{$pass_array}\" />"; $output .= "<br />{$lang_cleanup['tot_of']} {$total_accounts} {$lang_global['will_be_erased']}</font><br /><br />"; $output .= " <table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['yes'], "javascript:do_submit()", 120); makebutton($lang_global['no'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>\r\n </form>"; } else { $output .= "<h1><font class=\"error\">{$lang_global['err_no_records_found']}</font></h1><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['go_back'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>"; } $output .= "</center><br />"; break; //clean chars with given total time played //clean chars with given total time played case "totaltime": $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $result = $sql->query("SELECT guid FROM `characters` WHERE totaltime {$cleanup_sign} {$cleanup_value}"); $total_chars = $sql->num_rows($result); $output .= "<center>"; if ($total_chars) { $output .= "<h1><font class=\"error\">{$lang_global['are_you_sure']}</font></h1><br />"; $output .= "<form action=\"cleanup.php?action=docleanup\" method=\"post\" name=\"form\">\r\n <input type=\"hidden\" name=\"type\" value=\"char\" />\r\n <font class=\"bold\">{$lang_cleanup['chars_id']}: "; $pass_array = ""; while ($char = $sql->fetch_row($result)) { $output .= "<a href=\"char.php?id={$char['0']}\" target=\"_blank\">{$char['0']}, </a>"; $pass_array .= "-{$char['0']}"; } $output .= "<input type=\"hidden\" name=\"check\" value=\"{$pass_array}\" />"; $output .= "<br />{$lang_cleanup['tot_of']} {$total_chars} {$lang_global['will_be_erased']}</font><br /><br />"; $output .= " <table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['yes'], "javascript:do_submit()", 120); makebutton($lang_global['no'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>\r\n </form>"; } else { $output .= "<h1><font class=\"error\">{$lang_global['err_no_records_found']}</font></h1><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['go_back'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>"; } $output .= "</center><br />"; break; //clean locked acc //clean locked acc case "locked": $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $result = $sql->query("SELECT id FROM account WHERE locked {$cleanup_sign} {$cleanup_value} AND gmlevel < {$user_lvl}"); $total_accounts = $sql->num_rows($result); $output .= "<center>"; if ($total_accounts) { $output .= "<h1><font class=\"error\">{$lang_global['are_you_sure']}</font></h1><br />"; $output .= "<form action=\"cleanup.php?action=docleanup\" method=\"post\" name=\"form\">\r\n <input type=\"hidden\" name=\"type\" value=\"acc\" />\r\n <font class=\"bold\">{$lang_cleanup['acc_ids']}: "; $pass_array = ""; while ($acc = $sql->fetch_row($result)) { $output .= "<a href=\"user.php?action=edit_user&id={$acc['0']}\" target=\"_blank\">{$acc['0']}, </a>"; $pass_array .= "-{$acc['0']}"; } $output .= "<input type=\"hidden\" name=\"check\" value=\"{$pass_array}\" />"; $output .= "<br />{$lang_cleanup['tot_of']} {$total_accounts} {$lang_global['will_be_erased']}</font><br /><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['yes'], "javascript:do_submit()", 120); makebutton($lang_global['no'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>\r\n </form>"; } else { $output .= "<h1><font class=\"error\">{$lang_global['err_no_records_found']}</font></h1><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['go_back'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>"; } $output .= "</center><br />"; break; //accounts without chars or specified number of chars //accounts without chars or specified number of chars case "num_of_char_in_acc": $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); $result = $sql->query("SELECT id FROM account WHERE gmlevel < {$user_lvl}"); $acc_output_array = array(); while ($acc = $sql->fetch_row($result)) { $total_chars_in_acc = 0; foreach ($characters_db as $db) { $sql->connect($db['addr'], $db['user'], $db['pass'], $db['name']); $query = $sql->query("SELECT count(*) FROM `characters` WHERE account = '{$acc['0']}'"); $total_chars_in_acc = $total_chars_in_acc + $sql->result($query, 0); } switch ($cleanup_sign) { case "=": if ($total_chars_in_acc == $cleanup_value) { array_push($acc_output_array, $acc[0]); } break; case "<": if ($total_chars_in_acc < $cleanup_value) { array_push($acc_output_array, $acc[0]); } break; case "<=": if ($total_chars_in_acc <= $cleanup_value) { array_push($acc_output_array, $acc[0]); } break; case ">": if ($total_chars_in_acc > $cleanup_value) { array_push($acc_output_array, $acc[0]); } break; case ">=": if ($total_chars_in_acc >= $cleanup_value) { array_push($acc_output_array, $acc[0]); } break; case "!=": if ($total_chars_in_acc != $cleanup_value) { array_push($acc_output_array, $acc[0]); } break; default: redirect("cleanup.php?error=1"); } } $output .= "<center>"; if ($acc_output_array) { $output .= "<h1><font class=\"error\">{$lang_global['are_you_sure']}</font></h1><br />"; $output .= "<form action=\"cleanup.php?action=docleanup\" method=\"post\" name=\"form\">\r\n <input type=\"hidden\" name=\"type\" value=\"acc\" />\r\n <font class=\"bold\">{$lang_cleanup['acc_ids']}: "; $pass_array = ""; for ($i = 0; $i < count($acc_output_array); $i++) { $output .= "<a href=\"user.php?action=edit_user&id={$acc_output_array[$i]}\" target=\"_blank\">{$acc_output_array[$i]}, </a>"; $pass_array .= "-{$acc_output_array[$i]}"; } $output .= "<input type=\"hidden\" name=\"check\" value=\"{$pass_array}\" />"; $output .= "<br />{$lang_cleanup['tot_of']} " . count($acc_output_array) . " {$lang_global['will_be_erased']}</font><br /><br />"; $output .= " <table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['yes'], "javascript:do_submit()", 120); makebutton($lang_global['no'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>\r\n </form>"; } else { $output .= "<h1><font class=\"error\">{$lang_global['err_no_records_found']}</font></h1><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['go_back'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>"; } $output .= "</center><br />"; break; //guild without chars or specified number of chars //guild without chars or specified number of chars case "num_of_char_in_guild": $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $result = $sql->query("SELECT guildid FROM guild"); $guild_output_array = array(); while ($guild = $sql->fetch_row($result)) { $query = $sql->query("SELECT count(*) FROM guild_member WHERE guildid = '{$guild['0']}'"); $total_chars_in_guild = $sql->result($query, 0); switch ($cleanup_sign) { case "=": if ($total_chars_in_guild == $cleanup_value) { array_push($guild_output_array, $guild[0]); } break; case "<": if ($total_chars_in_guild < $cleanup_value) { array_push($guild_output_array, $guild[0]); } break; case "<=": if ($total_chars_in_guild <= $cleanup_value) { array_push($guild_output_array, $guild[0]); } break; case ">": if ($total_chars_in_guild > $cleanup_value) { array_push($guild_output_array, $guild[0]); } break; case ">=": if ($total_chars_in_guild >= $cleanup_value) { array_push($guild_output_array, $guild[0]); } break; case "!=": if ($total_chars_in_guild != $cleanup_value) { array_push($guild_output_array, $guild[0]); } break; default: redirect("cleanup.php?error=1"); } } $output .= "<center>"; if ($guild_output_array) { $output .= "<h1><font class=\"error\">{$lang_global['are_you_sure']}</font></h1><br />"; $output .= "<form action=\"cleanup.php?action=docleanup\" method=\"post\" name=\"form\">\r\n <input type=\"hidden\" name=\"type\" value=\"guild\" />\r\n <font class=\"bold\">{$lang_cleanup['guilds_id']}: "; $pass_array = ""; for ($i = 0; $i < count($guild_output_array); $i++) { $output .= "<a href=\"guild.php?action=view_guild&error=3&id={$guild_output_array[$i]}\" target=\"_blank\">{$guild_output_array[$i]}, </a>"; $pass_array .= "-{$guild_output_array[$i]}"; } $output .= "<input type=\"hidden\" name=\"check\" value=\"{$pass_array}\" />"; $output .= "<br />{$lang_cleanup['tot_of']} " . count($guild_output_array) . " {$lang_global['will_be_erased']}</font><br /><br />"; $output .= " <table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['yes'], "javascript:do_submit()", 120); makebutton($lang_global['no'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>\r\n </form>"; } else { $output .= "<h1><font class=\"error\">{$lang_global['err_no_records_found']}</font></h1><br />"; $output .= "<table class=\"hidden\">\r\n <tr><td>"; makebutton($lang_global['go_back'], "cleanup.php", 120); $output .= "</td></tr>\r\n </table>"; } $output .= "</center><br />"; break; default: redirect("Location: cleanup.php?error=1"); } $sql->close(); unset($sql); }
function sql_table_dump($dbhost, $dbuser, $dbpass, $database, $table, $construct, $file) { global $lang_global; $sql_0 = new SQL(); $sql_0->connect($dbhost, $dbuser, $dbpass, $database, true); $fp = fopen($file, 'r+') or die(error($lang_backup['file_write_err'])); fseek($fp, 0, SEEK_END); fwrite($fp, "--\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "-- Dump of {$database}.{$table}\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "-- Dump DATE : " . date("m.d.y H:i:s") . "\n--\n\n") or die(error($lang_backup['file_write_err'])); if ($construct) { fwrite($fp, "-- Table structure for table {$database}.{$table}\n") or die(error($lang_backup['file_write_err'])); if (!($fi = $sql_0->query("DESC " . $table))) { error($sql_0->error()); } fwrite($fp, "DROP TABLE IF EXISTS {$table};\n") or die(error($lang_backup['file_write_err'])); $pri = ""; $creatinfo = array(); while ($tmp = $sql_0->fetch_row($fi)) { $con = "`" . $tmp[0] . "` "; $con .= trim($tmp[1] . " "); if ($tmp[2] != "YES") { $con .= " NOT NULL"; } if ($tmp[4]) { if ($tmp[4] == 'CURRENT_TIMESTAMP' || $tmp[4] == 'timestamp') { $con .= " default " . $tmp[4]; } else { $con .= " default '" . $tmp[4] . "'"; } } else { if ($tmp[4] === '' && $tmp[3] != "PRI") { $con .= " default ''"; } else { if (strlen($tmp[4]) != 0) { $con .= " default '0'"; } } } if (strtolower($tmp[5]) == "auto_increment") { $con .= " auto_increment"; } $creatinfo[] = $con; } $fieldscon = implode(",\n\t", $creatinfo); fwrite($fp, "CREATE TABLE " . $table . " (") or die(error($lang_backup['file_write_err'])); fwrite($fp, "\n\t{$fieldscon}") or die(error($lang_backup['file_write_err'])); $qkey = $sql_0->query("SHOW INDEX FROM " . $table); if ($rkey = $sql_0->fetch_array($qkey)) { $knames = array(); $keys = array(); do { $keys[$rkey["Key_name"]]["nonunique"] = $rkey["Non_unique"]; if (!$rkey["Sub_part"]) { $keys[$rkey["Key_name"]]["order"][$rkey["Seq_in_index"] - 1] = $rkey["Column_name"]; } else { $keys[$rkey["Key_name"]]["order"][$rkey["Seq_in_index"] - 1] = $rkey["Column_name"] . "(" . $rkey["Sub_part"] . ")"; } $flag = false; for ($l = 0; $l < sizeof($knames); $l++) { if ($knames[$l] == $rkey["Key_name"]) { $flag = true; } } if (!$flag) { $knames[] = $rkey["Key_name"]; } } while ($rkey = $sql_0->fetch_array($qkey)); for ($kl = 0; $kl < sizeof($knames); $kl++) { if ($knames[$kl] == "PRIMARY") { fwrite($fp, ",\n\tPRIMARY KEY") or die(error($lang_backup['file_write_err'])); } else { if ($keys[$knames[$kl]]["nonunique"] == "0") { fwrite($fp, ",\n\tUNIQUE `{$knames[$kl]}`") or die(error($lang_backup['file_write_err'])); } else { fwrite($fp, ",\n\tKEY `{$knames[$kl]}`") or die(error($lang_backup['file_write_err'])); } } $a = @implode("`,`", $keys[$knames[$kl]]["order"]); fwrite($fp, " (`{$a}`)") or die(error($lang_backup['file_write_err'])); } } $query_res = $sql_0->query("SHOW TABLE STATUS FROM {$database} WHERE Name = '{$table}'"); $tmp = $sql_0->fetch_row($query_res); $query_charset = $sql_0->query("SHOW VARIABLES WHERE Variable_name = 'character_set_database'"); $info = " "; if ($tmp[1]) { $info .= "ENGINE={$tmp['1']} "; } $info .= "DEFAULT CHARSET=" . $sql_0->result($query_charset, 0, 'Value') . " "; if ($tmp[16]) { $info .= strtoupper($tmp[16]) . " "; } if ($tmp[10]) { $info .= "AUTO_INCREMENT={$tmp['10']} "; } if ($tmp[17]) { $info .= "COMMENT='{$tmp['17']}'"; } fwrite($fp, "\n){$info};\n\n") or die(error($lang_backup['file_write_err'])); } $query = $sql_0->query("SELECT * FROM {$table}"); $num_fields = $sql_0->num_fields($query); $numrow = $sql_0->num_rows($query); $row_counter = 0; if ($numrow) { fwrite($fp, "-- Dumping data for table {$database}.{$table}\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "LOCK TABLES {$table} WRITE;\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "DELETE FROM {$table};\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "INSERT INTO {$table} (") or die(error($lang_backup['file_write_err'])); for ($count = 0; $count < $num_fields; $count++) { fwrite($fp, "`" . $sql_0->field_name($query, $count) . "`") or die(error($lang_backup['file_write_err'])); if ($count < $num_fields - 1) { fwrite($fp, ",") or die(error($lang_backup['file_write_err'])); } } fwrite($fp, ") VALUES \n") or die(error($lang_backup['file_write_err'])); for ($i = 0; $i < $numrow; $i++) { $row_counter++; fwrite($fp, "\t(") or die(error($lang_backup['file_write_err'])); $row = $sql_0->fetch_row($query); for ($j = 0; $j < $num_fields; $j++) { $row[$j] = addslashes($row[$j]); $row[$j] = ereg_replace("\n", "\\n", $row[$j]); if (isset($row[$j])) { if ($sql_0->field_type($query, $j) == "int") { fwrite($fp, "{$row[$j]}") or die(error($lang_backup['file_write_err'])); } else { fwrite($fp, "'{$row[$j]}'") or die(error($lang_backup['file_write_err'])); } } else { fwrite($fp, "''") or die(error($lang_backup['file_write_err'])); } if ($j < $num_fields - 1) { fwrite($fp, ",") or die(error($lang_backup['file_write_err'])); } } if ($row_counter >= 10) { fwrite($fp, ");\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "INSERT INTO {$table} (") or die(error($lang_backup['file_write_err'])); for ($count = 0; $count < $num_fields; $count++) { fwrite($fp, "`" . $sql_0->field_name($query, $count) . "`") or die(error($lang_backup['file_write_err'])); if ($count < $num_fields - 1) { fwrite($fp, ",") or die(error($lang_backup['file_write_err'])); } } fwrite($fp, ") VALUES \n") or die(error($lang_backup['file_write_err'])); $row_counter = 0; } elseif ($i < $numrow - 1) { fwrite($fp, "),\n") or die(error($lang_backup['file_write_err'])); } } fwrite($fp, ");\n") or die(error($lang_backup['file_write_err'])); fwrite($fp, "UNLOCK TABLES;\n") or die(error($lang_backup['file_write_err'])); } else { fwrite($fp, "-- EMPTY\n") or die(error($lang_backup['file_write_err'])); } $sql_0->close(); fwrite($fp, "\n") or die(error($lang_backup['file_write_err'])); fclose($fp); }
// link to the scan page $context['text'] .= '<p><a href="scan.php">' . i18n::s('Look for software extensions') . "</a></p>\n"; // no tables } elseif (SQL::count_tables() < 5) { // title $context['page_title'] = i18n::s('Please create tables'); // splash screen $context['text'] .= '<p>' . i18n::s('The database is currently empty. Please follow the link to create tables of the database.') . "</p>\n"; // link to the setup page $context['text'] .= '<p><a href="setup.php">' . i18n::s('Create tables in the database') . "</a></p>\n"; } else { // the user table is empty $query = "SELECT count(*) FROM " . SQL::table_name('users'); $count = 0; if ($result = SQL::query($query, TRUE, $context['users_connection'])) { $row = SQL::fetch_row($result); $count = $row[0]; } if (!$result || $count == 0) { // title $context['page_title'] = i18n::s('Please populate tables'); // splash screen $context['text'] .= '<p>' . i18n::s('The user table is currently empty. Please follow the link to populate the database.') . "</p>\n"; // link to the populate page $context['text'] .= '<p><a href="populate.php">' . i18n::s('Jump to the populate page') . "</a></p>\n"; // no parameters configured yet for the skin } elseif (!file_exists('../parameters/skins.include.php')) { // title $context['page_title'] = i18n::s('Please configure your server'); // splash screen $context['text'] .= '<p>' . i18n::s('A configuration file is missing. If you are installing a brand new server, follow the link to create one.') . "</p>\n";
function view_guild() { global $lang_guild, $lang_global, $output, $realm_db, $characters_db, $mmfpm_db, $realm_id, $itemperpage, $action_permission, $user_lvl, $user_id, $showcountryflag; if (!isset($_GET['id'])) { redirect("guild.php?error=1&realm={$realmid}"); } $sqlr = new SQL(); $sqlr->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']); if (empty($_GET['realm'])) { $realmid = $realm_id; } else { $realmid = $sqlr->quote_smart($_GET['realm']); if (!is_numeric($realmid)) { $realmid = $realm_id; } } $sqlc = new SQL(); $sqlc->connect($characters_db[$realmid]['addr'], $characters_db[$realmid]['user'], $characters_db[$realmid]['pass'], $characters_db[$realmid]['name']); $guild_id = $sqlc->quote_smart($_GET['id']); if (is_numeric($guild_id)) { } else { redirect("guild.php?error=6&realm={$realmid}"); } //==========================SQL INGUILD and GUILDLEADER====================== $q_inguild = $sqlc->query("select 1 from guild_member where guildid = '{$guild_id}' and guid in (select guid from characters where account = '{$user_id}')"); $inguild = $sqlc->result($q_inguild, 0, '1'); if ($user_lvl < $action_permission['update'] && !$inguild) { redirect("guild.php?error=6&realm={$realmid}"); } $q_amIguildleader = $sqlc->query("select 1 from guild where guildid = '{$guild_id}' and leaderguid in (select guid from characters where account = '{$user_id}')"); $amIguildleader = $sqlc->result($q_amIguildleader, 0, '1'); $q_guildmemberCount = $sqlc->query("SELECT 1 from guild_member where guildid = '{$guild_id}'"); $guildmemberCount = $sqlc->num_rows($q_guildmemberCount); //====================SQL INGUILD and GUILDLEADER end======================== //==========================$_GET and SECURE================================= $start = isset($_GET['start']) ? $sqlc->quote_smart($_GET['start']) : 0; if (is_numeric($start)) { } else { $start = 0; } $order_by = isset($_GET['order_by']) ? $sqlc->quote_smart($_GET['order_by']) : "mrank"; if (!preg_match("/^[_[:lower:]]{1,10}\$/", $order_by)) { $order_by = "mrank"; } $dir = isset($_GET['dir']) ? $sqlc->quote_smart($_GET['dir']) : 1; if (!preg_match("/^[01]{1}\$/", $dir)) { $dir = 1; } $order_dir = $dir ? "ASC" : "DESC"; $dir = $dir ? 0 : 1; //==========================$_GET and SECURE end============================= $query = $sqlc->query("SELECT guildid, name, info, MOTD, createdate,\r\n (select count(*) from guild_member where guildid = '{$guild_id}') as mtotal,\r\n (select count(*) from guild_member where guildid = '{$guild_id}' and guid in\r\n (select guid from characters where online = 1)) as monline\r\n FROM guild WHERE guildid = '{$guild_id}'"); $guild_data = $sqlc->fetch_row($query); $output .= "\r\n<center>\r\n\t<div id=\"tab_content\">\r\n\t\t<div id=\"tab\">\r\n\t\t\t<ul>\r\n\t\t\t\t<li id=\"selected\"><a href=\"guild.php?action=view_guild&realm={$realmid}&error=3&id={$guild_data['0']}\">" . $lang_guild['members'] . "</a></li>\r\n\t\t\t\t<li><a href=\"guildbank.php?id={$guild_id}&realm={$realmid}\">" . $lang_guild['guildbank'] . "</a></li>\r\n\t\t\t</ul>\r\n\t\t</div>\r\n"; $output .= "\r\n <script type=\"text/javascript\">\r\n answerbox.btn_ok='{$lang_global['yes']}';\r\n answerbox.btn_cancel='{$lang_global['no']}';\r\n </script>\r\n\t\t<div id=\"tab_content2\">\r\n\t\t\t<table class=\"hidden\" style=\"width: 100%;\">\r\n <tr>\r\n <td>\r\n <table class=\"lined\"style=\"width: 100%;\">\r\n <tr>\r\n <td width=\"25%\"><b>{$lang_guild['create_date']}:</b><br />" . date('o-m-d', $guild_data[4]) . "</td>\r\n <td width=\"50%\" class=\"bold\">{$guild_data['1']}</td>\r\n <td width=\"25%\"><b>{$lang_guild['tot_m_online']}:</b><br />{$guild_data['6']} / {$guild_data['5']}</td>\r\n </tr>"; if ($guild_data[2] != '') { $output .= "\r\n <tr>\r\n <td colspan=\"3\"><b>{$lang_guild['info']}:</b><br />{$guild_data['2']}</td>\r\n </tr>"; } if ($guild_data[3] != '') { $output .= "\r\n <tr>\r\n <td colspan=\"3\"><b>{$lang_guild['motd']}:</b><br />{$guild_data['3']}</td>\r\n </tr>"; } $output .= "\r\n </table>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align=\"right\">" . generate_pagination("guild.php?action=view_guild&realm={$realmid}&id={$guild_id}&order_by={$order_by}&dir=" . ($dir ? 0 : 1) . "", $guildmemberCount, $itemperpage, $start) . "</td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <table class=\"lined\" style=\"width: 100%;\">\r\n <tr>\r\n <th width=\"1%\">{$lang_guild['remove']}</th>\r\n <th width=\"20%\"><a href=\"guild.php?action=view_guild&error=3&realm={$realmid}&id={$guild_id}&order_by=cname&start={$start}&dir={$dir}\">" . ($order_by == 'cname' ? "<img src=\"img/arr_" . ($dir ? "up" : "dw") . ".gif\" alt=\"\" /> " : "") . "{$lang_guild['name']}</a></th>\r\n <th width=\"1%\"><a href=\"guild.php?action=view_guild&error=3&realm={$realmid}&id={$guild_id}&order_by=crace&start={$start}&dir={$dir}\">" . ($order_by == 'crace' ? "<img src=\"img/arr_" . ($dir ? "up" : "dw") . ".gif\" alt=\"\" /> " : "") . "{$lang_guild['race']}</a></th>\r\n <th width=\"1%\"><a href=\"guild.php?action=view_guild&error=3&realm={$realmid}&id={$guild_id}&order_by=class&start={$start}&dir={$dir}\">" . ($order_by == 'cclass' ? "<img src=\"img/arr_" . ($dir ? "up" : "dw") . ".gif\" alt=\"\" /> " : "") . "{$lang_guild['class']}</a></th>\r\n <th width=\"1%\"><a href=\"guild.php?action=view_guild&error=3&realm={$realmid}&id={$guild_id}&order_by=clevel&start={$start}&dir={$dir}\">" . ($order_by == 'clevel' ? "<img src=\"img/arr_" . ($dir ? "up" : "dw") . ".gif\" alt=\"\" /> " : "") . "{$lang_guild['level']}</a></th>\r\n <th width=\"23%\"><a href=\"guild.php?action=view_guild&error=3&realm={$realmid}&id={$guild_id}&order_by=mrank&start={$start}&dir={$dir}\">" . ($order_by == 'mrank' ? "<img src=\"img/arr_" . ($dir ? "up" : "dw") . ".gif\" alt=\"\" /> " : "") . "{$lang_guild['rank']}</a></th>\r\n <th width=\"25%\">{$lang_guild['pnote']}</th>\r\n <th width=\"25%\">{$lang_guild['offnote']}</th>\r\n <th width=\"1%\"><a href=\"guild.php?action=view_guild&error=3&realm={$realmid}&id={$guild_id}&order_by=clogout&start={$start}&dir={$dir}\">" . ($order_by == 'clogout' ? "<img src=\"img/arr_" . ($dir ? "up" : "dw") . ".gif\" alt=\"\" /> " : "") . "{$lang_guild['llogin']}</a></th>\r\n <th width=\"1%\"><a href=\"guild.php?action=view_guild&error=3&realm={$realmid}&id={$guild_id}&order_by=conline&start={$start}&dir={$dir}\">" . ($order_by == 'conline' ? "<img src=\"img/arr_" . ($dir ? "up" : "dw") . ".gif\" alt=\"\" /> " : "") . "{$lang_guild['online']}</a></th>"; if ($showcountryflag) { require_once 'libs/misc_lib.php'; $sqlm = new SQL(); $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']); $output .= "\r\n <th width=\"1%\">{$lang_global['country']}</th>"; } $output .= "\r\n </tr>"; $members = $sqlc->query("SELECT gm.guid as cguid, c.name as cname, c.`race` as crace ,c.`class` as cclass,\r\n c.`level` AS clevel,\r\n gm.rank AS mrank, (SELECT rname FROM guild_rank WHERE guildid ='{$guild_id}' AND rid = mrank) AS rname,\r\n gm.Pnote, gm.OFFnote, gender,\r\n c.`online` as conline, c.`account`, c.`logout_time` as clogout\r\n FROM guild_member as gm left outer join characters as c on c.guid = gm.guid\r\n WHERE gm.guildid = '{$guild_id}' ORDER BY {$order_by} {$order_dir} LIMIT {$start}, {$itemperpage}"); while ($member = $sqlr->fetch_row($members)) { $result = $sqlr->query("SELECT gmlevel FROM account WHERE id ='{$member['11']}'"); $owner_gmlvl = $sqlr->result($result, 0, 'gmlevel'); $output .= "\r\n <tr>"; // gm, gildleader or own account! are allowed to remove from guild $output .= $user_lvl >= $action_permission['delete'] || $amIguildleader || $member[11] == $user_id ? "\r\n <td>\r\n <img src=\"img/aff_cross.png\" alt=\"\" onclick=\"answerBox('{$lang_global['delete']}: <font color=white>{$member[1]}</font><br />{$lang_global['are_you_sure']}', 'guild.php?action=rem_char_from_guild&realm={$realmid}&id={$member['0']}&guld_id={$guild_id}');\" style=\"cursor:pointer;\" />\r\n </td>" : "\r\n <td>\r\n </td>"; $output .= $user_lvl < $owner_gmlvl ? "\r\n <td>" . htmlentities($member[1]) . "</td>" : "\r\n <td><a href=\"char.php?id={$member['0']}&realm={$realmid}\">" . htmlentities($member[1]) . "</a></td>"; $output .= "\r\n <td><img src='img/c_icons/{$member[2]}-{$member[9]}.gif' onmousemove='toolTip(\"" . char_get_race_name($member[2]) . "\",\"item_tooltip\")' onmouseout='toolTip()' alt=\"\" /></td>\r\n <td><img src='img/c_icons/{$member[3]}.gif' onmousemove='toolTip(\"" . char_get_class_name($member[3]) . "\",\"item_tooltip\")' onmouseout='toolTip()' alt=\"\" /></td>\r\n <td>" . char_get_level_color($member[4]) . "</td>\r\n <td>" . htmlentities($member[6]) . " (" . $member[5] . ")</td>\r\n <td>" . htmlentities($member[7]) . "</td>\r\n <td>" . htmlentities($member[8]) . "</td>\r\n <td>" . get_days_with_color($member[12]) . "</td>\r\n <td>" . ($member[10] ? "<img src=\"img/up.gif\" alt=\"\" />" : "-") . "</td>"; if ($showcountryflag) { $country = misc_get_country_by_account($member[11], $sqlr, $sqlm); $output .= "\r\n <td>" . ($country['code'] ? "<img src='img/flags/" . $country['code'] . ".png' onmousemove='toolTip(\"" . $country['country'] . "\",\"item_tooltip\")' onmouseout='toolTip()' alt=\"\" />" : "-") . "</td>"; } $output .= "\r\n </tr>"; } unset($member); $output .= "\r\n </table>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align=\"right\">" . generate_pagination("guild.php?action=view_guild&error=3&realm={$realmid}&id={$guild_id}&order_by={$order_by}&dir=" . !$dir, $guildmemberCount, $itemperpage, $start) . "</td>\r\n </tr>\r\n </table>\r\n\t\t</div>\r\n\t</div>\r\n <br />"; $output .= "\r\n <table class=\"hidden\">\r\n <tr>\r\n <td>"; if ($user_lvl >= $action_permission['delete'] || $amIguildleader) { makebutton($lang_guild['del_guild'], "guild.php?action=del_guild&realm={$realmid}&id={$guild_id}\" type=\"wrn", 130); $output .= "\r\n </td>\r\n <td>"; } makebutton($lang_guild['show_guilds'], "guild.php?realm={$realmid}\" type=\"def", 130); $output .= "\r\n </td>\r\n </tr>\r\n </table>\r\n\t</center>\r\n"; }
<?php require_once "header.php"; require_once "libs/char_lib.php"; valid_login($action_permission['read']); //global $lang_honor, $lang_global, $output, $characters_db, $realm_id, $itemperpage, $realm_db; $sql = new SQL(); $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']); $start = isset($_GET['start']) ? $sql->quote_smart($_GET['start']) : 0; $order_by = isset($_GET['order_by']) ? $sql->quote_smart($_GET['order_by']) : "honor"; $query = $sql->query("SELECT C.guid, C.name, C.race, C.class, C.totalHonorPoints AS honor , C.totalKills AS kills, C.level, C.arenaPoints AS arena, COALESCE(guild_member.guildid,0) as GNAME, C.gender FROM characters C LEFT JOIN guild_member ON C.guid = guild_member.guid WHERE race in (1,3,4,7,11) ORDER BY {$order_by} DESC LIMIT 25;"); $this_page = $sql->num_rows($query); $output .= "\r\n <script type=\"text/javascript\">\r\n answerbox.btn_ok='{$lang_global['yes_low']}';\r\n answerbox.btn_cancel='{$lang_global['no']}';\r\n </script>\r\n <center>\r\n <fieldset style=\"width: 776px;\">\r\n <legend><img src='img/alliance.gif' /></legend>\r\n <table class=\"lined\" style=\"width: 705px;\">\r\n <tr class=\"bold\">\r\n <td colspan=\"11\">{$lang_honor['allied']} {$lang_honor['browse_honor']}</td>\r\n </tr>\r\n <tr>\r\n <th width=\"30%\">{$lang_honor['guid']}</th>\r\n <th width=\"7%\">{$lang_honor['race']}</th>\r\n <th width=\"7%\">{$lang_honor['class']}</th>\r\n <th width=\"7%\">{$lang_honor['level']}</th>\r\n <th width=\"5%\"><a href=\"honor.php?order_by=honor\"" . ($order_by == 'honor' ? " class=DESC" : "") . ">{$lang_honor['honor']}</a></th>\r\n <th width=\"5%\"><a href=\"honor.php?order_by=honor\"" . ($order_by == 'honor' ? " class=DESC" : "") . ">{$lang_honor['honor points']}</a></th>\r\n <th width=\"5%\"><a href=\"honor.php?order_by=kills\"" . ($order_by == 'kills' ? " class=DESC" : "") . ">Kills</a></th>\r\n <th width=\"5%\"><a href=\"honor.php?order_by=arena\"" . ($order_by == 'arena' ? " class=DESC" : "") . ">AP</a></th>\r\n <th width=\"30%\">{$lang_honor['guild']}</th>\r\n </tr>"; while ($char = $sql->fetch_row($query)) { $guild_name = $sql->fetch_row($sql->query("SELECT `name` FROM `guild` WHERE `guildid`=" . $char[8] . ";")); $output .= "\r\n <tr>\r\n <td><a href=\"char.php?id={$char['0']}\">" . htmlentities($char[1]) . "</a></td>\r\n <td><img src='img/c_icons/{$char[2]}-{$char[9]}.gif' onmousemove='toolTip(\"" . char_get_race_name($char[2]) . "\",\"item_tooltip\")' onmouseout='toolTip()'></td>\r\n <td><img src='img/c_icons/{$char[3]}.gif' onmousemove='toolTip(\"" . char_get_class_name($char[3]) . "\",\"item_tooltip\")' onmouseout='toolTip()'></td>\r\n <td>" . char_get_level_color($char[6]) . "</td>\r\n <td><span onmouseover='toolTip(\"" . char_get_pvp_rank_name($char[4], char_get_side_id($char[2])) . "\",\"item_tooltip\")' onmouseout='toolTip()' style='color: white;'><img src='img/ranks/rank" . char_get_pvp_rank_id($char[4], char_get_side_id($char[2])) . ".gif'></span></td>\r\n <td>{$char['4']}</td>\r\n <td>{$char['5']}</td>\r\n <td>{$char['7']}</td>\r\n <td><a href=\"guild.php?action=view_guild&error=3&id={$char['8']}\">" . htmlentities($guild_name[0]) . "</a></td>\r\n </tr>"; } $output .= "\r\n </table>\r\n <br />\r\n </fieldset>"; $query = $sql->query("SELECT C.guid, C.name, C.race, C.class, C.todayHonorPoints AS honor , C.totalKills AS kills, C.level, C.arenaPoints AS arena, COALESCE(guild_member.guildid,0) as GNAME, C.gender FROM characters C LEFT JOIN guild_member ON C.guid = guild_member.guid WHERE race not in (1,3,4,7,11) ORDER BY {$order_by} DESC LIMIT 25;"); $this_page = $sql->num_rows($query); $output .= "\r\n <script type=\"text/javascript\">\r\n answerbox.btn_ok='{$lang_global['yes_low']}';\r\n answerbox.btn_cancel='{$lang_global['no']}';\r\n </script>\r\n <center>\r\n <fieldset style=\"width: 776px;\">\r\n <legend><img src='img/horde.gif' /></legend>\r\n <table class=\"lined\" style=\"width: 705px;\">\r\n <tr class=\"bold\">\r\n <td colspan=\"11\">{$lang_honor['horde']} {$lang_honor['browse_honor']}</td>\r\n </tr>\r\n <tr>\r\n <th width=\"30%\">{$lang_honor['guid']}</th>\r\n <th width=\"7%\">{$lang_honor['race']}</th>\r\n <th width=\"7%\">{$lang_honor['class']}</th>\r\n <th width=\"7%\">{$lang_honor['level']}</th>\r\n <th width=\"5%\"><a href=\"honor.php?order_by=honor\"" . ($order_by == 'honor' ? " class=DESC" : "") . ">{$lang_honor['honor']}</a></th>\r\n <th width=\"5%\"><a href=\"honor.php?order_by=honor\"" . ($order_by == 'honor' ? " class=DESC" : "") . ">{$lang_honor['honor points']}</a></th>\r\n <th width=\"5%\"><a href=\"honor.php?order_by=kills\"" . ($order_by == 'kills' ? " class=DESC" : "") . ">Kills</a></th>\r\n <th width=\"5%\"><a href=\"honor.php?order_by=arena\"" . ($order_by == 'arena' ? " class=DESC" : "") . ">AP</a></th>\r\n <th width=\"30%\">{$lang_honor['guild']}</th>\r\n </tr>"; while ($char = $sql->fetch_row($query)) { $guild_name = $sql->fetch_row($sql->query("SELECT `name` FROM `guild` WHERE `guildid`=" . $char[8] . ";")); $output .= "\r\n <tr>\r\n <td><a href=\"char.php?id={$char['0']}\">" . htmlentities($char[1]) . "</a></td>\r\n <td><img src='img/c_icons/{$char[2]}-{$char[9]}.gif' onmousemove='toolTip(\"" . char_get_race_name($char[2]) . "\",\"item_tooltip\")' onmouseout='toolTip()'></td>\r\n <td><img src='img/c_icons/{$char[3]}.gif' onmousemove='toolTip(\"" . char_get_class_name($char[3]) . "\",\"item_tooltip\")' onmouseout='toolTip()'></td>\r\n <td>" . char_get_level_color($char[6]) . "</td>\r\n <td><span onmouseover='toolTip(\"" . char_get_pvp_rank_name($char[4], char_get_side_id($char[2])) . "\",\"item_tooltip\")' onmouseout='toolTip()' style='color: white;'><img src='img/ranks/rank" . char_get_pvp_rank_id($char[4], char_get_side_id($char[2])) . ".gif'></span></td>\r\n <td>{$char['4']}</td>\r\n <td>{$char['5']}</td>\r\n <td>{$char['7']}</td>\r\n <td><a href=\"guild.php?action=view_guild&error=3&id={$char['8']}\">" . htmlentities($guild_name[0]) . "</a></td>\r\n </tr>"; } $output .= "\r\n </table>\r\n <br />\r\n </fieldset>"; require_once "footer.php";