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


PHP SQL::num_rows方法代码示例

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


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

示例1: search

function search()
{
    global $lang_global, $output, $itemperpage, $item_datasite, $mangos_db, $characters_db, $realm_id, $sql_search_limit;
    wowhead_tt();
    if (!isset($_GET['search_value']) || !isset($_GET['search_by'])) {
        redirect("mail_on.php?error=2");
    }
    $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']);
    $search_value = $sql->quote_smart($_GET['search_value']);
    $search_by = $sql->quote_smart($_GET['search_by']);
    $search_menu = array('sender', 'receiver');
    // if (!array_key_exists($search_by, $search_menu)) $search_by = 'sender';
    $start = isset($_GET['start']) ? $sql->quote_smart($_GET['start']) : 0;
    $order_by = isset($_GET['order_by']) ? $sql->quote_smart($_GET['order_by']) : "id";
    $dir = isset($_GET['dir']) ? $sql->quote_smart($_GET['dir']) : 1;
    $order_dir = $dir ? "ASC" : "DESC";
    $dir = $dir ? 0 : 1;
    $temp = $sql->query("SELECT guid FROM `characters` WHERE name like '%{$search_value}%'");
    $search_value = $sql->result($temp, 0, 'guid');
    $query_1 = $sql->query("SELECT count(*) FROM `mail`");
    $query = $sql->query("SELECT a.id, a.messageType, a.sender, a.receiver, a.subject, a.itemTextId, a.has_items, a.money, a.cod, a.checked, b.item_template\r\n            FROM mail a\r\n            INNER JOIN mail_items b ON a.id = b.mail_id\r\n            WHERE {$search_by} = {$search_value}\r\n            ORDER BY {$order_by} {$order_dir} LIMIT {$start}, {$itemperpage}");
    $this_page = $sql->num_rows($query);
    $all_record = $sql->result($query_1, 0);
    $total_found = $sql->num_rows($query);
    //==========================top page navigation starts here========================
    $output .= "<center><table class=\"top_hidden\">\r\n    <tr><td>\r\n            <table class=\"hidden\">\r\n                <tr><td>\r\n            <form action=\"mail_on.php\" method=\"get\" name=\"form\">\r\n            <input type=\"hidden\" name=\"action\" value=\"search\" />\r\n            <input type=\"hidden\" name=\"error\" value=\"4\" />\r\n            <input type=\"text\" size=\"45\" name=\"search_value\" />\r\n            <select name=\"search_by\">\r\n                <option value=\"sender\">Sender</option>\r\n                <option value=\"receiver\">Receiver</option>\r\n            </select></form></td><td>";
    makebutton($lang_global['search'], "javascript:do_submit()", 80);
    $output .= "</td></tr></table>\r\n            <td align=\"right\">";
    $output .= generate_pagination("mail_on.php?action=search&amp;order_by={$order_by}&amp;dir=" . !$dir, $all_record, $itemperpage, $start);
    $output .= "</td></tr></table>";
    //==========================top page navigation ENDS here ========================
    $output .= "<table class=\"lined\">\r\n  <tr>\r\n    <th width=\"5%\">ID</th>\r\n    <th width=\"5%\">Source</th>\r\n    <th width=\"10%\">Sender</th>\r\n    <th width=\"10%\">Receiver</th>\r\n    <th width=\"15%\">Subject</th>\r\n    <th width=\"5%\">Has Items</th>\r\n    <th width=\"25%\">Text</th>\r\n    <th width=\"15%\">Money</th>\r\n    <th width=\"5%\">Checked</th>\r\n  </tr>";
    while ($mail = $sql->fetch_array($query)) {
        $g = floor($mail[7] / 10000);
        $mail[7] -= $g * 10000;
        $s = floor($mail[7] / 100);
        $mail[7] -= $s * 100;
        $c = $mail[7];
        $money = "";
        if ($mail[7] > 0) {
            $money = $g . "<img src=\"./img/gold.gif\" /> " . $s . "<img src=\"./img/silver.gif\" /> " . $c . "<img src=\"./img/copper.gif\" /> ";
        }
        $output .= "<tr valign=top>\r\n                    <td>{$mail['0']}</td>\r\n                    <td>" . get_mail_source($mail[1]) . "</td>\r\n                    <td><a href=\"char.php?id={$mail['2']}\">" . get_char_name($mail[2]) . "</a></td>\r\n                    <td><a href=\"char.php?id={$mail['3']}\">" . get_char_name($mail[3]) . "</a></td>\r\n                    <td>{$mail['4']}</td>\r\n            ";
        $output .= "<td>";
        $output .= "\r\n                    <a style=\"padding:2px;\" href=\"{$item_datasite}{$mail[10]}\" target=\"_blank\">\r\n                      <img class=\"bag_icon\" src=\"" . get_item_icon($mail[10]) . "\" alt=\"\" />\r\n                  </a>";
        //maketooltip("<img src=\"./img/up.gif\" alt=\"\">", $item_datasite{$mail[10]}, $mail[10], "item_tooltip", "target=\"_blank\"");
        $output .= "</td>";
        $output .= "<td>" . get_mail_text($mail[5]) . "</td>\r\n                        <td>{$money}</td>\r\n        <td>" . get_check_state($mail[9]) . "</td>\r\n                   </tr>";
    }
    /*--------------------------------------------------*/
    $output .= "<tr><td colspan=\"6\" class=\"hidden\" align=\"right\">All Mails: {$all_record}</td></tr>\r\n </table></center>";
    $sql->close();
}
开发者ID:TheProjecter,项目名称:mmfm,代码行数:54,代码来源:mail_on.php

示例2: 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

示例3: dologin

function dologin(&$sqlr)
{
    global $mmfpm_db, $require_account_verify;
    if (empty($_POST['user']) || empty($_POST['pass'])) {
        redirect('login.php?error=2');
    }
    $user_name = $sqlr->quote_smart($_POST['user']);
    $user_pass = $sqlr->quote_smart($_POST['pass']);
    if (255 < strlen($user_name) || 255 < strlen($user_pass)) {
        redirect('login.php?error=1');
    }
    $result = $sqlr->query('SELECT id, username 
						FROM account 
						WHERE username = \'' . $user_name . '\' AND sha_pass_hash = \'' . $user_pass . '\'');
    $result2 = $sqlr->query('SELECT id, gmlevel FROM account_access');
    if ($require_account_verify) {
        $sqlm = new SQL();
        $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
        $result2 = $sqlm->query("SELECT * \n\t\t\t\t\t\t\t\t\tFROM mm_account_verification \n\t\t\t\t\t\t\t\t\tWHERE username = '{$user_name}'");
        if ($sqlm->num_rows($result2) >= 1) {
            $sqlm->close;
            redirect('login.php?error=7');
        }
    }
    unset($user_name);
    if (1 == $sqlr->num_rows($result)) {
        $id = $sqlr->result($result, 0, 'id');
        if ($sqlr->result($sqlr->query('SELECT count(*) FROM account_banned WHERE id = ' . $id . ' AND active = \'1\''), 0)) {
            redirect('login.php?error=3');
        } else {
            $_SESSION['user_id'] = $id;
            $_SESSION['uname'] = $sqlr->result($result, 0, 'username');
            if ($sqlr->result($result2, 0, 'gmlevel') == null) {
                $_SESSION['user_lvl'] = 0;
            } else {
                $_SESSION['user_lvl'] = $sqlr->result($result2, 0, 'gmlevel');
            }
            $_SESSION['realm_id'] = $sqlr->quote_smart($_POST['realm']);
            $_SESSION['client_ip'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : getenv('REMOTE_ADDR');
            $_SESSION['logged_in'] = true;
            if (isset($_POST['remember']) && $_POST['remember'] != '') {
                setcookie('uname', $_SESSION['uname'], time() + 60 * 60 * 24 * 7);
                setcookie('realm_id', $_SESSION['realm_id'], time() + 60 * 60 * 24 * 7);
                setcookie('p_hash', $user_pass, time() + 60 * 60 * 24 * 7);
            }
            redirect('index.php');
        }
    } else {
        redirect('login.php?error=1');
    }
}
开发者ID:BACKUPLIB,项目名称:Infinity_MaNGOS,代码行数:51,代码来源:login.php

示例4: get_item_name

function get_item_name($item_id, &$sqlw = 0)
{
    global $world_db, $realm_id;
    if ($item_id) {
        if (empty($sqlw)) {
            $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 = $sqlw->query('SELECT IFNULL(' . ($deplang != 0 ? 'name_loc' . $deplang . '' : 'NULL') . ', name) as name FROM item_template LEFT JOIN locales_item ON item_template.entry = locales_item.entry WHERE item_template.entry = ' . $item_id . '');
        $item_name = 1 == $sqlw->num_rows($result) ? $sqlw->result($result, 0, 'name') : 'ItemID: ' . $item_id . ' Not Found';
        return $item_name;
    } else {
        return NULL;
    }
}
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:16,代码来源:item_lib.php

示例5: isset

<?php

require_once "header.php";
//##############################################################################################
// MAIN
//##############################################################################################
$username = isset($_GET['username']) ? $_GET['username'] : NULL;
$authkey = isset($_GET['authkey']) ? $_GET['authkey'] : NULL;
$output .= "<div class=\"top\">";
$sql = new SQL();
$sql->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
$query = $sql->query("SELECT * FROM mm_account WHERE username = '{$username}' AND authkey = '{$authkey}'");
$lang_verify = lang_verify();
if ($sql->num_rows($query) < 1) {
    $output .= "<h1><font class=\"error\">{$lang_verify['verify_failed']}</font></h1>";
} else {
    $output .= "<h1><font class=\"error\">{$lang_verify['verify_success']}</font></h1>";
    $sql2 = new SQL();
    $sql2->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    $data = mysql_fetch_array($query);
    list($id, $username, $pass, $mail, $joindate, $last_ip, $failed_logins, $locked, $last_login, $expansion) = $data;
    $sql2->query("INSERT INTO account (id,username,sha_pass_hash,email, joindate,last_ip,failed_logins,locked,last_login,expansion) VALUES ('',UPPER('{$username}'),'{$pass}','{$mail}',now(),'{$last_ip}','0','{$locked}',NULL,'{$expansion}')");
    $result = $sql2->query("SELECT * FROM account WHERE username='{$username}'");
    $data = mysql_fetch_assoc($result);
    $sql2->query("INSERT INTO account_access (`id`,`gmlevel`) VALUES ('{$data['id']}','0')");
}
$sql->query("DELETE FROM mm_account WHERE username='{$username}'");
$output .= "</div>";
$output .= "<center><br /><table class=\"hidden\"><tr><td>" . makebutton($lang_global['home'], 'index.php', 130) . "</td></tr></table></center>";
require_once "footer.php";
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:30,代码来源:verify.php

示例6: run_cleanup

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

示例7: SQL

 $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']);
 // we have a different menu for guest account
 if ($allow_anony && empty($_SESSION['logged_in'])) {
     $lang_login = lang_login();
     $output .= '
                         <li><a href="#">' . $lang_header['account'] . '</a></li>
                         <li><a href="register.php">' . $lang_login['not_registrated'] . '</a></li>
                         <li><a href="login.php">' . $lang_login['login'] . '</a></li>';
     unset($lang_login);
 } else {
     $result = $sqlc->query('SELECT guid, name, race, class, level, gender
                         FROM characters 
                         WHERE account = ' . $user_id . '');
     // this puts links to user characters of active realm in "My Account" menu
     if ($sqlc->num_rows($result)) {
         $output .= '
                         <li><a href="#">' . $lang_header['my_characters'] . '</a></li>';
         while ($char = $sqlc->fetch_assoc($result)) {
             $output .= '
                         <li>
                             <a href="char.php?id=' . $char['guid'] . '">
                             <img src="img/c_icons/' . $char['race'] . '-' . $char['gender'] . '.gif" alt="" /><img src="img/c_icons/' . $char['class'] . '.gif" alt="" />' . $char['name'] . '
                             </a>
                         </li>';
         }
         unset($char);
     }
     $output .= '
                         <li><a href="#">' . $lang_header['account'] . '</a></li>
                         <li><a href="edit.php">' . $lang_header['edit_my_acc'] . '</a></li>
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:31,代码来源:header.php

示例8: sql_table_dump


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

示例9: do_search

function do_search()
{
    global $lang_global, $lang_creature, $output, $world_db, $realm_id, $creature_datasite, $sql_search_limit, $creature_type, $creature_npcflag, $language;
    wowhead_tt();
    $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']);
    $where = '';
    // language // if $_POST['language'] > 0 also search locales_XXX
    // prepare sql_query
    if ($_POST['language'] != '0') {
        $loc_language = is_numeric($_POST['language']) ? $sql->quote_smart($_POST['language']) : redirect("creature.php?error=8");
    } else {
        $loc_language = '0';
    }
    // check input and prepare sql query
    if ($_POST['npcflag'] != '') {
        $npcflag = is_numeric($_POST['npcflag']) ? $sql->quote_smart($_POST['npcflag']) : redirect("creature.php?error=8");
        $where .= "ct.npcflag = '{$npcflag}' ";
    } else {
        if ($_POST['type'] != '') {
            $type = is_numeric($_POST['type']) ? $sql->quote_smart($_POST['type']) : redirect("creature.php?error=8");
            $where .= "ct.type = '{$type}' ";
        } else {
            if ($_POST['rank'] != '') {
                $rank = is_numeric($_POST['rank']) ? $sql->quote_smart($_POST['rank']) : redirect("creature.php?error=8");
                $where .= "ct.rank = '{$rank}' ";
            } else {
                if ($_POST['family'] != '') {
                    $family = is_numeric($_POST['family']) ? $sql->quote_smart($_POST['family']) : redirect("creature.php?error=8");
                    $where .= "ct.family = '{$family}' ";
                } else {
                    if ($_POST['entry'] != '') {
                        $entry = is_numeric($_POST['entry']) ? $sql->quote_smart($_POST['entry']) : redirect("creature.php?error=8");
                        $where .= "ct.entry = '{$entry}' ";
                    } else {
                        if ($_POST['name'] != '') {
                            $name = preg_match('/^[\\t\\v\\b\\f\\a\\n\\r\\\\"\\? <>[](){}_=+-|!@#$%^&*~`.,\\0]{1,30}$/', $_POST['name']) ? "test" : $sql->quote_smart($_POST['name']);
                            if ($loc_language) {
                                $where .= "lc.name_loc{$loc_language} LIKE '%{$name}%' ";
                            } else {
                                $where .= "ct.`name`LIKE '%{$name}%' ";
                            }
                        } else {
                            if ($_POST['level'] != '') {
                                $level = is_numeric($_POST['level']) ? $sql->quote_smart($_POST['level']) : redirect("creature.php?error=8");
                                $where .= "ct.minlevel <= {$level} AND ct.maxlevel >= {$level} ";
                            } else {
                                if ($_POST['faction_A'] != '') {
                                    $faction_A = is_numeric($_POST['faction_A']) ? $sql->quote_smart($_POST['faction_A']) : redirect("creature.php?error=8");
                                    $where .= "ct.faction_A = '{$faction_A}' ";
                                } else {
                                    if ($_POST['faction_H'] != '') {
                                        $faction_H = is_numeric($_POST['faction_H']) ? $sql->quote_smart($_POST['faction_H']) : redirect("creature.php?error=8");
                                        $where .= "ct.faction_H = '{$faction_H}' ";
                                    } else {
                                        if ($_POST['spell'] != '') {
                                            $spell = is_numeric($_POST['spell']) ? $sql->quote_smart($_POST['spell']) : redirect("creature.php?error=8");
                                            $where .= "(ct.spell1 = '{$spell}' OR ct.spell2 = '{$spell}' OR ct.spell3 = '{$spell}' OR ct.spell4 = '{$spell}') ";
                                        } else {
                                            if ($_POST['lootid'] != '') {
                                                $lootid = is_numeric($_POST['lootid']) ? $sql->quote_smart($_POST['lootid']) : redirect("creature.php?error=8");
                                                $where .= "ct.lootid = '{$lootid}' ";
                                            } else {
                                                if ($_POST['ScriptName'] != '') {
                                                    $ScriptName = preg_match("/^[_[:alpha:]]{1,32}\$/", $_POST['ScriptName']) ? $sql->quote_smart($_POST['ScriptName']) : "mob_generic";
                                                    $where .= "ct.ScriptName LIKE '%{$ScriptName}%' ";
                                                } else {
                                                    if ($_POST['heroic'] != '') {
                                                        $heroic = is_numeric($_POST['heroic']) ? $sql->quote_smart($_POST['heroic']) : redirect("creature.php?error=8");
                                                        $where .= "ct.heroic_entry = '{$heroic}'";
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // additional search query
    if ($_POST['custom_search'] != '') {
        $custom_search = preg_match('/^[\\t\\v\\b\\f\\a\\n\\r\\\\"\\?[](){}=+-|!@#$%^&*~`.,\\0]{1,30}$/', $_POST['$custom_search']) ? 0 : $sql->quote_smart($_POST['$custom_search']);
        $where .= $where == '' ? "ct.{$custom_search}" : "AND ct.{$custom_search}";
    }
    /* no search value, go home! */
    if ($where == '') {
        redirect("creature.php?error=1");
    }
    if ($loc_language) {
        $db_query = "SELECT ct.entry, ct.name, ct.maxlevel, ct.rank, ct.npcflag, lc.name_loc{$loc_language} FROM creature_template ct LEFT OUTER JOIN locales_creature lc on lc.entry = ct.entry WHERE {$where} ORDER BY ct.entry LIMIT 100";
    } else {
        $db_query = "SELECT ct.entry, ct.name, ct.maxlevel, ct.rank, ct.npcflag FROM creature_template ct WHERE {$where} ORDER BY ct.entry LIMIT 100";
    }
    $result = $sql->query($db_query);
    $total_found = $sql->num_rows($result);
    $output .= "\r\n                <center>\r\n                    <table class=\"top_hidden\"></td>\r\n                        <tr>\r\n                            <td>";
//.........这里部分代码省略.........
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:101,代码来源:creature.php

示例10: dobackup


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

示例11: detectcore

function detectcore()
{
    global $logon_db;
    $sqll = new SQL();
    $sqll->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]);
    // are we ArcEmu?
    $query = "SHOW TABLES FROM `" . $logon_db["name"] . "` LIKE 'accounts'";
    $result = $sqll->query($query);
    if ($sqll->num_rows($result) == 1) {
        return 1;
    }
    // we're ArcEmu
    // no? ...then are we Trinity?
    $query = "SHOW TABLES FROM `" . $logon_db["name"] . "` LIKE 'account_access'";
    $result = $sqll->query($query);
    if ($sqll->num_rows($result) == 1) {
        return 3;
    } else {
        return 2;
    }
    // we're MaNGOS
}
开发者ID:xhaher,项目名称:CoreManager,代码行数:22,代码来源:admin_lib.php

示例12: forum_index

function forum_index(&$sqlr, &$sqlm)
{
    global $enablesidecheck, $forum_skeleton, $forum_lang, $user_lvl, $output, $realm_db, $mmfpm_db;
    if ($enablesidecheck) {
        $side = get_side();
    }
    $sqlm = new SQL();
    $sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
    $result = $sqlm->query('
		SELECT authorname, id, name, time, forum
		FROM mm_forum_posts
		WHERE id IN 
			(SELECT MAX(id)
			FROM mm_forum_posts
			GROUP BY forum)
		ORDER BY forum;');
    $lasts = array();
    if ($sqlm->num_rows($result) > 0) {
        while ($row = $sqlm->fetch_assoc($result)) {
            $lasts[$row['forum']] = $row;
        }
    }
    $output .= '
<div class="top">
	<h1>' . $forum_lang['forums'] . '</h1>
</div>
<center>
<fieldset>
	<legend><a href="forum.php">' . $forum_lang['forum_index'] . '</a></legend>
	<table class="lined">';
    $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)) {
        if ($category['level_read'] > $user_lvl) {
            continue;
        }
        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;
                    }
                }
            }
        }
        $output .= '
		<tr>
			<th class="head" align="left">' . $category['name'] . '<br />' . $category['description'] . '</th>
			<th class="head">' . $forum_lang['topics'] . '</th>
			<th class="head">' . $forum_lang['replies'] . '</th>
			<th class="head" align="right">' . $forum_lang['last_post'] . '</th>
		</tr>';
        $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['level_read'] > $user_lvl) {
                continue;
            }
            if ($user_lvl == 0 && $enablesidecheck) {
                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;
                        }
                    }
                }
            }
            $totaltopics = $sqlm->query('
				SELECT id
				FROM mm_forum_posts
				WHERE forum = ' . $forum['forum'] . ' AND id = topic');
            $numtopics = $sqlm->num_rows($totaltopics);
            $totalreplies = $sqlm->query('
				SELECT id
				FROM mm_forum_posts
				WHERE forum = ' . $forum['forum'] . '');
            $numreplies = $sqlm->num_rows($totalreplies);
            $output .= '
		<tr>
			<td align="left"><a href="forum.php?action=view_forum&amp;id=' . $forum['forum'] . '">' . $forum['name'] . '</a><br />' . $forum['description'] . '</td>
			<td>' . $numtopics . '</td>
			<td>' . $numreplies . '</td>';
            if (isset($lasts[$forum['forum']])) {
                $lasts[$forum['forum']]['name'] = htmlspecialchars($lasts[$forum['forum']]['name']);
                $output .= '
			<td align="right">
				<a href="forum.php?action=view_topic&amp;postid=' . $lasts[$forum['forum']]['id'] . '">' . $lasts[$forum['forum']]['name'] . '</a>
//.........这里部分代码省略.........
开发者ID:BACKUPLIB,项目名称:minimanager-1,代码行数:101,代码来源:forum_index.php

示例13: do_contests

function do_contests()
{
    global $sql, $core, $characters_db;
    $contests_query = "SELECT *, UNIX_TIMESTAMP(date_issued) AS issue_stamp FROM point_system_achievement_contests WHERE enabled='1' AND winner_guid='0' AND expiration>NOW()";
    $contests_result = $sql["mgr"]->query($contests_query);
    // luckily, the Achievement tables for ArcEmu and Trinity are based on MaNGOS
    // so we need fewer queries for this
    while ($contest = $sql["mgr"]->fetch_assoc($contests_result)) {
        // get the characters database for this contest
        $sqlc = new SQL();
        $sqlc->connect($characters_db[$contest["realm"]]["addr"], $characters_db[$contest["realm"]]["user"], $characters_db[$contest["realm"]]["pass"], $characters_db[$contest["realm"]]["name"], $characters_db[$contest["realm"]]["encoding"]);
        if ($contest["after_only"]) {
            $achieve_query = "SELECT * FROM character_achievement WHERE achievement='" . $contest["achievement"] . "' AND `date`>='" . $contest["issue_stamp"] . "' ORDER BY `date` ASC";
        } else {
            $achieve_query = "SELECT * FROM character_achievement WHERE achievement='" . $contest["achievement"] . "' ORDER BY `date` ASC";
        }
        $achieve_result = $sqlc->query($achieve_query);
        // set up a variable for the winner so we only have to do the reward code once
        $winner = 0;
        // now, find the winner
        if ($sqlc->num_rows($achieve_result) > 1) {
            // this triggers if multiple people unlock the achievement before we check
            // for winner.  We have to find the first
            // start by dumping all the unlocks, but skip any that ARE NOT duplicates
            $unlockers = array();
            while ($row = $sqlc->fetch_assoc($achieve_result)) {
                if (is_array($unlockers[0])) {
                    if ($row["date"] == $unlockers[0]["date"]) {
                        $unlockers[] = $row;
                    }
                } else {
                    $unlockers[] = $row;
                }
                // we need the first one
            }
            // see how many unlockers we have left
            if (count($unlockers) > 1) {
                // we have multiples, 'randomly' pick a winner
                $winners_row = rand(1, count($unlockers)) - 1;
                $winner = $unlockers[$winners_row]["guid"];
            } else {
                // otherwise, we had only one 'first' unlocker
                $winner = $unlockers[0]["guid"];
            }
        } elseif ($sqlc->num_rows($achieve_result) == 1) {
            // single player unlocked the achievement
            $unlocker = $sql["char"]->fetch_assoc($achieve_result);
            $winner = $unlocker["guid"];
        }
        // otherwise, no winner
        // reward
        if ($winner != 0) {
            // first, set the contest to reflect who won
            $query = "UPDATE point_system_achievement_contests SET winner_guid='" . $winner . "' WHERE entry='" . $contest["entry"] . "'";
            $sql["mgr"]->query($query);
            // winner is character guid.  Prize Bags and Coupons are account level.
            // we need the winner's account
            if ($core == 1) {
                $winner_acct_query = "SELECT acct AS account, name FROM characters WHERE guid='" . $winner . "'";
            } else {
                $winner_acct_query = "SELECT account, name FROM characters WHERE guid='" . $winner . "'";
            }
            $winner_acct_result = $sqlc->query($winner_acct_query);
            $winner_acct_result = $sqlc->fetch_assoc($winner_acct_result);
            $winner_acct = $winner_acct_result["account"];
            $winner_name = $winner_acct_result["name"];
            if ($contest["prize_bag"] > 0) {
                // update the prize bag to reflect its new owner
                $reward_query = "UPDATE point_system_prize_bags SET owner='" . $winner_acct . "'";
            } else {
                // update the coupon to reflect its new owner
                $reward_query = "UPDATE point_system_coupons SET target='" . $winner_acct . "'";
            }
            // update the prize bag / coupon record
            $sql["mgr"]->query($reward_query);
            // get the achievement's name
            $ach_query = "SELECT * FROM achievement WHERE id='" . $contest["achievement"] . "'";
            $ach_result = $sql["dbc"]->query($ach_query);
            $ach_result = $sql["dbc"]->fetch_assoc($ach_result);
            // create Server Message
            $msg = $contest["announce_msg"];
            $msg = str_replace("%1", $winner_name, $msg);
            $msg = str_replace("%2", $ach_result["name"], $msg);
            // insert message
            if ($contest["announce"] == 0) {
                $announce_query = "INSERT INTO motd (Message, Created, Enabled) VALUES ('" . $msg . "', NOW(), 1)";
            } else {
                $announce_query = "INSERT INTO motd (Message, Created, Target, Enabled) VALUES ('" . $msg . "', NOW(), '" . $winner_acct . "', 1)";
            }
            $sql["mgr"]->query($announce_query);
        }
    }
}
开发者ID:GlassFace,项目名称:CoreManager2,代码行数:93,代码来源:index.php

示例14: saveforum

function saveforum()
{
    global $corem_db;
    $sqlm = new SQL();
    $sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]);
    $forum_item = $sqlm->quote_smart($_GET["forum_item"]);
    $forum = $sqlm->quote_smart($_GET["category"]);
    $name = $sqlm->quote_smart($_GET["name"]);
    $desc = $sqlm->quote_smart($_GET["desc"]);
    $sideaccess = $sqlm->quote_smart($_GET["sideaccess"]);
    $min_security_level_read = $sqlm->quote_smart($_GET["min_security_level_read"]);
    $min_security_level_post = $sqlm->quote_smart($_GET["min_security_level_post"]);
    $min_security_level_create_topic = $sqlm->quote_smart($_GET["min_security_level_create_topic"]);
    $result = $sqlm->query("SELECT * FROM config_forums WHERE `Index`='" . $forum_item . "'");
    if ($sqlm->num_rows($result)) {
        $result = $sqlm->query("UPDATE config_forums SET Category='" . $forum . "', Name='" . $name . "', `Desc`='" . $desc . "', Side_Access='" . $sideaccess . "', Min_Security_Level_Read='" . $min_security_level_read . "', Min_Security_Level_Post='" . $min_security_level_post . "', Min_Security_Level_Create_Topic='" . $min_security_level_create_topic . "' WHERE `Index`='" . $forum_item . "'");
    } else {
        $result = $sqlm->query("INSERT INTO config_forums (Category, Name, Desc, Side_Access, Min_Security_Level_Read, Min_Security_Level_Post, Min_Security_Level_Create_Topic) VALUES ('" . $forum . "', '" . $name . "', '" . $desc . "', '" . $sideaccess . "', '" . $min_security_level_read . "', '" . $min_security_level_post . "', '" . $min_security_level_create_topic . "')");
    }
    redirect("admin.php?section=forum");
}
开发者ID:xhaher,项目名称:CoreManager,代码行数:21,代码来源:admin_forum_lib.php

示例15: SQL

<?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&amp;error=3&amp;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&amp;error=3&amp;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";
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:27,代码来源:honor.php


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