當前位置: 首頁>>代碼示例>>PHP>>正文


PHP dbstuff::queries方法代碼示例

本文整理匯總了PHP中dbstuff::queries方法的典型用法代碼示例。如果您正苦於以下問題:PHP dbstuff::queries方法的具體用法?PHP dbstuff::queries怎麽用?PHP dbstuff::queries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dbstuff的用法示例。


在下文中一共展示了dbstuff::queries方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init


//.........這裏部分代碼省略.........
                $room_prefix = '';
            }
        }
    }
    $tablepre = $gtablepre . $room_prefix;
    if ($room_prefix == '') {
        $wtablepre = $gtablepre;
    } else {
        $wtablepre = $gtablepre . $room_prefix[0];
    }
    //自動初始化表
    if ($room_prefix != '') {
        $result = $db->query("show tables like '{$wtablepre}winners';");
        if (!$db->num_rows($result)) {
            //某個非主房間是第一次使用,則創建表並初始化
            $db->query("create table if not exists {$wtablepre}winners like {$gtablepre}winners;");
        }
        $result = $db->query("show tables like '{$tablepre}game';");
        if (!$db->num_rows($result)) {
            //某個非主房間是第一次使用,則創建表並初始化
            $db->query("create table if not exists {$tablepre}game like {$gtablepre}game;");
            $result = $db->query("SELECT count(*) as cnt FROM {$tablepre}game");
            if (!$db->num_rows($result)) {
                $cnt = 0;
            } else {
                $zz = $db->fetch_array($result);
                $cnt = $zz['cnt'];
            }
            if ($cnt == 0) {
                $db->query("insert into {$tablepre}game (gamenum) values (0);");
            }
            $result = $db->query("SELECT count(*) as cnt FROM {$wtablepre}winners");
            if (!$db->num_rows($result)) {
                $cnt = 0;
            } else {
                $zz = $db->fetch_array($result);
                $cnt = $zz['cnt'];
            }
            if ($cnt == 0) {
                $db->query("insert into {$wtablepre}winners (gid) values (0);");
            }
            $sql = file_get_contents(GAME_ROOT . './gamedata/sql/reset.sql');
            $sql = str_replace("\r", "\n", str_replace(' bra_', ' ' . $tablepre, $sql));
            $db->queries($sql);
            $sql = file_get_contents(GAME_ROOT . './gamedata/sql/players.sql');
            $sql = str_replace("\r", "\n", str_replace(' bra_', ' ' . $tablepre, $sql));
            $db->queries($sql);
        }
    }
    //$errorinfo ? error_reporting(E_ALL) : error_reporting(0);
    date_default_timezone_set('Etc/GMT');
    //$now = time() + $moveutmin*60;
    global $now;
    $now = time() + $moveut * 3600 + $moveutmin * 60;
    global $sec, $min, $hour, $day, $month, $year, $wday;
    list($sec, $min, $hour, $day, $month, $year, $wday) = explode(',', date("s,i,H,j,n,Y,w", $now));
    //if($attackevasive) {
    //	include_once GAME_ROOT.'./include/security.inc.php';
    //}
    //COMBAT INFO INIT
    //已經一起做進數據庫裏了
    //global $hdamage,$hplayer,$noisetime,$noisepls,$noiseid,$noiseid2,$noisemode;
    //include GAME_ROOT.'./gamedata/combatinfo.php';
    //GAME INFO INIT
    global $now, $db, $tablepre;
    $result = $db->query("SELECT * FROM {$tablepre}game");
    global $gameinfo;
    $gameinfo = $db->fetch_array($result);
    foreach ($gameinfo as $key => $value) {
        global ${$key};
        ${$key} = $value;
    }
    if ($room_status == 2 && $gamestate == 0 && $room_prefix != '' && $room_prefix[0] == 's') {
        $db->query("UPDATE {$gtablepre}rooms SET status=1 WHERE roomid='" . substr($room_prefix, 1) . "'");
    }
    $arealist = explode(',', $arealist);
    global $cuser, $cpass;
    $cuser = ${$gtablepre . 'user'};
    $cpass = ${$gtablepre . 'pass'};
    //這裏實在沒辦法,一堆文件都直接引用mode和command這兩個來自input的變量,但又不能讓所有文件都依賴input…… 隻能惡心一下了……
    global $mode, $command, $___MOD_SRV;
    if ($___MOD_SRV) {
        global $___LOCAL_INPUT__VARS__mode, $___LOCAL_INPUT__VARS__command;
        global $___LOCAL_INPUT__VARS__INPUT_VAR_LIST;
        if (isset($___LOCAL_INPUT__VARS__INPUT_VAR_LIST['mode'])) {
            $mode = $___LOCAL_INPUT__VARS__INPUT_VAR_LIST['mode'];
        } else {
            $mode = $___LOCAL_INPUT__VARS__mode;
        }
        if (isset($___LOCAL_INPUT__VARS__INPUT_VAR_LIST['command'])) {
            $command = $___LOCAL_INPUT__VARS__INPUT_VAR_LIST['command'];
        } else {
            $command = $___LOCAL_INPUT__VARS__command;
        }
    } else {
        global $___LOCAL_INPUT__VARS__mode, $___LOCAL_INPUT__VARS__command;
        $mode = $___LOCAL_INPUT__VARS__mode;
        $command = $___LOCAL_INPUT__VARS__command;
    }
}
開發者ID:winddramon,項目名稱:dts,代碼行數:101,代碼來源:init.php


注:本文中的dbstuff::queries方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。