当前位置: 首页>>代码示例>>PHP>>正文


PHP SQL::fetch_row方法代码示例

本文整理汇总了PHP中SQL::fetch_row方法的典型用法代码示例。如果您正苦于以下问题:PHP SQL::fetch_row方法的具体用法?PHP SQL::fetch_row怎么用?PHP SQL::fetch_row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQL的用法示例。


在下文中一共展示了SQL::fetch_row方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_additional_data

/**
 * 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;
}
开发者ID:BACKUPLIB,项目名称:Infinity_MaNGOS,代码行数:46,代码来源:creature_lib.php

示例2: show_list

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&amp;order_by={$order_by}&amp;ban_type={$ban_type}&amp;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&amp;ban_type={$ban_type}&amp;{$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}&amp;ban_type={$ban_type}&amp;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&amp;ban_type={$ban_type}&amp;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&amp;ban_type={$ban_type}&amp;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&amp;ban_type={$ban_type}&amp;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&amp;ban_type={$ban_type}&amp;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&amp;error=11&amp;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>";
}
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:58,代码来源:banned.php

示例3: get_itemset_name

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];
}
开发者ID:BACKUPLIB,项目名称:minimanager-1,代码行数:14,代码来源:item_lib.php

示例4: rtrim

             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) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:backup.php

示例5: doupdate_referral

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;
            }
        }
    }
}
开发者ID:scamp,项目名称:minimanager,代码行数:27,代码来源:user.php

示例6: edit


//.........这里部分代码省略.........
            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&amp;entry={$mob['0']}&amp;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&amp;entry={$mob['0']}&amp;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");
开发者ID:BACKUPLIB,项目名称:Infinity_MaNGOS,代码行数:67,代码来源:item.php

示例7: dobackup


//.........这里部分代码省略.........
    } 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']));
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:67,代码来源:backup.php

示例8: edit_ticket

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&amp;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']);
    }
}
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:28,代码来源:ticket.php

示例9: get_item_tooltip

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;
//.........这里部分代码省略.........
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:101,代码来源:item_lib.php

示例10: forum_move_topic

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&amp;id={$fid}\">{$forum["name"]}</a> -> <a href=\"forum.php?action=view_topic&amp;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
}
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:50,代码来源:forum.php

示例11: do_edit_char

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_name}'");
            $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']}',";
//.........这里部分代码省略.........
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:101,代码来源:char_edit.php

示例12: get_side

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();
}
开发者ID:scamp,项目名称:minimanager,代码行数:34,代码来源:forum_lib.php

示例13: view_team

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&amp;id={$member['0']}&amp;arenateam_id={$arenateam_id}');\" style=\"cursor:pointer;\" /></td>";
        } else {
            $output .= "\r\n                        <td>&nbsp;</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&amp;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>";
}
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:82,代码来源:arenateam.php

示例14: forum_view_topic

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;
//.........这里部分代码省略.........
开发者ID:BACKUPLIB,项目名称:minimanager-1,代码行数:101,代码来源:forum_topic_view.php

示例15: table_stat

 /**
  * 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;
 }
开发者ID:rair,项目名称:yacs,代码行数:24,代码来源:sql.php


注:本文中的SQL::fetch_row方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。