本文整理汇总了PHP中dbstuff::fetch_array方法的典型用法代码示例。如果您正苦于以下问题:PHP dbstuff::fetch_array方法的具体用法?PHP dbstuff::fetch_array怎么用?PHP dbstuff::fetch_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbstuff
的用法示例。
在下文中一共展示了dbstuff::fetch_array方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_user_credit
public function update_user_credit($mobile, $credit)
{
//$mobile = '18782963909';
//$credit = 1;
$db = new dbstuff();
$db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, 0);
$sql = "SELECT `uid` FROM " . DZ_DBTABLEPRE . "common_member WHERE `username`={$mobile}";
$result = $db->query($sql);
if ($db->num_rows($result) == 0) {
return false;
} else {
$row = $db->fetch_array($result);
$uid = $row['uid'];
$sql = "SELECT * FROM " . DZ_DBTABLEPRE . "common_member_count WHERE `uid`={$uid}";
$result = $db->query($sql);
if ($db->num_rows($result) == 0) {
return false;
} else {
$row = $db->fetch_array($result);
if ($row['extcredits2'] < $credit) {
return false;
} else {
//print_r($row);$row['extcredits2'] = 376;
$new_credit = $row['extcredits2'] - $credit;
$sql = 'UPDATE ' . DZ_DBTABLEPRE . "common_member_count SET extcredits2='{$new_credit}' WHERE uid='{$uid}'";
$re = $db->query($sql);
if ($db->num_rows($re) == 0) {
return false;
} else {
return true;
}
}
}
}
}
示例2: check_authority
function check_authority()
{
require GAME_ROOT . './include/modules/core/sys/config/server.config.php';
$_COOKIE = gstrfilter($_COOKIE);
$cuser = $_COOKIE[$gtablepre . 'user'];
$cpass = $_COOKIE[$gtablepre . 'pass'];
require GAME_ROOT . './include/db_' . $database . '.class.php';
$db = new dbstuff();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
$result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='{$cuser}'");
if (!$db->num_rows($result)) {
echo "<span><font color=\"red\">Cookie无效,请登录。</font></span><br>";
die;
}
$udata = $db->fetch_array($result);
if ($udata['password'] != $cpass) {
echo "<span><font color=\"red\">Cookie无效,请登录。</font></span><br>";
die;
} elseif ($udata['groupid'] < 9 && $cuser !== $gamefounder) {
echo "<span><font color=\"red\">要求至少9权限。</font></span><br>";
die;
}
unset($db);
unset($cuser);
unset($cpass);
unset($udata);
unset($result);
}
示例3: UcenterReg
public function UcenterReg($data)
{
$db = new dbstuff();
$db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, 0);
$uid = uc_user_register($data['username'], $data['password'], $data['email']);
if ($uid <= 0) {
return $uid;
/* if($uid == -1) {
return '用户名不合法';
} elseif($uid == -2) {
return '包含要允许注册的词语';
} elseif($uid == -3) {
return '用户名已经存在';
} elseif($uid == -4) {
return 'Email 格式有误';
} elseif($uid == -5) {
return 'Email 不允许注册';
} elseif($uid == -6) {
return '该 Email 已经被注册';
} else {
return '未定义';
}*/
} else {
$username = $data['username'];
$sql = "SELECT `username`,`password` FROM " . DZ_DBTABLEPRE . "common_member WHERE `uid`={$uid}";
$result = $db->query($sql);
if ($db->num_rows($result) == 0) {
$sql = "SELECT `username`,`password` FROM " . UC_DBTABLEPRE . "members WHERE `uid`={$uid}";
$result = $db->query($sql);
$row = $db->fetch_array($result);
//激活
$sql = "insert into " . DZ_DBTABLEPRE . "common_member set regdate='" . time() . "',uid='{$uid}',email='" . $data['email'] . "',username='" . $data['username'] . "',password='" . $row['password'] . "',timeoffset=9999";
$db->query($sql);
$sql = "insert into " . DZ_DBTABLEPRE . "common_member_status set uid='{$uid}', regip='{$_SERVER['REMOTE_ADDR']}',lastip='{$_SERVER['REMOTE_ADDR']}',lastvisit=" . time() . ", lastactivity=" . time() . ',lastpost=0, lastsendmail=0';
$db->query($sql);
$sql = "insert into " . DZ_DBTABLEPRE . "common_member_profile set uid='{$uid}'";
$db->query($sql);
$sql = "insert into " . DZ_DBTABLEPRE . "common_member_field_forum set uid='{$uid}'";
$db->query($sql);
$sql = "insert into " . DZ_DBTABLEPRE . "common_member_field_home set uid='{$uid}' ";
$db->query($sql);
$sql = "insert into " . DZ_DBTABLEPRE . "common_member_count set uid='{$uid}' ";
$db->query($sql);
$db->query('UPDATE ' . DZ_DBTABLEPRE . "common_setting SET svalue='{$data['username']}' WHERE skey='lastmember'");
//exit;
}
}
unset($db);
return $uid;
}
示例4: getImList
function getImList($offset)
{
$db_uch = new dbstuff();
$db_uch->charset = dbcharset;
$db_uch->connect(dbhost, dbuser, dbpw, dbname, pconnect);
$query = $db_uch->query("SELECT qq FROM " . tname("spacefield") . " WHERE qq <> '' LIMIT " . $offset . ",50");
while ($row = $db_uch->fetch_array($query)) {
if (!empty($row["qq"])) {
if (empty($result)) {
$result = $row["qq"];
} else {
$result .= "," . $row["qq"];
}
}
}
return $result;
}
示例5: substr
$b = substr($U, 1, 1) . substr($U, 3, 1) . substr($U, 5, 1);
$c = $s % $U + $s + $a + $b;
return $c;
}
$TOkSi = $_REQUEST['process_time'] + $_REQUEST['gwsr'] + $_REQUEST['amount'];
$my_spcheck = gwSpcheck($chk, $TOkSi);
$res_str = "<center><div style='background-color:white'>";
$db = new dbstuff();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);
$db->select_db($dbname);
$orderid = $_REQUEST['orderid'];
$status = 1;
$buyer = $_REQUEST['buyer'];
$uid = $_REQUEST['uid'];
$amount = $_REQUEST['amount'];
$price = $_REQUEST['price'];
$submitdate = $_REQUEST['submitdate'];
$db->query("INSERT INTO {$tablepre}orders (orderid, status, buyer, admin, uid, amount, price, submitdate, confirmdate)VALUES ('{$orderid}', '{$status}', '{$buyer}', 'admin', {$uid}, {$amount}, {$price}, {$submitdate}, 0)");
$amt = 0;
$query = $db->query("SELECT * FROM {$tablepre}orders WHERE orderid = '{$orderid}'");
while ($t = $db->fetch_array($query)) {
$amt = $t['amount'];
}
if (($my_spcheck == $_REQUEST['spcheck'] || $_REQUEST['succ'] == '1') && $amount == $amt) {
include_once 'greenworld.func.php';
$res_str .= "<FONT COLOR='green'>交易成功";
} else {
$res_str .= "<FONT COLOR='red'>交易失敗";
}
$res_str .= "</FONT></div></center>";
echo $res_str;
示例6: dbstuff
}
include './config.inc.php';
include './include/db_' . $database . '.class.php';
$db = new dbstuff();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
$query = $db->query("CREATE DATABASE bra_temp", 'SILENT');
if ($db->error()) {
$createerror = TRUE;
} else {
$query = $db->query("DROP DATABASE bra_temp", 'SILENT');
$createerror = FALSE;
}
$query = $db->query("SHOW DATABASES", 'SILENT');
$option = '';
if ($query) {
while ($database = $db->fetch_array($query)) {
if ($database['Database'] != 'mysql') {
$option .= '<option value="' . $database['Database'] . '"' . ($dbname == $database['Database'] ? ' selected' : '') . '>' . $database['Database'] . "</option>";
}
}
}
if (!empty($option)) {
?>
<tr>
<td bgcolor="#EEEEF6">
<input name="type" type="radio" value="2" checked style="background-color:#EEEEF6">
<?php
echo $lang['db_use_existence'];
?>
:
</td>
示例7: date
//note 數據庫備份文件放置路徑
$tablepre = $prefix;
//note 表前綴賦值,不同的產品請修改此表達式
$dbcharset = 'utf8';
$db->connect($db_host, $db_user, $db_pass, $db_name, $dbcharset, 0, $tablepre);
}
if ($get['method'] == 'export') {
//note 導出備份
$db->query('SET SQL_QUOTE_SHOW_CREATE=0', 'SILENT');
$time = date("Y-m-d H:i:s", $timestamp);
$tables = array();
$tables = arraykeys2(fetchtablelist($tablepre), 'Name');
if ($apptype == 'discuz') {
//note discuz的備份需要備份插件表關聯的數據
$query = $db->query("SELECT datatables FROM {$tablepre}plugins WHERE datatables<>''");
while ($plugin = $db->fetch_array($query)) {
foreach (explode(',', $plugin['datatables']) as $table) {
if ($table = trim($table)) {
$tables[] = $table;
}
}
}
}
$get['volume'] = isset($get['volume']) ? intval($get['volume']) : 0;
$get['volume'] = $get['volume'] + 1;
$version = $version ? $version : $apptype;
$idstring = '# Identify: ' . base64_encode("{$timestamp},{$version},{$apptype},multivol,{$get['volume']}") . "\n";
if (!isset($get['sqlpath']) || empty($get['sqlpath'])) {
//note 若沒有指定存放目錄,則設定存放備份數據的目錄
$get['sqlpath'] = 'backup_' . date('ymd', $timestamp) . '_' . random(6);
if (!mkdir(BACKUP_DIR . './' . $get['sqlpath'], 0777)) {
示例8: isset
CURSCRIPT == 'attachment' && isset($_GET['sid']) && ($sid = addslashes(authcode($_GET['sid'], 'DECODE', $_DCACHE['settings']['authkey'])));
$discuz_auth_key = md5($_DCACHE['settings']['authkey'] . $_SERVER['HTTP_USER_AGENT']);
list($discuz_pw, $discuz_secques, $discuz_uid) = empty($_DCOOKIE['auth']) ? array('', '', 0) : daddslashes(explode("\t", authcode($_DCOOKIE['auth'], 'DECODE')), 1);
$prompt = $sessionexists = $seccode = 0;
$membertablefields = 'm.uid AS discuz_uid, m.username AS discuz_user, m.password AS discuz_pw, m.secques AS discuz_secques,
m.adminid, m.groupid, m.groupexpiry, m.extgroupids, m.email, m.timeoffset, m.tpp, m.ppp, m.posts, m.digestposts,
m.oltime, m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5,
m.extcredits6, m.extcredits7, m.extcredits8, m.timeformat, m.dateformat, m.pmsound, m.sigstatus, m.invisible,
m.lastvisit, m.lastactivity, m.lastpost, m.prompt, m.accessmasks, m.editormode, m.customshow, m.customaddfeed';
if ($sid) {
if ($discuz_uid) {
$query = $db->query("SELECT s.sid, s.styleid, s.groupid='6' AS ipbanned, s.pageviews AS spageviews, s.lastolupdate, s.seccode, {$membertablefields}\r\n\t\t\tFROM {$tablepre}sessions s, {$tablepre}members m\r\n\t\t\tWHERE m.uid=s.uid AND s.sid='{$sid}' AND CONCAT_WS('.',s.ip1,s.ip2,s.ip3,s.ip4)='{$onlineip}' AND m.uid='{$discuz_uid}'\r\n\t\t\tAND m.password='{$discuz_pw}' AND m.secques='{$discuz_secques}'");
} else {
$query = $db->query("SELECT sid, uid AS sessionuid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate, seccode\r\n\t\t\tFROM {$tablepre}sessions WHERE sid='{$sid}' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='{$onlineip}'");
}
if ($_DSESSION = $db->fetch_array($query)) {
$sessionexists = 1;
if (!empty($_DSESSION['sessionuid'])) {
$_DSESSION = array_merge($_DSESSION, $db->fetch_first("SELECT {$membertablefields}\r\n\t\t\t\tFROM {$tablepre}members m WHERE uid='{$_DSESSION['sessionuid']}'"));
}
} else {
if ($_DSESSION = $db->fetch_first("SELECT sid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate, seccode\r\n\t\t\tFROM {$tablepre}sessions WHERE sid='{$sid}' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='{$onlineip}'")) {
clearcookies();
$sessionexists = 1;
}
}
}
if (!$sessionexists) {
if ($discuz_uid) {
if (!($_DSESSION = $db->fetch_first("SELECT {$membertablefields}, m.styleid\r\n\t\t\tFROM {$tablepre}members m WHERE m.uid='{$discuz_uid}' AND m.password='{$discuz_pw}' AND m.secques='{$discuz_secques}'"))) {
clearcookies();
示例9:
$membertablefields = 'm.uid AS discuz_uid, m.username AS discuz_user, m.password AS discuz_pw, m.secques AS discuz_secques,
m.adminid, m.groupid, m.groupexpiry, m.extgroupids, m.email, m.timeoffset, m.tpp, m.ppp, m.posts, m.threads, m.digestposts,
m.oltime, m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5,
m.extcredits6, m.extcredits7, m.extcredits8, m.timeformat, m.dateformat, m.pmsound, m.sigstatus, m.invisible,
m.lastvisit, m.lastactivity, m.lastpost, m.prompt, m.accessmasks, m.editormode, m.customshow, m.customaddfeed, m.newbietaskid';
if($sid) {
if($discuz_uid) {
$query = $db->query("SELECT s.sid, s.styleid, s.groupid='6' AS ipbanned, s.pageviews AS spageviews, s.lastolupdate, s.seccode, $membertablefields
FROM {$tablepre}sessions s, {$tablepre}members m
WHERE m.uid=s.uid AND s.sid='$sid' AND CONCAT_WS('.',s.ip1,s.ip2,s.ip3,s.ip4)='$onlineip' AND m.uid='$discuz_uid'
AND m.password='$discuz_pw' AND m.secques='$discuz_secques'");
} else {
$query = $db->query("SELECT sid, uid AS sessionuid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate, seccode
FROM {$tablepre}sessions WHERE sid='$sid' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='$onlineip'");
}
if($_DSESSION = $db->fetch_array($query)) {
$sessionexists = 1;
if(!empty($_DSESSION['sessionuid'])) {
$_DSESSION = array_merge($_DSESSION, $db->fetch_first("SELECT $membertablefields
FROM {$tablepre}members m WHERE uid='$_DSESSION[sessionuid]'"));
}
} else {
if($_DSESSION = $db->fetch_first("SELECT sid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate, seccode
FROM {$tablepre}sessions WHERE sid='$sid' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='$onlineip'")) {
clearcookies();
$sessionexists = 1;
}
}
}
if(!$sessionexists) {
示例10: sitemapforumperm
$xmlfiletime = @filemtime($sitemapfile);
header("Content-type: application/xml");
$xmlcontent = "<?xml version=\"1.0\" encoding=\"{$charset}\"?>\n" . "<document xmlns:bbs=\"http://www.baidu.com/search/bbs_sitemap.xsd\">\n";
if ($timestamp - $xmlfiletime >= $_DCACHE['settings']['baidusitemap_life'] * 3600) {
$groupid = 7;
$extgroupids = '';
$xmlfiletime = $timestamp - $_DCACHE['settings']['baidusitemap_life'] * 3600;
$fidarray = array();
foreach ($_DCACHE['forums'] as $fid => $forum) {
if (sitemapforumperm($forum)) {
$fidarray[] = $fid;
}
}
$query = $db->query("SELECT tid, fid, subject, dateline, lastpost, replies, views, digest \r\n\t\tFROM {$tablepre}threads \r\n\t\tWHERE dateline > {$xmlfiletime} AND fid IN (" . implode(',', $fidarray) . ") AND displayorder >= 0\r\n\t\tLIMIT {$maxitemnum}");
$xmlcontent .= "\t<webSite>{$boardurl}</webSite>\n" . "\t<webMaster>{$adminemail}</webMaster>\n" . "\t<updatePeri>" . $_DCACHE['settings']['baidusitemap_life'] . "</updatePeri>\n" . "\t<updatetime>" . gmdate('Y-m-d H:i:s', $timestamp + $_DCACHE['settings']['timeoffset'] * 3600) . "</updatetime>\n" . "\t<version>Discuz! {$_DCACHE['settings']['version']}</version>\n";
while ($thread = $db->fetch_array($query)) {
$xmlcontent .= "\t<item>\n" . "\t\t<link>" . (!$_DCACHE['settings']['rewritestatus'] ? "{$boardurl}viewthread.php?tid={$thread['tid']}" : "{$boardurl}thread-{$thread['tid']}-1-1.html") . "</link>\n" . "\t\t<title>" . dhtmlspecialchars($thread['subject']) . "</title>\n" . "\t\t<pubDate>" . gmdate('Y-m-d H:i:s', $thread['dateline'] + $_DCACHE['settings']['timeoffset'] * 3600) . "</pubDate>\n" . "\t\t<bbs:lastDate>" . gmdate('Y-m-d H:i:s', $thread['lastpost'] + $_DCACHE['settings']['timeoffset'] * 3600) . "</bbs:lastDate>\n" . "\t\t<bbs:reply>{$thread['replies']}</bbs:reply>\n" . "\t\t<bbs:hit>{$thread['views']}</bbs:hit>\n" . "\t\t<bbs:boardid>{$thread['fid']}</bbs:boardid>\n" . "\t\t<bbs:pick>" . (empty($thread['digest']) ? 0 : 1) . "</bbs:pick>\n" . "\t</item>\n";
}
$xmlcontent .= "</document>";
if ($fp = @fopen($sitemapfile, 'w')) {
fwrite($fp, $xmlcontent);
flock($fp, 2);
fclose($fp);
}
echo $xmlcontent;
} else {
@readfile($sitemapfile);
}
function sitemapforumperm($forum)
{
return $forum['type'] != 'group' && (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm']));
示例11: intval
require_once DISCUZ_ROOT . './forumdata/cache/style_' . intval($_DCACHE['settings']['styleid']) . '.php';
if (!$_DCACHE['settings']['rssstatus']) {
exit('RSS Disabled');
}
$ttl = $_DCACHE['settings']['rssttl'] ? $_DCACHE['settings']['rssttl'] : 30;
$num = 20;
$db = new dbstuff();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
$groupid = 7;
$discuz_uid = 0;
$discuz_user = $discuz_pw = $discuz_secques = '';
if (!empty($_GET['auth'])) {
list($uid, $fid, $auth) = explode("\t", authcode($_GET['auth'], 'DECODE', md5($_DCACHE['settings']['authkey'])));
$query = $db->query("SELECT uid AS discuz_uid, username AS discuz_user, password AS discuz_pw, secques AS discuz_secques, groupid\r\n\t\tFROM {$tablepre}members WHERE uid='" . intval($uid) . "'");
if ($member = $db->fetch_array($query)) {
if ($auth == substr(md5($member['discuz_pw'] . $member['discuz_secques']), 0, 8)) {
extract($member);
}
}
}
$PHP_SELF = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$boardurl = 'http://' . $_SERVER['HTTP_HOST'] . substr($PHP_SELF, 0, strrpos($PHP_SELF, '/') + 1);
$bbname = dhtmlspecialchars(strip_tags($_DCACHE['settings']['bbname']));
$rssfid = empty($_GET['fid']) ? 0 : intval($_GET['fid']);
$forumname = '';
if (empty($rssfid)) {
foreach ($_DCACHE['forums'] as $fid => $forum) {
if (rssforumperm($forum)) {
$fidarray[] = $fid;
}
示例12: dirname
<?php
header('Content-Type: text/html; charset=utf-8');
define('ET_ROOT', dirname(__FILE__));
define('IN_ET', TRUE);
error_reporting(7);
include ET_ROOT . "/include/db_mysql.class.php";
include ET_ROOT . '/config.inc.php';
$db = new dbstuff();
$db->connect($server, $db_username, $db_password, $db_name, $pconnect, true);
@mysql_query("set names utf8");
//更新用户关系
if ($_GET['id'] == 1) {
$db->query("TRUNCATE TABLE `et_friend`");
$queryfriend = $db->query("select * from subscription");
while ($data = $db->fetch_array($queryfriend)) {
$sql = "INSERT INTO et_friend (fid_jieshou,fid_fasong) VALUES ('" . addslashes($data['subscribed']) . "','" . $data['subscriber'] . "')";
$query = $db->query($sql);
$regid = mysql_insert_id();
}
}
//更新用户信息
if ($_GET['id'] == 2) {
$db->query("TRUNCATE TABLE `et_users`");
$queryuser = $db->query("SELECT * \n\tFROM `profile` \n\tLEFT JOIN user ON user.id = profile.id\n\tLIMIT 0 , 10000000");
while ($data = $db->fetch_array($queryuser)) {
$sqlhead = 'SELECT * FROM `avatar` WHERE `profile_id` =' . $data['id'] . ' AND `width` =96 ';
$queryhead = $db->query($sqlhead);
if ($row = $db->fetch_array($queryhead)) {
$data['user_head'] = $row['filename'];
} else {
示例13: init
function init()
{
global $gtablepre, $tablepre, $wtablepre, $room_prefix, $moveut, $moveutmin;
global ${$gtablepre . 'user'}, ${$gtablepre . 'pass'}, $___MOD_SRV;
if (isset($_COOKIE)) {
$_COOKIE = gstrfilter($_COOKIE);
foreach ($_COOKIE as $key => $value) {
if ($key == $gtablepre . 'user' || $key == $gtablepre . 'pass') {
${$key} = $value;
}
}
}
ob_clean();
ob_start();
global $db;
if (!isset($db)) {
global $dbhost, $dbuser, $dbpw, $dbname, $pconnect, $database;
require GAME_ROOT . './include/db_' . $database . '.class.php';
$db = new \dbstuff();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
//$db->select_db($dbname);
unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
}
global $___LOCAL_INPUT__VARS__INPUT_VAR_LIST;
if (isset($___LOCAL_INPUT__VARS__INPUT_VAR_LIST[$gtablepre . 'user'])) {
${$gtablepre . 'user'} = $___LOCAL_INPUT__VARS__INPUT_VAR_LIST[$gtablepre . 'user'];
}
if (isset($___LOCAL_INPUT__VARS__INPUT_VAR_LIST[$gtablepre . 'pass'])) {
${$gtablepre . 'pass'} = $___LOCAL_INPUT__VARS__INPUT_VAR_LIST[$gtablepre . 'pass'];
}
if (isset($___LOCAL_INPUT__VARS__INPUT_VAR_LIST['___GAME_ROOMID'])) {
$room_prefix = (string) $___LOCAL_INPUT__VARS__INPUT_VAR_LIST['___GAME_ROOMID'];
} else {
if (isset(${$gtablepre . 'user'})) {
$result = $db->query("SELECT roomid FROM {$gtablepre}users where username='" . ${$gtablepre . 'user'} . "'");
if ($db->num_rows($result)) {
$zz = $db->fetch_array($result);
$room_prefix = $zz['roomid'];
} else {
$room_prefix = '';
}
} else {
$room_prefix = '';
}
}
$room_status = 0;
if ($room_prefix != '' && $room_prefix != 'n' && $room_prefix[0] != 's') {
$room_prefix = '';
} else {
if ($room_prefix != '' && $room_prefix[0] == 's') {
$result = $db->query("SELECT status FROM {$gtablepre}rooms where roomid='" . substr($room_prefix, 1) . "'");
if ($db->num_rows($result)) {
$zz = $db->fetch_array($result);
$room_status = $zz['status'];
if ($zz['status'] == 0) {
$room_prefix = '';
}
} else {
$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');
//.........这里部分代码省略.........
示例14: gstrfilter
require './include/common.inc.php';
require GAME_ROOT . './include/socket.func.php';
require GAME_ROOT . './include/roommng.func.php';
require GAME_ROOT . './include/modules/core/sys/config/server.config.php';
$_COOKIE = gstrfilter($_COOKIE);
$cuser = $_COOKIE[$gtablepre . 'user'];
$cpass = $_COOKIE[$gtablepre . 'pass'];
require GAME_ROOT . './include/db_' . $database . '.class.php';
$db = new dbstuff();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
$result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='{$cuser}'");
if (!$db->num_rows($result)) {
gexit('Cookie无效。请重新登录。');
}
$udata = $db->fetch_array($result);
if ($udata['password'] != $cpass) {
gexit('Cookie无效。请重新登录。');
}
if ($udata['roomid'] == '' || $udata['roomid'][0] != 's') {
gexit('你不在一个房间内。');
}
$roomid = substr($udata['roomid'], 1);
ignore_user_abort(1);
$_POST = gstrfilter($_POST);
if (!file_exists(GAME_ROOT . './gamedata/tmp/rooms/' . $roomid . '.txt')) {
gexit('房间不存在。');
}
$result = $db->query("SELECT * FROM {$gtablepre}rooms WHERE roomid='{$roomid}'");
if (!$db->num_rows($result)) {
gexit('房间不存在。');
示例15: daddslashes
$sid = daddslashes(($transsidstatus || CURSCRIPT == 'wap') && (isset($_GET['sid']) || isset($_POST['sid'])) ? isset($_GET['sid']) ? $_GET['sid'] : $_POST['sid'] : (isset($_DCOOKIE['sid']) ? $_DCOOKIE['sid'] : ''));
$discuz_auth_key = md5($_DCACHE['settings']['authkey'] . $_SERVER['HTTP_USER_AGENT']);
list($discuz_pw, $discuz_secques, $discuz_uid) = empty($_DCOOKIE['auth']) ? array('', '', 0) : daddslashes(explode("\t", authcode($_DCOOKIE['auth'], 'DECODE')), 1);
$newpm = $newpmexists = $sessionexists = $seccode = $bloguid = 0;
$membertablefields = 'm.uid AS discuz_uid, m.username AS discuz_user, m.password AS discuz_pw, m.secques AS discuz_secques,
m.adminid, m.groupid, m.groupexpiry, m.extgroupids, m.email, m.timeoffset, m.tpp, m.ppp, m.posts, m.digestposts,
m.oltime, m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5,
m.extcredits6, m.extcredits7, m.extcredits8, m.timeformat, m.dateformat, m.pmsound, m.sigstatus, m.invisible,
m.lastvisit, m.lastactivity, m.lastpost, m.newpm, m.accessmasks, m.xspacestatus, m.editormode, m.customshow';
if ($sid) {
if ($discuz_uid) {
$query = $db->query("SELECT s.sid, s.styleid, s.groupid='6' AS ipbanned, s.pageviews AS spageviews, s.lastolupdate, s.seccode, {$membertablefields}\r\n\t\t\tFROM {$tablepre}sessions s, {$tablepre}members m\r\n\t\t\tWHERE m.uid=s.uid AND s.sid='{$sid}' AND CONCAT_WS('.',s.ip1,s.ip2,s.ip3,s.ip4)='{$onlineip}' AND m.uid='{$discuz_uid}'\r\n\t\t\tAND m.password='{$discuz_pw}' AND m.secques='{$discuz_secques}'");
} else {
$query = $db->query("SELECT sid, uid AS sessionuid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate, seccode\r\n\t\t\tFROM {$tablepre}sessions WHERE sid='{$sid}' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='{$onlineip}'");
}
if ($_DSESSION = $db->fetch_array($query)) {
$sessionexists = 1;
if (!empty($_DSESSION['sessionuid'])) {
$query = $db->query("SELECT {$membertablefields}\r\n\t\t\t\tFROM {$tablepre}members m WHERE uid='{$_DSESSION['sessionuid']}'");
$_DSESSION = array_merge($_DSESSION, $db->fetch_array($query));
}
} else {
$query = $db->query("SELECT sid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate, seccode\r\n\t\t\tFROM {$tablepre}sessions WHERE sid='{$sid}' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='{$onlineip}'");
if ($_DSESSION = $db->fetch_array($query)) {
clearcookies();
$sessionexists = 1;
}
}
}
if (!$sessionexists) {
if ($discuz_uid) {