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


PHP SQL::fetch_array方法代码示例

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


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

示例1: html_header

function html_header()
{
    if (!defined('SITE_ROOT')) {
        define('SITE_ROOT', './');
    }
    require SITE_ROOT . 'portal_config.php';
    require_once SITE_ROOT . 'include/database.class.php';
    $currentUserID = $_SESSION['current_userID'];
    $db = new SQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
    $db->query("SELECT * FROM forum_users WHERE id='{$currentUserID}'");
    if ($row = $db->fetch_array()) {
        $username = $row['username'];
        $realname = $row['realname'];
    }
    $db->close();
    if ($realname !== null) {
        $displayname = $realname;
    } else {
        $displayname = $username;
    }
    echo '
<div id="wrap">
<div class="navbar navbar-top"><div class="navbar-inner"><div class="container">
<a class="brand" href="#index.php"><div class="logo-ip"></div></a>
<div class="btn-group pull-left">
<a href="../forum" class="btn btn-inverse"><i class="icon-rss"></i> Forum Ishare</a>
</div>

<div class="btn-group">
  <button class="btn dropdown-toggle" data-toggle="dropdown"><i class="icon-list muted"></i> KampusLinks <span class="caret"></span></button>
  <ul class="dropdown-menu">
    <li><a href="http://mpp.eng.usm.my/">MPPUSMKKj Official Blog</a></li>
    <li><a href="http://hepp.eng.usm.my/">BHEPP USMKKj</a></li>
    <li><a href="http://infodesk.eng.usm.my/">Infodesk PPKT USMKKj</a></li>
    <li><a href="http://www.eng.usm.my/php/blockedIP/">Blocked Port List</a></li>
    <li><a href="http://elearning.usm.my/">e-Learning Portal</a></li>
    <li><a href="http://campusonline.usm.my/">CampusOnline Portal</a></li>
    <li><a href="http://www.tcom.usm.my/">Sistem Direktori Telefon USM</a></li>
    <li><a href="http://www.facebook.com/ppkt.eng.usm">Facebook PPKT USMKKj</a></li>
    <li class="divider"></li>
    <li><a href="http://hik3.net/refcode"><i class="icon-bookmark"></i> RefCode (Snippets)</a></li>
  </ul>
</div>
            
<div class="btn-group pull-right">
<a href="index.php" class="btn btn-primary"><i class="icon-home icon-white"></i> Home</a>
<a href="profile.php?id=' . $currentUserID . '" class="btn btn-inverse"><i class="icon-user"></i> ' . $displayname . '</a>
<button class="btn btn-danger dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
  <ul class="dropdown-menu">
    <li><a href="edit_profile.php"><i class="icon-edit muted"></i> Edit Profile</a></li>
    <li><a href="edit_sharerlink.php"><i class="icon-hdd muted"></i> Edit Sharerlink</a></li>
    <li class="divider"></li>
    <li><a href="../forum/login.php?action=out&id=' . $currentUserID . '"><i class="icon-off muted"></i> Logout</a></li>
  </ul>
</div>
            
</div></div></div>
';
}
开发者ID:heiswayi,项目名称:ishareportal,代码行数:59,代码来源:html.php

示例2: execute_reader

 /**
  * execute query and return all data in a reader
  *
  * @return SQLDataReader
  */
 public function execute_reader()
 {
     $this->parse_query();
     if (empty($this->queryParsed)) {
         return new SQLDataReader();
     }
     $close = $this->conn->status() == 'closed';
     $this->conn->open();
     $res = $this->conn->query($this->queryParsed);
     $data = array();
     while ($row = $this->conn->fetch_array($res)) {
         $data[] = $row;
     }
     // SQLite causes 'unknown error' after successful fetch of all data.
     // Don't have a clue why...
     $ret = empty($this->conn->error()) || $this->conn->error() == 'unknown error';
     if ($close) {
         $this->conn->close();
     }
     return $ret ? new SQLDataReader($data) : new SQLDataReader();
 }
开发者ID:BlackyPanther,项目名称:SQL-Class,代码行数:26,代码来源:SQLCommand.class.php

示例3: define

<?php

if (!defined('SITE_ROOT')) {
    define('SITE_ROOT', '../');
}
require_once SITE_ROOT . 'portal_config.php';
require_once SITE_ROOT . 'include/database.class.php';
require_once SITE_ROOT . 'include/functions.php';
if (isset($_GET['slid'])) {
    $dbsls = new SQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
    $sharerLinkID = $dbsls->prot(htmlspecialchars($_GET['slid']));
    $dbsls->query("SELECT * FROM ip_sharerlinks WHERE id='{$sharerLinkID}'");
    if ($sls = $dbsls->fetch_array()) {
        $url = $sls['sharerurl'];
        $removehttp = str_replace('http://', '', $url);
        $removeslash = rtrim($removehttp, '/');
        if (strpos($removeslash, ':') !== false) {
            list($ip, $port) = explode(":", $removeslash);
        } else {
            $ip = $removeslash;
            $port = 80;
        }
    }
    if (fsockopen($ip, $port, $errno, $errstr, 5) !== false) {
        echo '1';
        $dbsls->query("UPDATE ip_sharerlinks SET status='1' WHERE id='{$sharerLinkID}'");
    } else {
        echo '0';
        $dbsls->query("UPDATE ip_sharerlinks SET status='0' WHERE id='{$sharerLinkID}'");
    }
    $dbsls->close();
开发者ID:heiswayi,项目名称:ishareportal,代码行数:31,代码来源:sharerlink_check.php

示例4: sql_table_dump

function sql_table_dump($dbhost, $dbuser, $dbpass, $database, $table, $construct, $file)
{
    global $lang_global;
    $sql_0 = new SQL();
    $sql_0->connect($dbhost, $dbuser, $dbpass, $database, true);
    $fp = fopen($file, 'r+') or die(error($lang_backup['file_write_err']));
    fseek($fp, 0, SEEK_END);
    fwrite($fp, "--\n") or die(error($lang_backup['file_write_err']));
    fwrite($fp, "-- Dump of {$database}.{$table}\n") or die(error($lang_backup['file_write_err']));
    fwrite($fp, "-- Dump DATE : " . date("m.d.y H:i:s") . "\n--\n\n") or die(error($lang_backup['file_write_err']));
    if ($construct) {
        fwrite($fp, "-- Table structure for table {$database}.{$table}\n") or die(error($lang_backup['file_write_err']));
        if (!($fi = $sql_0->query("DESC " . $table))) {
            error($sql_0->error());
        }
        fwrite($fp, "DROP TABLE IF EXISTS {$table};\n") or die(error($lang_backup['file_write_err']));
        $pri = "";
        $creatinfo = array();
        while ($tmp = $sql_0->fetch_row($fi)) {
            $con = "`" . $tmp[0] . "` ";
            $con .= trim($tmp[1] . " ");
            if ($tmp[2] != "YES") {
                $con .= " NOT NULL";
            }
            if ($tmp[4]) {
                if ($tmp[4] == 'CURRENT_TIMESTAMP' || $tmp[4] == 'timestamp') {
                    $con .= " default " . $tmp[4];
                } else {
                    $con .= " default '" . $tmp[4] . "'";
                }
            } else {
                if ($tmp[4] === '' && $tmp[3] != "PRI") {
                    $con .= " default ''";
                } else {
                    if (strlen($tmp[4]) != 0) {
                        $con .= " default '0'";
                    }
                }
            }
            if (strtolower($tmp[5]) == "auto_increment") {
                $con .= " auto_increment";
            }
            $creatinfo[] = $con;
        }
        $fieldscon = implode(",\n\t", $creatinfo);
        fwrite($fp, "CREATE TABLE " . $table . " (") or die(error($lang_backup['file_write_err']));
        fwrite($fp, "\n\t{$fieldscon}") or die(error($lang_backup['file_write_err']));
        $qkey = $sql_0->query("SHOW INDEX FROM " . $table);
        if ($rkey = $sql_0->fetch_array($qkey)) {
            $knames = array();
            $keys = array();
            do {
                $keys[$rkey["Key_name"]]["nonunique"] = $rkey["Non_unique"];
                if (!$rkey["Sub_part"]) {
                    $keys[$rkey["Key_name"]]["order"][$rkey["Seq_in_index"] - 1] = $rkey["Column_name"];
                } else {
                    $keys[$rkey["Key_name"]]["order"][$rkey["Seq_in_index"] - 1] = $rkey["Column_name"] . "(" . $rkey["Sub_part"] . ")";
                }
                $flag = false;
                for ($l = 0; $l < sizeof($knames); $l++) {
                    if ($knames[$l] == $rkey["Key_name"]) {
                        $flag = true;
                    }
                }
                if (!$flag) {
                    $knames[] = $rkey["Key_name"];
                }
            } while ($rkey = $sql_0->fetch_array($qkey));
            for ($kl = 0; $kl < sizeof($knames); $kl++) {
                if ($knames[$kl] == "PRIMARY") {
                    fwrite($fp, ",\n\tPRIMARY KEY") or die(error($lang_backup['file_write_err']));
                } else {
                    if ($keys[$knames[$kl]]["nonunique"] == "0") {
                        fwrite($fp, ",\n\tUNIQUE `{$knames[$kl]}`") or die(error($lang_backup['file_write_err']));
                    } else {
                        fwrite($fp, ",\n\tKEY `{$knames[$kl]}`") or die(error($lang_backup['file_write_err']));
                    }
                }
                $a = @implode("`,`", $keys[$knames[$kl]]["order"]);
                fwrite($fp, " (`{$a}`)") or die(error($lang_backup['file_write_err']));
            }
        }
        $query_res = $sql_0->query("SHOW TABLE STATUS FROM {$database} WHERE Name = '{$table}'");
        $tmp = $sql_0->fetch_row($query_res);
        $query_charset = $sql_0->query("SHOW VARIABLES WHERE Variable_name = 'character_set_database'");
        $info = " ";
        if ($tmp[1]) {
            $info .= "ENGINE={$tmp['1']} ";
        }
        $info .= "DEFAULT CHARSET=" . $sql_0->result($query_charset, 0, 'Value') . " ";
        if ($tmp[16]) {
            $info .= strtoupper($tmp[16]) . " ";
        }
        if ($tmp[10]) {
            $info .= "AUTO_INCREMENT={$tmp['10']} ";
        }
        if ($tmp[17]) {
            $info .= "COMMENT='{$tmp['17']}'";
        }
        fwrite($fp, "\n){$info};\n\n") or die(error($lang_backup['file_write_err']));
//.........这里部分代码省略.........
开发者ID:BACKUPLIB,项目名称:minimanager-1,代码行数:101,代码来源:sql_lib.php

示例5: search

function search()
{
    global $lang_global, $lang_mail, $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;
    if ($search_value == '') {
        $search_by .= ' != 0';
    } else {
        $temp = $sql->query("SELECT guid FROM `characters` WHERE name like '%{$search_value}%'");
        $search_value = $sql->result($temp, 0, 'guid');
        $search_by .= ' =' . $search_value;
    }
    $query_1 = $sql->query("SELECT count(*) FROM `mail`");
    $query = $sql->query("SELECT a.id, a.messageType, a.sender, a.receiver, a.subject, a.body, a.has_items, a.money, a.cod, a.checked, b.item_template\r\n            FROM mail a\r\n            LEFT JOIN mail_items b ON a.id = b.mail_id\r\n            WHERE {$search_by}\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=\"a.sender\">Sender</option>\r\n                <option value=\"a.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%\">" . $lang_mail['id'] . "</th>\r\n    <th width=\"5%\">" . $lang_mail['mail_type'] . "</th>\r\n    <th width=\"10%\">" . $lang_mail['sender'] . "</th>\r\n    <th width=\"10%\">" . $lang_mail['receiver'] . "</th>\r\n    <th width=\"15%\">" . $lang_mail['subject'] . "</th>\r\n    <th width=\"5%\">" . $lang_mail['has_items'] . "</th>\r\n    <th width=\"25%\">" . $lang_mail['text'] . "</th>\r\n    <th width=\"20%\">" . $lang_mail['money'] . "</th>\r\n    <th width=\"5%\">" . $lang_mail['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>";
        if ($mail[6]) {
            $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[0]) . "</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:rudb,项目名称:minimanager,代码行数:61,代码来源:mail_on.php

示例6: SQL

    }
}
if (isset($_GET['lastid']) && !empty($_GET['lastid'])) {
    $db = new SQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
    $lastid = $db->prot(htmlspecialchars($_GET['lastid']));
    $db->query("SELECT * FROM ip_shouts WHERE id<'{$lastid}' ORDER BY id DESC LIMIT 20");
    $count_shout_more = 0;
    while ($row = $db->fetch_assoc()) {
        $count_shout_more++;
        $get_shoutID = $row['id'];
        $get_userID = $row['user_id'];
        $get_shoutMsg = $row['shout_msg'];
        $get_sTime = $row['shout_time'];
        $dbf = new SQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
        $dbf->query("SELECT * FROM forum_users WHERE id='{$get_userID}'");
        if ($rowf = $dbf->fetch_array()) {
            $get_groupID = $rowf['group_id'];
            $get_username = $rowf['username'];
            $get_realname = $rowf['realname'];
            $get_title = $rowf['title'];
            $get_location = $rowf['location'];
            $get_registered = $rowf['registered'];
            $get_url = $rowf['url'];
            $get_facebook = $rowf['facebook'];
            $get_twitter = $rowf['twitter'];
            $show_avatar = $rowf['show_avatars'];
            $avatar_type = $rowf['avatar'];
            if ($get_facebook == null) {
                $facebook_url = '';
            } else {
                if (strpos($get_facebook, "http://") === 0 || strpos($get_facebook, "https://") === 0) {
开发者ID:heiswayi,项目名称:ishareportal,代码行数:31,代码来源:shoutbox_more.php

示例7: dobackup


//.........这里部分代码省略.........
                $fp = fopen("{$backup_dir}/{$file_name_new}", 'w') or die(error($lang_backup['file_write_err']));
                fseek($fp, 0, SEEK_END);
                fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$db['name']};\n") or die(error($lang_backup['file_write_err']));
                fwrite($fp, "USE {$db['name']};\n\n") or die(error($lang_backup['file_write_err']));
                fclose($fp);
                foreach ($tables_backup_characters as $value) {
                    sql_table_dump($db['addr'], $db['user'], $db['pass'], $db['name'], $value, $struc_backup, "{$backup_dir}/{$file_name_new}");
                }
                fclose($fp);
            }
        } else {
            $file_name_new = $characters_db[$realm_id]['name'] . "_backup_" . date("m.d.y_H.i.s") . ".sql";
            $fp = fopen("{$backup_dir}/{$file_name_new}", 'w') or die(error($lang_backup['file_write_err']));
            fseek($fp, 0, SEEK_END);
            fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$characters_db[$realm_id]['name']};\n") or die(error($lang_backup['file_write_err']));
            fwrite($fp, "USE {$characters_db[$realm_id]['name']};\n\n") or die(error($lang_backup['file_write_err']));
            fclose($fp);
            foreach ($tables_backup_characters as $value) {
                sql_table_dump($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name'], $value, $struc_backup, "{$backup_dir}/{$file_name_new}");
            }
            fclose($fp);
        }
        redirect("backup.php?error=2");
        exit;
    } elseif ("save" == $backup_action && "acc_on_file" == $backup_from_to) {
        //save evry account in different file
        $struc_backup = addslashes($_GET['struc_backup']);
        $save_all_realms = addslashes($_GET['save_all_realms']);
        $sql = new SQL();
        $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
        $query = $sql->query("SELECT id FROM account");
        $subdir = "{$backup_dir}/accounts/" . date("m_d_y_H_i_s");
        mkdir($subdir, 0750);
        while ($acc = $sql->fetch_array($query)) {
            $file_name_new = $acc[0] . "_{$realm_db['name']}.sql";
            $fp = fopen("{$subdir}/{$file_name_new}", 'w') or die(error($lang_backup['file_write_err']));
            fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$realm_db['name']};\n") or die(error($lang_backup['file_write_err']));
            fwrite($fp, "USE {$realm_db['name']};\n\n") or die(error($lang_backup['file_write_err']));
            $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
            foreach ($tab_backup_user_realmd as $value) {
                $acc_query = $sql->query("SELECT * FROM {$value['0']} WHERE {$value['1']} = {$acc['0']}");
                $num_fields = $sql->num_fields($acc_query);
                $numrow = $sql->num_rows($acc_query);
                $result = "-- Dumping data for {$value['0']} " . date("m.d.y_H.i.s") . "\n";
                $result .= "LOCK TABLES {$value['0']} WRITE;\n";
                $result .= "DELETE FROM {$value['0']} WHERE {$value['1']} = {$acc['0']};\n";
                if ($numrow) {
                    $result .= "INSERT INTO {$value['0']} (";
                    for ($count = 0; $count < $num_fields; $count++) {
                        $result .= "`" . $sql->field_name($acc_query, $count) . "`";
                        if ($count < $num_fields - 1) {
                            $result .= ",";
                        }
                    }
                    $result .= ") VALUES \n";
                    for ($i = 0; $i < $numrow; $i++) {
                        $result .= "\t(";
                        $row = $sql->fetch_row($acc_query);
                        for ($j = 0; $j < $num_fields; $j++) {
                            $row[$j] = addslashes($row[$j]);
                            $row[$j] = ereg_replace("\n", "\\n", $row[$j]);
                            if (isset($row[$j])) {
                                if ($sql->field_type($acc_query, $j) == "int") {
                                    $result .= "{$row[$j]}";
                                } else {
                                    $result .= "'{$row[$j]}'";
开发者ID:BACKUPLIB,项目名称:minimanager,代码行数:67,代码来源:backup.php

示例8: define

<?php

if (isset($_GET['retweet']) && !empty($_GET['retweet'])) {
    if (!defined('SITE_ROOT')) {
        define('SITE_ROOT', '../');
    }
    require_once SITE_ROOT . 'portal_config.php';
    require_once SITE_ROOT . 'include/database.class.php';
    $db = new SQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
    $retweetID = $db->prot(htmlspecialchars($_GET['retweet']));
    $db->query("SELECT shout_msg FROM ip_shouts WHERE id='{$retweetID}'");
    if ($row = $db->fetch_array()) {
        $shoutMsg = stripslashes(rtrim(htmlspecialchars_decode($row['shout_msg'])));
        $shoutMsg = str_ireplace("[rt]", "", $shoutMsg);
        $shoutMsg = str_ireplace("[/rt]", "", $shoutMsg);
        $shoutMsg = str_ireplace("<code>", "", $shoutMsg);
        $shoutMsg = str_ireplace("</code>", "", $shoutMsg);
        if (preg_match("/!update/i", $shoutMsg)) {
            $replaceShout = str_ireplace("!update", "", $shoutMsg);
            echo '[rt]' . $replaceShout . '[/rt]';
        } else {
            if (preg_match("/!request/i", $shoutMsg)) {
                $replaceShout = str_ireplace("!request", "", $shoutMsg);
                echo '[rt]' . $replaceShout . '[/rt]';
            } else {
                echo '[rt]' . $shoutMsg . '[/rt]';
            }
        }
    } else {
        echo 'KO';
    }
开发者ID:heiswayi,项目名称:ishareportal,代码行数:31,代码来源:shoutbox_retweet.php

示例9: date


//.........这里部分代码省略.........
         }
     }
     mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']);
     $HasPoints = mysql_fetch_row(mysql_query("SELECT `PlayersAccount`,`Treated` FROM point_system_invites WHERE `InviterAccount` = '{$user_name}' AND `Treated` = 0 LIMIT 1;"));
     if ($HasPoints != NULL) {
         $HasPoint = $HasPoints[1];
         $PlayersAccount = $HasPoints[0];
         mysql_select_db($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
         $iIP = mysql_fetch_row(mysql_query("SELECT `last_ip` FROM account WHERE `username` = '{$PlayersAccount}';"));
         $pIP = mysql_fetch_row(mysql_query("SELECT `last_ip` FROM account WHERE `username` = '{$user_name}';"));
         if ($HasPoint != 1) {
             if ($iIP[0] != $pIP[0]) {
                 mysql_select_db($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
                 $PlayersAccountID = mysql_fetch_row(mysql_query("SELECT `id` FROM account WHERE `username` = '{$PlayersAccount}';"));
                 $PlayersAccountID = $PlayersAccountID[0];
                 mysql_select_db($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']);
                 $RightLevel = mysql_fetch_row(mysql_query("SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED) AS `lvl` FROM `characters` WHERE account='{$PlayersAccountID}' AND (SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED)) >= '45' ORDER BY `lvl` DESC LIMIT 1;"));
                 if ($user_id < $PlayersAccountID) {
                     if ($RightLevel[0] != NULL) {
                         $output .= "You received points for account {$PlayersAccount} who has a player level {$RightLevel['0']}<br>";
                         mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']);
                         $total_points = mysql_fetch_row(mysql_query("SELECT `points` FROM point_system WHERE `accountid` = '{$user_id}';"));
                         $total_points = $total_points[0];
                         if ($total_points == NULL) {
                             $total_points = -1;
                         }
                         if ($total_points >= 0) {
                             mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']);
                             mysql_query("UPDATE point_system SET `points` = ({$total_points} + {$invite_points}) WHERE `accountid` = '{$user_id}';");
                             mysql_query("INSERT INTO point_system_requests (`username`, `request`, `date`, `code`, `treated`) VALUES ('{$user_name}', 'Added {$invite_points} Points', '{$datetime}', 'Invited {$PlayersAccount}', 'Yes');");
                             mysql_query("UPDATE point_system_invites SET `Treated` = '1' WHERE `PlayersAccount` = '{$PlayersAccount}';");
                             $output .= "You Received {$invite_points} Points for Inviting a Friend, Good JOB!";
                         }
                         if ($total_points == -1) {
                             mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']);
                             mysql_query("INSERT INTO point_system (`accountid`, `points`) VALUES ('{$user_id}', '{$invite_points}');");
                             mysql_query("INSERT INTO point_system_requests (`username`, `request`, `date`, `code`, `treated`) VALUES ('{$user_name}', 'Created {$invite_points} Points', '{$datetime}', 'Invited {$PlayersAccount}', 'Yes');");
                             mysql_query("UPDATE point_system_invites SET `Treated` = '1' WHERE `PlayersAccount` = '{$PlayersAccount}';");
                             $output .= "You Received {$invite_points} Points for Inviting a Friend, Good JOB! (NEW)";
                         }
                     } else {
                         mysql_select_db($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']);
                         $RightLevel = mysql_fetch_row(mysql_query("SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED) AS `lvl` FROM `characters` WHERE account='{$PlayersAccountID}' AND (SELECT CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) AS UNSIGNED)) >= '45' ORDER BY `lvl` DESC LIMIT 1;"));
                         mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']);
                         mysql_query("UPDATE point_system_invites SET `Treated` = '1' WHERE `PlayersAccount` = '{$PlayersAccount}';");
                         $output .= "Players you invited did not reach correct level for points";
                         if ($RightLevel != NULL) {
                             mysql_query("UPDATE point_system_invites SET `Treated` = '0' WHERE `PlayersAccount` = '{$PlayersAccount}';");
                         }
                     }
                 } else {
                     $output .= "Inviter is older than you";
                     mysql_select_db($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass']);
                     mysql_query("UPDATE point_system_invites SET `Treated` = '1' WHERE `PlayersAccount` = '{$PlayersAccount}';");
                 }
             } else {
                 $output .= "Same comp Same IP";
             }
         } else {
             $output .= "All invite points has been treated";
         }
     } else {
         $output .= "No New Points to add";
     }
     //################################################################################
     ##############################
     // PRINT
     //################################################################################
     ##############################
     $sql = new SQL();
     $sql->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
     $result = $sql->query("SELECT email,gmlevel,joindate,expansion FROM account WHERE username ='{$user_name}'");
     if ($acc = $sql->fetch_row($result)) {
         require_once "scripts/id_tab.php";
         $output .= "<center>\r\n  <script type=\"text/javascript\" src=\"js/sha1.js\"></script>\r\n  <script type=\"text/javascript\">\r\n        function do_submit_data () {\r\n            document.form.pass.value = hex_sha1('" . strtoupper($user_name) . ":'+document.form.user_pass.value.toUpperCase());\r\n            document.form.user_pass.value = '0';\r\n            do_submit();\r\n        }\r\n\r\n\r\n\r\n</script>\r\n  <fieldset style=\"width: 600px;\">\r\n    <legend>Credit Panel</legend>\r\n    <form method=\"post\" action=\"credit.php?action=getitem\" name=\"form\">\r\n    <input type=\"hidden\" name=\"pass\" value=\"\" maxlength=\"256\" />\r\n    <table class=\"flat\">\r\n    <tr>\r\n    <td>Your Credits:</td>\r\n    <td>{$total_points}</td>\r\n      <tr>\r\n        <td>VIP Level</td>\r\n        <td>" . get_gm_level($acc[1]) . " ( {$acc['1']} )</td>";
         if ($acc[1] == 0) {
             $output .= "<td><a href=\"credit.php?action=getvip\">Upgrade(20)</td>";
         }
         if ($acc[1] != 0) {
             if ($acc[1] >= 3) {
                 $output .= "<td><a href=\"credit.php?action=extvip\">Extend VIP(20)</td>";
             } else {
                 $output .= "<td><a href=\"credit.php?action=getvip\">Upgrade</td><td><a href=\"credit.php?action=extvip\">Extend VIP(20)</td>";
             }
         }
         $output .= "</tr>\r\n    <td>Request Item:</td></tr><tr>\r\n    <td>\r\n    <select name=\"items\">  \r\n    <option value=\"error\">Please select an item</option>\r\n    <option value=\"Phoenix\">Phoenix(20)</option>\r\n    <option value=\"Bag\">36 Slot Bag(20)</option>\r\n    <option value=\"Raven\">Raven Lord(15)</option>\r\n    <option value=\"PrimalNether\">Primal Nether(5)</option>\r\n    <option value=\"NetherVortex\">Nether Vortex(8)</option>\r\n    <option value=\"MercilessD\">Merciless Nether Drake(25)</option>\r\n    <option value=\"Murloc\">Murloc Costume(5)</option>\r\n    <option value=\"Tiger60\">Swift Spectral Tiger For lvl 60(20)</option>\r\n    <option value=\"Tiger30\">Swift Spectral Tiger For lvl 30(15)</option>\r\n    <option value=\"Ogre\">Carved Ogre Idol(5)</option>\r\n    <option value=\"FlyingBroom\">Swift Flying Broom(20)</option>\r\n    <option value=\"BattleBear\">Big Battle Bear(15)</option>\r\n    <option value=\"XRocket\">X-51 Nether-Rocket X-TREME(25)</option>\r\n    </select>\r\n    </td>\r\n    <td><input name=\"character\" type=\"text\" value=\"Character Name\"></input></td>\r\n    <td>\r\n      <input type=\"submit\" value=\"Send item\">\r\n    </td></tr>\r\n        <tr><td>Your chars</td>\r\n      </tr>";
         $result = $sql->query("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '{$user_id}'");
         $sql->connect($characters_db[$realm_id]['addr'], $characters_db[$realm_id]['user'], $characters_db[$realm_id]['pass'], $characters_db[$realm_id]['name']);
         $result = $sql->query("SELECT guid,name,race,class,SUBSTRING_INDEX(SUBSTRING_INDEX(`data`, ' ', 35), ' ', -1) FROM `characters` WHERE account = {$user_id}");
         while ($char = $sql->fetch_array($result)) {
             $ren_char = $char[1];
             $output .= "<tr>\r\n        <td>{$char['1']}  - " . get_player_race($char[2]) . " " . get_player_class($char[3]) . " | lvl {$char['4']}</td>\r\n        </tr>\r\n<tr><td><a href=\"credit.php?action=rename&ren_char={$ren_char}\">Rename(6)</a></td><td><a href=\"credit.php?action=gen_char&gend_char={$ren_char}\">Change Gender(6)</a></td><td><a href=\"credit.php?action=movechar&char={$ren_char}\">Move Account(7)</a></td>";
         }
         $output .= "</form>    <tr>\r\n     <form method=\"post\" action=\"credit.php?action=movepoints\" name=\"form\">\r\n    <input type=\"hidden\" name=\"pass\" value=\"\" maxlength=\"256\" />\r\n    <td>Transfer points to other players:</td></tr><tr>\r\n    <td><input name=\"tcharacter\" type=\"text\" value=\"Character Name\"></input></td><td><input name=\"tpoints\" type=\"text\" value=\"Points\"></input></td>\r\n    <td>\r\n      <input type=\"submit\" value=\"Transfer\">\r\n    </td></tr></form>\r\n    <form method=\"post\" action=\"credit.php?action=tplayer\" name=\"form\">\r\n    <tr><td>Teleport Player</td></tr><tr>\r\n    <td><input name=\"tchar\" type=\"text\" value=\"Character Name\"></input></td>\r\n    <td>\r\n    <select name=\"tplace\">  \r\n    <option value=\"error\">Please select a place</option>\r\n    <option value=\"Shattrath\">Shattrath(1)</option>\r\n    <option value=\"Stormwind\">Stormwind(1)</option>\r\n    <option value=\"Orgrimmar\">Orgrimmar(1)</option>\r\n    </select>\r\n    </td>\r\n    <td><input type=\"submit\" value=\"Teleport\"></td></tr>";
         $output .= "</table>\r\n    </fieldset>\r\n    <br />\r\n\r\n    <br /></center>";
     } else {
         error($lang_global['err_no_records_found']);
     }
     $sql->close();
 }
开发者ID:TheProjecter,项目名称:mmfm,代码行数:101,代码来源:credit.php

示例10: update_jc_ticket_sp

 /**
  * 更新moreinfo
  * @param unknown_type $id
  * @param unknown_type $play_method
  * @param unknown_type $codes
  * @param unknown_type $ticket_type
  */
 public function update_jc_ticket_sp($id, $play_method, $codes, $ticket_type = 1)
 {
     require_once WEBROOT . 'cron_script/SQL.php';
     $sql_obj = new SQL();
     $return = array();
     $code_a = explode(';', $codes);
     $code = $code_a[0];
     $match_detail = explode('/', $code);
     for ($i = 0; $i < count($match_detail); $i++) {
         $match_info = explode('|', $match_detail[$i]);
         $match_id = $match_info[0];
         preg_match_all("/\\[(.*)\\]/", $match_info[1], $match_result, PREG_SET_ORDER);
         $match_results = $match_result[0][1];
         $match_results_a = explode(',', $match_results);
         $match_result_sp = array();
         $select_match_query = 'select comb,goalline from match_datas where ticket_type="' . $ticket_type . '" and play_type="' . $play_method . '" and match_id="' . $match_id . '" limit 1';
         $sql_obj->query($select_match_query);
         $match_data = $sql_obj->fetch_array();
         $sp = $match_data['comb'];
         $goalline = $match_data['goalline'];
         //var_dump($sp);
         $play_config = array();
         if ($ticket_type == 1) {
             switch ($play_method) {
                 case 1:
                     $play_config = array('3' => 'H', '1' => 'D', '0' => 'A');
                     break;
                 case 2:
                     $play_config = array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7');
                     break;
                 case 3:
                     $play_config = array('负其它' => '-1:-A', '胜其它' => '-1:-H', '平其它' => '-1:-D', '0:0' => '00:00', '0:1' => '00:01', '0:2' => '00:02', '0:3' => '00:03', '0:4' => '00:04', '0:5' => '00:05', '1:0' => '01:00', '1:1' => '01:01', '1:2' => '01:02', '1:3' => '01:03', '1:4' => '01:04', '1:5' => '01:05', '2:0' => '02:00', '2:1' => '02:01', '2:2' => '02:02', '2:3' => '02:03', '2:4' => '02:04', '2:5' => '02:05', '3:0' => '03:00', '3:1' => '03:01', '3:2' => '03:02', '3:3' => '03:03', '4:0' => '04:00', '4:1' => '04:01', '4:2' => '04:02', '5:0' => '05:00', '5:1' => '05:01', '5:2' => '05:02');
                     break;
                 case 4:
                     $play_config = array('0-0' => 'cc', '0-1' => 'cb', '0-3' => 'ca', '1-0' => 'bc', '1-1' => 'bb', '1-3' => 'ba', '3-0' => 'ac', '3-1' => 'ab', '3-3' => 'aa');
                     break;
                 default:
                     break;
             }
         }
         if ($ticket_type == 6) {
             switch ($play_method) {
                 case 1:
                     $play_config = array('2' => 'H', '1' => 'D');
                     break;
                 case 2:
                     $play_config = array('2' => 'H', '1' => 'D');
                     break;
                 case 3:
                     $play_config = array('01' => 'u4e3bu80dc1-5', '02' => 'u4e3bu80dc6-10', '03' => 'u4e3bu80dc11-15', '04' => 'u4e3bu80dc16-20', '05' => 'u4e3bu80dc21-25', '06' => 'u4e3bu80dc26+', '11' => 'u5ba2u80dc1-5', '12' => 'u5ba2u80dc6-10', '13' => 'u5ba2u80dc11-15', '14' => 'u5ba2u80dc16-20', '15' => 'u5ba2u80dc21-25', '16' => 'u5ba2u80dc26+');
                     break;
                 case 4:
                     $play_config = array('1' => 'H', '2' => 'D');
                     break;
                 default:
                     break;
             }
         }
         //$sp = '{"cc":{"c":"cc","v":"4.30","s":"1","d":"2011-09-06","t":"05:59:00"},"cb":{"c":"cb","v":"15.00","s":"1","d":"2011-09-06","t":"05:59:00"},"ca":{"c":"ca","v":"28.00","s":"1","d":"2011-09-06","t":"05:59:00"},"bc":{"c":"bc","v":"6.50","s":"1","d":"2011-09-06","t":"05:59:00"},"bb":{"c":"bb","v":"4.50","s":"1","d":"2011-09-06","t":"05:59:00"},"ba":{"c":"ba","v":"5.40","s":"1","d":"2011-09-06","t":"05:59:00"},"ac":{"c":"ac","v":"34.00","s":"1","d":"2011-09-06","t":"05:59:00"},"ab":{"c":"ab","v":"15.00","s":"1","d":"2011-09-06","t":"05:59:00"},"aa":{"c":"aa","v":"3.85","s":"1","d":"2011-09-06","t":"05:59:00"}}';
         $sp = json_decode($sp);
         $result_sp = array();
         foreach ($sp as $key => $val) {
             if (isset($val->c)) {
                 $result_sp[$val->c] = $val->v;
             } else {
                 $result_sp[] = $val->v;
             }
         }
         //var_dump($result_sp);
         for ($j = 0; $j < count($match_results_a); $j++) {
             $key = $play_config[$match_results_a[$j]];
             if (array_key_exists($key, $result_sp)) {
                 $match_result_sp[] = $result_sp[$key];
             }
         }
         $match_result_sp = implode(',', $match_result_sp);
         //$return[] = $match_id.':'.$match_result_sp;
         if ($ticket_type == 6 && ($play_method == 2 || $play_method == 4)) {
             if ($play_method == 2 && $goalline > 0) {
                 $goalline = '+' . $goalline;
             }
             $return[] = $match_id . '(' . $goalline . '):' . $match_result_sp;
         } else {
             $return[] = $match_id . ':' . $match_result_sp;
         }
         //var_dump($return);
         //echo $i;
     }
     $return = implode('|', $return);
     //var_dump($return);
     $sql_obj->query('update ticket_nums set moreinfo="' . $return . '" where id="' . $id . '"');
     if (!$sql_obj->error()) {
         return true;
//.........这里部分代码省略.........
开发者ID:RenzcPHP,项目名称:3dproduct,代码行数:101,代码来源:ticket.php

示例11: isset

<?php

// page header, and any additional required libraries
require_once "header.php";
//##############################################################################################
// MAIN
//##############################################################################################
$username = isset($_GET['username']) ? $_GET['username'] : NULL;
$authkey = isset($_GET['authkey']) ? $_GET['authkey'] : NULL;
$output .= "\n<div class=\"top\">";
$sqlm = new SQL();
$sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
$query = $sqlm->query("SELECT * \n\t\t\t\t\t\tFROM mm_account_verification \n\t\t\t\t\t\tWHERE username = '{$username}' AND authkey = '{$authkey}'");
$lang_verify = lang_verify();
if ($sqlm->num_rows($query) < 1) {
    $output .= "\n\t<h1><font class=\"error\">{$lang_verify['verify_failed']}</font></h1>";
} else {
    $output .= "<h1><font class=\"error\">{$lang_verify['verify_success']}</font></h1>";
    $sqlr = new SQL();
    $sqlr->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
    $data = $sqlm->fetch_array($query);
    list($id, $username, $pass, $gmlevel, $session, $v, $s, $email, $joindate, $last_ip, $failed_logins, $locked, $last_login, $active, $expansion) = $data;
    $sqlr->query("\n\t\tINSERT INTO account\n\t\t\t(id,\n\t\t\tusername,\n\t\t\tsha_pass_hash,\n\t\t\tgmlevel,\n\t\t\tsessionkey,\n\t\t\tv,\n\t\t\ts,\n\t\t\temail,\n\t\t\tjoindate,\n\t\t\tlast_ip,\n\t\t\tfailed_logins,\n\t\t\tlocked,\n\t\t\tlast_login,\t\t\t\n\t\t\tactive_realm_id,\n\t\t\texpansion)\n\t\tVALUES\n\t\t\t('',\n\t\t\tUPPER('{$username}'),\n\t\t\t'{$pass}',\n\t\t\t0,\n\t\t\t'',\n\t\t\t'',\n\t\t\t'',\n\t\t\t'{$email}'\n\t\t\t,now(),\n\t\t\t'{$last_ip}',\n\t\t\t0,\n\t\t\t{$create_acc_locked},\n\t\t\tNULL,\n\t\t\t0,\n\t\t\t{$expansion})");
    $result = $sqlr->query("\n\t\tSELECT * \n\t\tFROM account \n\t\tWHERE username='{$username}'");
}
$sqlm->query("\n\t\tDELETE FROM mm_account_verification \n\t\tWHERE username='{$username}'");
$output .= "\n</div>";
$output .= "\n<center>\n<br />\n<table class=\"hidden\">\n\t<tr>\n\t\t<td>" . makebutton($lang_global['home'], 'index.php', 130) . "</td>\n\t</tr>\n</table>\n</center>";
require_once "footer.php";
开发者ID:BACKUPLIB,项目名称:minimanager-1,代码行数:29,代码来源:verify.php

示例12: backup_user

function backup_user()
{
    //this_is_junk: TODO: Convert this to use $logon_db and ArcEmu data
    global $output, $logon_db, $characters_db, $realm_id, $user_lvl, $backup_dir, $action_permission;
    valid_login($action_permission["insert"]);
    $sql = new SQL();
    $sql->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]);
    if (isset($_GET["check"])) {
        $check = $sql->quote_smart($_GET["check"]);
    } else {
        redirect("user.php?error=1");
    }
    require_once "libs/tab_lib.php";
    $subdir = "{$backup_dir}/accounts/" . date("m_d_y_H_i_s") . "_partial";
    mkdir($subdir, 0750);
    for ($t = 0; $t < count($check); $t++) {
        if ($check[$t] != "") {
            $sql->connect($logon_db["addr"], $logon_db["user"], $logon_db["pass"], $logon_db["name"], $logon_db["encoding"]);
            $query = $sql->query("SELECT acct FROM accounts WHERE acct = {$check[$t]}");
            $acc = $sql->fetch_array($query);
            $file_name_new = $acc[0] . "_{$logon_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*/ {$logon_db["name"]};\n") or die(error(lang("backup", "file_write_err")));
            fwrite($fp, "USE {$logon_db["name"]};\n\n") or die(error(lang("backup", "file_write_err")));
            foreach ($tab_backup_user_realmd as $value) {
                $acc_query = $sql->query("SELECT * FROM {$value['0']} WHERE {$value['1']} = {$acc['0']}");
                $num_fields = $sql->num_fields($acc_query);
                $numrow = $sql->num_rows($acc_query);
                $result = "-- Dumping data for {$value['0']} " . date("m.d.y_H.i.s") . "\n";
                $result .= "LOCK TABLES {$value['0']} WRITE;\n";
                $result .= "DELETE FROM {$value['0']} WHERE {$value['1']} = {$acc['0']};\n";
                if ($numrow) {
                    $result .= "INSERT INTO {$value['0']} (";
                    for ($count = 0; $count < $num_fields; $count++) {
                        $result .= "`" . $sql->field_name($acc_query, $count) . "`";
                        if ($count < $num_fields - 1) {
                            $result .= ",";
                        }
                    }
                    $result .= ") VALUES \n";
                    for ($i = 0; $i < $numrow; $i++) {
                        $result .= "\t(";
                        $row = $sql->fetch_row($acc_query);
                        for ($j = 0; $j < $num_fields; $j++) {
                            $row[$j] = addslashes($row[$j]);
                            $row[$j] = ereg_replace("\n", "\\n", $row[$j]);
                            if (isset($row[$j])) {
                                if ($sql->field_type($acc_query, $j) == "int") {
                                    $result .= "{$row[$j]}";
                                } else {
                                    $result .= "'{$row[$j]}'";
                                }
                            } else {
                                $result .= "''";
                            }
                            if ($j < $num_fields - 1) {
                                $result .= ",";
                            }
                        }
                        if ($i < $numrow - 1) {
                            $result .= "),\n";
                        }
                    }
                    $result .= ");\n";
                }
                $result .= "UNLOCK TABLES;\n";
                $result .= "\n";
                fwrite($fp, $result) or die(error(lang("backup", "file_write_err")));
            }
            fclose($fp);
            foreach ($characters_db as $db) {
                $file_name_new = $acc[0] . "_{$db["name"]}.sql";
                $fp = fopen("{$subdir}/{$file_name_new}", 'w') or die(error(lang("backup", "file_write_err")));
                fwrite($fp, "CREATE DATABASE /*!32312 IF NOT EXISTS*/ {$db["name"]};\n") or die(error(lang("backup", "file_write_err")));
                fwrite($fp, "USE {$db["name"]};\n\n") or die(error(lang("backup", "file_write_err")));
                $sql->connect($db["addr"], $db["user"], $db["pass"], $db["name"], $db["encoding"]);
                $all_char_query = $sql->query("SELECT guid,name FROM `characters` WHERE account = {$acc['0']}");
                while ($char = $sql->fetch_array($all_char_query)) {
                    fwrite($fp, "-- Dumping data for character {$char['1']}\n") or die(error(lang("backup", "file_write_err")));
                    foreach ($tab_backup_user_characters as $value) {
                        $char_query = $sql->query("SELECT * FROM {$value['0']} WHERE {$value['1']} = {$char['0']}");
                        $num_fields = $sql->num_fields($char_query);
                        $numrow = $sql->num_rows($char_query);
                        $result = "LOCK TABLES {$value['0']} WRITE;\n";
                        $result .= "DELETE FROM {$value['0']} WHERE {$value['1']} = {$char['0']};\n";
                        if ($numrow) {
                            $result .= "INSERT INTO {$value['0']} (";
                            for ($count = 0; $count < $num_fields; $count++) {
                                $result .= "`" . $sql->field_name($char_query, $count) . "`";
                                if ($count < $num_fields - 1) {
                                    $result .= ",";
                                }
                            }
                            $result .= ") VALUES \n";
                            for ($i = 0; $i < $numrow; $i++) {
                                $result .= "\t(";
                                $row = $sql->fetch_row($char_query);
                                for ($j = 0; $j < $num_fields; $j++) {
                                    $row[$j] = addslashes($row[$j]);
                                    $row[$j] = ereg_replace("\n", "\\n", $row[$j]);
//.........这里部分代码省略.........
开发者ID:GlassFace,项目名称:CoreManager2,代码行数:101,代码来源:user.php

示例13: SQL

    if ($_GET['id'] == null) {
        $charid = -1;
    }
} else {
    $charid = -1;
    $charname = "Invalid ID!";
    #redirect("characters.php");
}
$sqlt = new SQL();
$sqlt->connect($trin_host, $trin_user, $trin_pass, $trin_db);
$sqlc = new SQL();
$sqlc->connect($characters_host[$realmid], $characters_user[$realmid], $characters_pass[$realmid], $characters_db[$realmid]);
$sqlw = new SQL();
$sqlw->connect($world_host[$realmid], $world_user[$realmid], $world_pass[$realmid], $world_db[$realmid]);
$query = $sqlc->query("SELECT guid, name, online, level FROM characters WHERE guid={$charid}");
$character = $sqlc->fetch_array($query);
if ($sqlc->num_rows($query) < 1) {
    $charname = "Invalid ID!";
    $output .= '
		<div class="content center_left">
				<div class="contentbox">
					<div class="contentbox_title">' . $charname . '</div>
					<div class="contentbox_body">';
} else {
    getguildbychar($charid);
    //Added to accomodate for the removal of the 'data' blob in the database
    $output .= '			<div class="content center_left">
				<div class="contentbox">
					<div class="contentbox_title">Character Info: ' . $character['name'] . '</div>
					<div class="contentbox_body">
						<ul id="tabnav">
开发者ID:jempson,项目名称:trinitymanager,代码行数:31,代码来源:view_char.php

示例14: getskillname

{
    global $sqlt;
    $query = $sqlt->query("SELECT name FROM dbc_skillline WHERE id='{$skillid}'");
    $res = $sqlt->fetch_assoc($query);
    return $res['name'];
}
$output .= '<div class="content center_left">
				<div class="contentbox">
					<div class="contentbox_title">Character Info: ' . $character['name'] . '</div>
					<div class="contentbox_body">
						<ul id="tabnav">
							<li><a href="characters.php?action=view&id=' . $charid . '">Character</a></li>
							<li><a href="characters.php?action=reputation&id=' . $charid . '">Reputation</a></li>
							<li><a href="#" id="tabnav-current">Skills</a></li>
							<li><a href="characters.php?action=talents&id=' . $charid . '">Talents</a></li>
						</ul>
						<div id="tabcontent">
						<table class="stats_table">';
while ($skills = $sqlc->fetch_array($query)) {
    $output .= '<tr><td>' . getskillname($skills['skill']) . '</td><td class="stats_outerbar"> <div class="bar_skill stats_bar" style="width:' . 100 * $skills['value'] / $skills['max'] . '%"></div><div class="bar_text">' . $skills['value'] . '/' . $skills['max'] . '<div></td></tr>';
}
$output .= '</div>
						</table>
					</div>
				</div>
			</div>
		</div>
		<div id="clear">
		</div>';
require_once "footer.php";
echo $output;
开发者ID:jempson,项目名称:trinitymanager,代码行数:31,代码来源:skills.php

示例15: populate_shoutbox

function populate_shoutbox()
{
    $db = new SQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
    $db->query("SELECT * FROM ip_shouts ORDER BY id DESC LIMIT 100");
    echo '<ul id="chat" class="chat">';
    $count_shout = 0;
    while ($row = $db->fetch_assoc()) {
        $count_shout++;
        $get_shoutID = $row['id'];
        $get_userID = $row['user_id'];
        $get_shoutMsg = $row['shout_msg'];
        $get_sTime = $row['shout_time'];
        $dbf = new SQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
        $dbf->query("SELECT * FROM forum_users WHERE id='{$get_userID}'");
        if ($rowf = $dbf->fetch_array()) {
            $get_groupID = $rowf['group_id'];
            $get_username = $rowf['username'];
            $get_realname = $rowf['realname'];
            $get_title = $rowf['title'];
            $get_location = $rowf['location'];
            $get_registered = $rowf['registered'];
            $get_url = $rowf['url'];
            $get_facebook = $rowf['facebook'];
            $get_twitter = $rowf['twitter'];
            $show_avatar = $rowf['show_avatars'];
            $avatar_type = $rowf['avatar'];
            if ($get_facebook == null) {
                $facebook_url = '';
            } else {
                if (strpos($get_facebook, "http://") === 0 || strpos($get_facebook, "https://") === 0) {
                    $facebook_url = '<a href="' . $get_facebook . '">' . $get_facebook . '</a>';
                } else {
                    $facebook_url = '<a href="http://facebook.com/' . $get_facebook . '">http://facebook.com/' . $get_facebook . '</a>';
                }
            }
            if ($get_twitter == null) {
                $twitter_url = '';
            } else {
                if (strpos($get_twitter, "http://") === 0 || strpos($get_twitter, "https://") === 0) {
                    $twitter_url = '<a href="' . $get_twitter . '">' . $get_twitter . '</a>';
                } else {
                    $twitter_url = '<a href="http://twitter.com/' . $get_twitter . '">http://twitter.com/' . $get_twitter . '</a>';
                }
            }
            if ($get_url == null) {
                $website = '';
            } else {
                if (strpos($get_url, "http://") === 0 || strpos($get_url, "https://") === 0) {
                    $website = '<a href="' . $get_url . '">' . $get_url . '</a>';
                } else {
                    $website = '<a href="http://' . $get_url . '">http://' . $get_url . '</a>';
                }
            }
        }
        $dbf->close();
        if ($_SESSION['current_userID'] == $get_userID) {
            if ($count_shout == 20) {
                echo '<li id="lastShout" class="right">';
            } else {
                echo '<li class="right">';
            }
        } else {
            if ($count_shout == 20) {
                echo '<li id="lastShout" class="left">';
            } else {
                echo '<li class="left">';
            }
        }
        echo '<a href="profile.php?id=' . $get_userID . '"><img class="avatar" alt="' . $get_username . '" src="' . get_avatar($avatar_type, $get_userID) . '"></a>';
        echo '<span class="message"><span class="arrow"></span>';
        if ($get_realname == null) {
            echo '<span class="from"><a href="profile.php?id=' . $get_userID . '" class="user-name">@' . $get_username . '</a> ';
        } else {
            echo '<span class="from"><a href="profile.php?id=' . $get_userID . '" class="user-name">' . $get_realname . '</a> ';
        }
        if ($get_title !== null) {
            echo '<span class="forum-title"><em>' . $get_title . '</em></span></span> ';
        }
        echo '<span class="time muted"><small>' . timeAgo($get_sTime) . '</small></span>';
        if ($_SESSION['current_userID'] !== $get_userID) {
            echo '<span class="pull-right">';
            echo '<button class="btn btn-mini tip-top" id="rtshout-' . $get_shoutID . '" onClick="rtshout(\'' . $get_shoutID . '\',\'' . $get_username . '\');" title="Reshout"><i class="icon-share"></i> RT</button> ';
            echo '<button class="btn btn-mini" id="mention-' . $get_shoutID . '" onClick="insertNickname(\'' . $get_username . '\');"><i class="icon-circle"></i> Mention</button>';
            echo '</span>';
        }
        echo '<span class="text" id="msg-' . $get_shoutID . '">' . stripslashes(rtrim(clickable(bbCode($get_shoutMsg)))) . '</span>';
        echo '</span></li>';
    }
    if ($count_shout == 100) {
        echo '<div style="margin-top:10px;padding:10px;text-align:center;" id="more-' . $get_shoutID . '" class="morebox"><a href="#" id="' . $get_shoutID . '" class="btn btn-small btn-inverse more"><i class="icon-arrow-down icon-white"></i> Load more...</a></div>';
    }
    echo '</ul>';
    $db->close();
    echo '
    <script>
    $(document).ready(function () { // START DOCUMENT.READY
    
    $(".link-tip, .tip-top").tooltip();
    $(".more").click(function(e){
    e.preventDefault();
//.........这里部分代码省略.........
开发者ID:heiswayi,项目名称:ishareportal,代码行数:101,代码来源:shoutbox_display.php


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