本文整理汇总了PHP中dbstuff::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP dbstuff::connect方法的具体用法?PHP dbstuff::connect怎么用?PHP dbstuff::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbstuff
的用法示例。
在下文中一共展示了dbstuff::connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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;
}
}
}
}
}
示例3: getImCount
function getImCount()
{
$db_uch = new dbstuff();
$db_uch->charset = dbcharset;
$db_uch->connect(dbhost, dbuser, dbpw, dbname, pconnect);
$result = $db_uch->result($db_uch->query("SELECT COUNT(*) FROM " . tname("spacefield") . " WHERE qq <> ''"), 0);
return $result;
}
示例4: UcenterLogin
public function UcenterLogin($data)
{
$db = new dbstuff();
$db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, 0);
list($uid, $username, $email) = uc_get_user($data['username']);
if (is_null($uid)) {
$_data['email'] = $data['email'];
$_data['username'] = $data['username'];
$_data['password'] = $data['password'];
$_data['user_id'] = $data['user_id'];
$uid = self::UcenterReg($_data);
return self::UcenterLogin($data);
} else {
$ucsynlogin = uc_user_synlogin($uid);
}
//var_dump($uid);
return $ucsynlogin;
}
示例5: loadmultiserver
function loadmultiserver($type = '') {
global $db, $dbcharset, $multiserver;
$type = empty($type) && defined('CURSCRIPT') ? CURSCRIPT : $type;
static $sdb = null;
if($type && !empty($multiserver['enable'][$type])) {
if(!is_a($sdb, 'dbstuff')) $sdb = new dbstuff();
if($sdb->link > 0) {
return $sdb;
} elseif($sdb->link === null && (!empty($multiserver['slave']['dbhost']) || !empty($multiserver[$type]['dbhost']))) {
$setting = !empty($multiserver[$type]['host']) ? $multiserver[$type] : $multiserver['slave'];
$sdb->connect($setting['dbhost'], $setting['dbuser'], $setting['dbpw'], $setting['dbname'], $setting['pconnect'], false, $dbcharset);
if($sdb->link) {
return $sdb;
} else {
$sdb->link = -32767;
}
}
}
return $db;
}
示例6: dbstuff
{
api_msg('run_sql_error', $message . '<br /><br />' . $sql . '<br /> ' . mysql_error());
}
}
$db = new dbstuff();
$version = '';
if ($apptype == 'discuz') {
//note discuz
define('BACKUP_DIR', ROOT_PATH . 'forumdata/');
//note 數據庫備份文件放置路徑
$tablepre = $tablepre;
//note 表前綴賦值,不同的產品請修改此表達式
if (empty($dbcharset)) {
$dbcharset = in_array(strtolower($charset), array('gbk', 'big5', 'utf-8')) ? str_replace('-', '', $charset) : '';
}
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $dbcharset, $pconnect, $tablepre);
define('IN_DISCUZ', true);
include ROOT_PATH . 'discuz_version.php';
$version = DISCUZ_VERSION;
} elseif ($apptype == 'uchome' || $apptype == 'supesite' || $apptype == 'brand' || $apptype == 'other') {
//note uchome
define('BACKUP_DIR', ROOT_PATH . './data/');
//note 數據庫備份文件放置路徑
$tablepre = $_SC['tablepre'];
//note 表前綴賦值,不同的產品請修改此表達式
$dbcharset = $_SC['dbcharset'];
$db->connect($_SC['dbhost'], $_SC['dbuser'], $_SC['dbpw'], $_SC['dbname'], $dbcharset, $_SC['pconnect'], $tablepre);
} elseif ($apptype == 'ucenter') {
//note ucenter
define('BACKUP_DIR', ROOT_PATH . './data/backup/');
//note 數據庫備份文件放置路徑
示例7: array
}
$keywords['general'] = $generalnew;
$threadlist = array();
if ($relatedthreadlist) {
foreach ($relatedthreadlist as $key => $relatedthread) {
if ($relatedthread['insite'] == 1) {
$threadlist['bbsthread'][] = $relatedthread;
} elseif ($qihoo['relate']['webnum']) {
if (empty($qihoo['relate']['banurl']) || !preg_match($qihoo['relate']['banurl'], $relatedthread['tid'])) {
$threadlist['webthread'][] = $relatedthread;
}
}
}
$threadlist['bbsthread'] = $threadlist['bbsthread'] ? array_slice($threadlist['bbsthread'], 0, $qihoo['relate']['bbsnum']) : array();
$threadlist['webthread'] = $threadlist['webthread'] ? array_slice($threadlist['webthread'], 0, $qihoo['relate']['bbsnum'] - count($threadlist['bbsthread'])) : array();
$relatedthreadlist = array_merge($threadlist['bbsthread'], $threadlist['webthread']);
}
$keywords['general'] = $keywords['general'][0] ? implode("\t", $keywords['general']) : '';
$keywords['trade'] = $keywords['trade'][0] ? implode("\t", $keywords['trade']) : '';
$relatedthreads = $relatedthreadlist ? addslashes(serialize($relatedthreadlist)) : '';
$expiration = $nextuptime ? $nextuptime : $timestamp + 86400;
require_once './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);
$db->query("REPLACE INTO {$tablepre}relatedthreads (tid, type, expiration, keywords, relatedthreads)\r\n\t\tVALUES ('{$tid}', 'general', '{$expiration}', '{$keywords['general']}', '{$relatedthreads}')", 'UNBUFFERED');
if ($relatedadstatus && $keywords['trade']) {
$db->query("REPLACE INTO {$tablepre}relatedthreads (tid, type, expiration, keywords, relatedthreads)\r\n\t\t\tVALUES ('{$tid}', 'trade', '{$expiration}', '{$keywords['trade']}', '{$relatedthreads}')", 'UNBUFFERED');
}
}
示例8: explode
error_reporting(7);
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
$prev = $_SERVER['HTTP_REFERER'];
$addtime = time();
$action = $_POST['action'];
$act = $_GET['act'];
$refer = $_POST['refer'] ? $_POST['refer'] : $_GET['refer'];
//返回地址
$backto = $_POST['backto'] ? $_POST['backto'] : $_GET['backto'];
//ajax 回调
$urlrefer = $_COOKIE["urlrefer"];
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");
include ET_ROOT . "/include/template.class.php";
include ET_ROOT . '/include/etfunctions.func.php';
include ET_ROOT . '/include/cache.inc.php';
$setok = trim($_COOKIE["setok"]);
dsetcookie('setok', -1);
if (!$API) {
if (is_admin_path == "yes") {
$options = array('template_dir' => '../admin/templates', 'cache_dir' => '../admin/templates/cache', 'auto_update' => true, 'cache_lifetime' => 0);
} else {
$options = array('template_dir' => './templates', 'cache_dir' => './templates/cache', 'auto_update' => true, 'cache_lifetime' => 0);
}
$template = Template::getInstance();
$template->setOptions($options);
}
示例9: dbstuff
if (strpos($tablepre, '.') !== false) {
show_msg('tablepre_invalid', $tablepre, 0);
}
if ($username && $password) {
if (strlen($username) > 15 || preg_match("/^\$|^c:\\con\\con\$| |[,\"\\s\t\\<\\>&]|^游客|^Guest/is", $username)) {
show_msg('admin_username_invalid', $username, 0);
}
} else {
show_msg('admininfo_invalid', '', 0);
}
show_header();
$confstatus = config_edit();
if ($confstatus['status'] == 1) {
//入库
$db = new dbstuff();
$db->connect($dbhost . ":" . $dbport, $dbuser, $dbpw, $dbname, DBCHARSET);
$sqlfile = 'sql/data.sql';
$sql = file_get_contents($sqlfile);
$sql = str_replace("\r\n", "\n", $sql);
show_install();
runquery($sql);
$sqlfile = 'sql/other.sql';
$sql = file_get_contents($sqlfile);
$sql = str_replace("\r\n", "\n", $sql);
runquery($sql);
//系统设置中网站名称的修改
/**
* 转码
*/
if (strtoupper(DBCHARSET) == 'GBK') {
$username = iconv('UTF-8', 'GBK', $username);
示例10: dirname
define('IN_DISCUZ', TRUE);
define('ROOT_PATH', dirname(__FILE__) . '/../');
@(include_once ROOT_PATH . './config/config_global.php');
define('CHARSET', $_config['output']['charset']);
define('DBCHARSET', $_config['db']['1']['dbcharset']);
$lock_file = ROOT_PATH . './data/restore.lock';
if (file_exists($lock_file)) {
show_msg('restored_error');
}
require_once ROOT_PATH . './source/discuz_version.php';
$operation = trim(getgpc('operation', 'G'));
$operation = $operation ? $operation : 'import';
$phpself = htmlspecialchars($_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF']);
$siteurl = htmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api)?\\/*\$/i", '', substr($phpself, 0, strrpos($phpself, '/'))) . '/');
$db = new dbstuff();
if (!@$db->connect($_config['db']['1']['dbhost'], $_config['db']['1']['dbuser'], $_config['db']['1']['dbpw'], $_config['db']['1']['dbname'], $_config['db']['1']['dbcharset'])) {
show_msg('connect_error');
}
if ($operation == 'import') {
if (!submitcheck('importsubmit', 1)) {
$exportlog = $exportsize = $exportziplog = array();
check_exportfile($exportlog, $exportziplog, $exportsize);
if (empty($exportlog) && empty($exportziplog)) {
show_msg('backup_file_unexist');
}
show_importfile_list($exportlog, $exportziplog, $exportsize);
} else {
$readerror = 0;
$datafile_vol1 = trim(getgpc('datafile_vol1'));
if ($datafile_vol1) {
$datafile = $datafile_vol1;
示例11: update_db
}
define('DBCHARSET', $dbcharset);
define('SiteUrl', $site_url);
if ($version != '20130705') {
@header("Content-type: text/html; charset=UTF-8");
echo "已经安装完成或版本错误,本程序只适用于“ShopNC 2.4”的系统。";
exit;
}
$db = new dbstuff();
if (strtoupper(DBCHARSET) == 'GBK') {
$dbcharset = 'gbk';
} else {
$dbcharset = 'utf8';
}
$dbserver = $dbserver . ":" . $dbserver_port;
$db->connect($dbserver, $dbuser, $dbpasswd, $dbname, $dbcharset);
$tablepre = $db_pre;
$current = $_GET['act'];
if (is_file('../config.ini.php') && $current != '2') {
@header("Content-type: text/html; charset=UTF-8");
echo "您已经安装过微商城模块。";
exit;
}
//新增表
function update_db()
{
if (strtoupper(DBCHARSET) == 'GBK') {
$sqlfile = 'gbk.sql';
} else {
$sqlfile = 'utf8.sql';
}
示例12: __autoload
<?php
error_reporting(0);
ini_set("magic_quotes_runtime", 0);
define('IN_VWS', TRUE);
define('VWS_ROOT', substr(dirname(__FILE__), 0, -3));
function __autoload($className)
{
if (preg_match('#Core$#', $className) && file_exists($classPath = VWS_ROOT . "/core/{$className}.php")) {
include_once $classPath;
}
}
include_once VWS_ROOT . '/core/DBCore.php';
include_once VWS_ROOT . '/core/DictCore.php';
include_once 'config.inc.php';
$db = new dbstuff();
$db->connect($dbhost, $dbuser, $dbpassword, $dbname);
示例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: dbstuff
<?php
include_once './common.php';
include_once './class/db_mysql.class.php';
@(include_once './uc_client/client.php');
$devdb = new dbstuff();
$devdb->charset = 'utf8';
$devdb->connect('200.200.0.24', 'root', 'pr', 'sangfordedecmsv56utf', 0);
$catemap = array('技术支持' => array('id' => '196', 'type' => 'rdp'), '预研技能' => array('id' => '195', 'type' => 'rdp'), '测试技能' => array('id' => '194', 'type' => 'rdp'), '编码技能' => array('id' => '193', 'type' => 'rdp'), '设计技能' => array('id' => '193', 'type' => 'rdp'), '项目管理' => array('id' => '191', 'type' => 'rdp'), '产品规划' => array('id' => '190', 'type' => 'rdp'), 'C/C++编程' => array('id' => '197', 'type' => 'devtech'), '工具使用' => array('id' => '202', 'type' => 'devtech'), 'Windows开发' => array('id' => '200', 'type' => 'devtech'), 'Linux内核驱动' => array('id' => '199', 'type' => 'devtech'), 'Linux开发' => array('id' => '198', 'type' => 'devtech'), '调试技术' => array('id' => '201', 'type' => 'devtech'), '数据库' => array('id' => '203', 'type' => 'devtech'), '算法设计' => array('id' => '204', 'type' => 'devtech'), '协议分析' => array('id' => '205', 'type' => 'devtech'), '网络编程' => array('id' => '206', 'type' => 'devtech'), '性能优化' => array('id' => '207', 'type' => 'devtech'), '手机开发' => array('id' => '208', 'type' => 'devtech'), 'AC' => array('id' => '52', 'type' => 'modules'), 'WOC' => array('id' => '58', 'type' => 'modules'), '其他' => array('id' => '52', 'type' => 'modules'), '知识管理' => array('id' => '191', 'type' => 'rdp'), '常用命令' => array('id' => '198', 'type' => 'devtech'), '应用识别' => array('id' => '52', 'type' => 'modules'), '版本经理' => array('id' => '191', 'type' => 'rdp'), '用户认证' => array('id' => '52', 'type' => 'modules'), '企业文化' => array('id' => '1', 'type' => 'news'), '研发规范' => array('id' => '192', 'type' => 'rdp'), '开发工具' => array('id' => '202', 'type' => 'devtech'), '开发流程' => array('id' => '192', 'type' => 'rdp'), '部门风采' => array('id' => '1', 'type' => 'news'), 'SSL' => array('id' => '56', 'type' => 'modules'));
$reg_msg = array('-1' => '用户名非法', '-2' => '注册信息包括不允许的词', '-3' => '用户名已存在', '-4' => 'Email地址格式非法', '-5' => 'Email地址没有注册', '-6' => 'Email地址已被注册');
$cnt = 0;
$sqlstr = 'SELECT * FROM dede_member';
$query = $devdb->query($sqlstr);
while ($user = $devdb->fetch_array($query)) {
//用户处理
echo '<br />处理用户:' . $user['userid'] . '...';
$newuid = uc_user_register($user['userid'], $user['pwd'], $user['email']);
if ($newuid <= 0) {
if ($newuid == -3) {
echo '用户已存在,用户ID为:';
list($newuid, $username, $email) = uc_get_user($user['userid']);
echo $newuid . ' 原用户ID为:' . $user['mid'] . '<br />';
} else {
echo '<font color="red">注册用户失败:' . $reg_msg[$newuid] . ',跳过...</font><br />';
$sqlstr0 = "SELECT * FROM dede_archives WHERE mid='" . $user['mid'] . "'";
$query0 = $devdb->query($sqlstr0);
while ($res0 = $devdb->fetch_array($query0)) {
echo '其发表文章:' . $res0['title'] . '<br />';
}
continue;
}
} else {
示例15: query
function query($sql, $type = '')
{
if (preg_match("/^\\s*[Ss][Ee][Ll][Ee][Cc][Tt]/", $sql)) {
return $this->rdb->query($sql, $type);
}
if (!$this->writeable) {
dbstuff::connect($this->dbhost, $this->dbuser, $this->dbpw, $this->dbname, $this->pconnect, $this->halt);
$this->writeable = true;
}
return dbstuff::query($sql, $type);
}