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


PHP dbstuff类代码示例

本文整理汇总了PHP中dbstuff的典型用法代码示例。如果您正苦于以下问题:PHP dbstuff类的具体用法?PHP dbstuff怎么用?PHP dbstuff使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了dbstuff类的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;
                 }
             }
         }
     }
 }
开发者ID:shuai959980629,项目名称:TTDV1,代码行数:35,代码来源:Dcredit_model.php

示例2: 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;
}
开发者ID:BGCX261,项目名称:ziuziu-cn-svn-to-git,代码行数:8,代码来源:doing.php

示例3: 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;
 }
开发者ID:shuai959980629,项目名称:TTDV1,代码行数:18,代码来源:Ucenter_model.php

示例4: 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;
	}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:20,代码来源:index.php

示例5: 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);
}
开发者ID:winddramon,项目名称:dts,代码行数:29,代码来源:modulemng.php

示例6: define

    $db_pre = $config['tablepre'];
    $dbuser = $config['db'][1]['dbuser'];
    $dbpasswd = $config['db'][1]['dbpwd'];
    $file_expire = $config['session_expire'];
    $lang_type = $config['lang_type'];
    $cookie_pre = $config['cookie_pre'];
    $tpl_name = $config['tpl_name'];
}
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;
}
//新增表
开发者ID:hyperbolaa,项目名称:shopnc,代码行数:31,代码来源:index.php

示例7: error_reporting

<?php

error_reporting(7);
define('IN_ET', TRUE);
include '../include/etfunctions.func.php';
include '../include/db_mysql.class.php';
include '../config.inc.php';
$db = new dbstuff();
$db->connect($server, $db_username, $db_password, $db_name, $pconnect, true);
@mysql_query("set names utf8");
include 'include/global.func.php';
//if(preg_match('/(mozilla|m3gate|winwap|openwave|Opera)/i', $_SERVER['HTTP_USER_AGENT']) && !preg_match('/(SymbianOS)/i', $_SERVER['HTTP_USER_AGENT'])) {
//	header("Location: ../index.php");
//}
$op = $_GET['op'] ? $_GET['op'] : "index";
$addtime = time();
$action = $_POST['action'];
$act = $_GET['act'];
$page = $_GET['page'] ? $_GET['page'] : 1;
//login
$ulmtem = explode("\t", authcode($_COOKIE["wapcookie"], 'DECODE'));
if ($ulmtem) {
    $query = $db->query("SELECT user_id,user_name,nickname,user_head FROM et_users where user_id='{$ulmtem['0']}' && password='{$ulmtem['1']}'");
    $user = $db->fetch_array($query);
    $user['user_head'] = $user['user_head'] ? "{$webaddr}/attachments/head/" . $user['user_head'] : "{$webaddr}/images/noavatar.jpg";
}
if (!$user['user_id']) {
    $head = "EasyTalk微博客 随时随地";
} else {
    $head = "欢迎您," . $user['nickname'];
}
开发者ID:kbglobal51,项目名称:yii-trackstar-sample,代码行数:31,代码来源:index.php

示例8: dbstuff

            <hr noshade align="center" width="100%" size="1">
          </td>
        </tr>
        <tr>
          <td><b><font color="#FF0000">&gt;</font><font color="#000000"> <?php 
    echo $lang['select_db'];
    ?>
</font></b></td>
        </tr>
<?php 
    include './config.inc.php';
    if (empty($dbcharset) && ($charset == 'gbk' || $charset == 'big5')) {
        $dbcharset = $charset;
    }
    include './include/db_' . $database . '.class.php';
    $db = new dbstuff();
    $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    $db->select_db($dbname);
    echo "        <tr>\n";
    echo "          <td>{$lang['select_db']} {$dbname} " . result(1, 0) . "</td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td>\n";
    echo "            <hr noshade align=\"center\" width=\"100%\" size=\"1\">\n";
    echo "          </td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td><b><font color=\"#FF0000\">&gt;</font><font color=\"#000000\"> {$lang['create_table']}</font></b></td>\n";
    echo "        </tr>\n";
    echo "        <tr>\n";
    echo "          <td>\n";
开发者ID:winddramon,项目名称:dts,代码行数:31,代码来源:install.php

示例9: define

@set_magic_quotes_runtime(0);
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) {
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:restore.php

示例10: exit

    $db->query("UPDATE {$tablepre}members SET username='{$usernamenew}' WHERE uid='{$uid}'");
    exit(API_RETURN_SUCCEED);
} elseif ($action == 'updatepw') {
    !API_UPDATEPW && exit(API_RETURN_FORBIDDEN);
    //更改用户密码
    exit(API_RETURN_SUCCEED);
} elseif ($action == 'gettag') {
    !API_GETTAG && exit(API_RETURN_FORBIDDEN);
    //获取标签 API 接口
    $return = array($name, array());
    echo uc_serialize($return, 1);
} elseif ($action == 'synlogin' && $_GET['time'] == $get['time']) {
    !API_SYNLOGIN && exit(API_RETURN_FORBIDDEN);
    //同步登录 API 接口
    include './include/db_mysql.class.php';
    $db = new dbstuff();
    $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    $uid = intval($get['uid']);
    $query = $db->query("SELECT uid, username FROM {$tablepre}members WHERE uid='{$uid}'");
    if ($member = $db->fetch_array($query)) {
        header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
        dsetcookie('Example_auth', authcode($member['uid'] . "\t" . $member['username'], 'ENCODE'), 86400 * 365);
    }
} elseif ($action == 'synlogout') {
    !API_SYNLOGOUT && exit(API_RETURN_FORBIDDEN);
    //同步登出 API 接口
    header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
    dsetcookie('Example_auth', '', -86400 * 365);
} elseif ($action == 'updatebadwords') {
    !API_UPDATEBADWORDS && exit(API_RETURN_FORBIDDEN);
开发者ID:ablozhou,项目名称:hairnet,代码行数:31,代码来源:uc.php

示例11: dbstuff

<?php

/**
 * UCenter 应用程序开发 Example
 *
 * 应用程序有自己的用户表,用户登录的 Example 代码
 * 使用到的接口函数:
 * uc_user_login()	必须,判断登录用户的有效性
 * uc_authcode()	可选,借用用户中心的函数加解密激活字串和 Cookie
 * uc_user_synlogin()	可选,生成同步登录的代码
 */
include '../config.inc.php';
include '../include/db_mysql.class.php';
$db = new dbstuff();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
include '../cta_client/client.php';
if (!empty($_GET['submit'])) {
    if (stripos($_POST['username'], "@")) {
        list($uid, $username, $password, $email) = uc_user_login($_POST['username'], $_POST['password'], 2);
    } else {
        //通过接口判断登录帐号的正确性,返回值为数组
        list($uid, $username, $password, $email) = uc_user_login($_POST['username'], $_POST['password']);
    }
    setcookie('Cta_auth', '', -86400);
    if ($uid > 0) {
        if (!$db->result_first("SELECT count(*) FROM {$tablepre}members WHERE uid='{$uid}'")) {
            //判断用户是否存在于用户表,不存在则跳转到激活页面
            $auth = rawurlencode(uc_authcode("{$username}\t" . time(), 'ENCODE'));
            echo '您需要需要激活该帐号,才能进入本应用程序<br><a href="' . $_SERVER['PHP_SELF'] . '?fun=register&action=activation&auth=' . $auth . '">继续</a>';
            exit;
开发者ID:kiah2008,项目名称:coordinate-talk.website,代码行数:31,代码来源:login_db.php

示例12: define

<?php

define('IN_DISCUZ', true);
include_once '../../config.inc.php';
require_once '../../include/global.func.php';
require_once '../../include/db_' . $database . '.class.php';
$uid = $_GET['uid'];
$buyer = $_GET['buyer'];
$price = $_GET['price'];
$amount = $_GET['amount'];
$orderid = $_GET['orderid'];
$submitdate = $_GET['submitdate'];
$db = new dbstuff();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);
$db->select_db($dbname);
$settings = array();
$query = $db->query("SELECT * FROM {$tablepre}settings");
while ($setting = $db->fetch_array($query)) {
    $settings[$setting['variable']] = $setting['value'];
}
$settings['creditstrans'] = explode(',', $settings['creditstrans']);
$extcredits = $settings['creditstrans'][0];
updatecredits($uid, array($extcredits => $amount));
$timestamp = time();
$db->query("INSERT INTO {$tablepre}creditslog (uid, fromto, sendcredits, receivecredits, send, receive, dateline, operation)VALUES ({$uid}, '{$buyer}', 0, {$extcredits}, 0, {$amount}, {$timestamp}, 'AFD')");
$db->query("UPDATE {$tablepre}orders SET status = '2', confirmdate = {$timestamp} WHERE orderid = '{$orderid}'");
开发者ID:aaron1102,项目名称:ecbank,代码行数:26,代码来源:greenworld.func.php

示例13: show_msg

 }
 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') {
开发者ID:liuguogen,项目名称:weixin,代码行数:31,代码来源:index.php

示例14: explode

        exit;
    }
    $t = explode("@", $mailadres);
    if (!$t[1]) {
        echo "<script>alert('电子邮件格式不正确!');history.go(-1);</script>";
        exit;
    }
    if ($password1 != $password2) {
        echo "<script>alert('两次输入的密码不正确!');history.go(-1);</script>";
        exit;
    }
    if ($password1 == $password2 && $_POST['password1']) {
        $web_name3 = "EasyTalk 安装";
        include $template->getfile('install.htm');
        include '../config.inc.php';
        $sql = file_get_contents($sqlfile);
        $db = new dbstuff();
        $db->connect($server, $db_username, $db_password, $db_name, $pconnect, true);
        @mysql_query("set names utf8");
        runquery($sql);
        $db->query("INSERT INTO et_users (user_name,nickname,password,mailadres,signupdate,isadmin) VALUES ('{$username}','{$nickname}','{$password2}','{$mailadres}','{$addtime}','1')");
        @touch($lockfile);
        exit;
    } else {
        echo "<script>alert('密码输入不正确,请重新输入!');history.go(-1);</script>";
        exit;
    }
}
//模板和Foot
$web_name3 = "EasyTalk 安装";
include $template->getfile('install.htm');
开发者ID:kbglobal51,项目名称:yii-trackstar-sample,代码行数:31,代码来源:install.php

示例15: isset

$iscompact = isset($_GET["compact"]) ? $_GET["compact"] == '1' : false;
// 检测是否所有数据客户端都发送了
if (!isset($_GET["port"]) || !isset($_GET["downloaded"]) || !isset($_GET["uploaded"]) || !isset($_GET["left"])) {
    show_error("BT客户端发送了错误的数据。");
}
$downloaded = (double) $_GET["downloaded"];
$uploaded = (double) $_GET["uploaded"];
$left = (double) $_GET["left"];
$port = $_GET["port"];
$ip = getip();
$pid = AddSlashes(StripSlashes($pid));
if ($pid == "" || !$pid) {
    show_error("请重新下载种子,种子的tracker是不合法的。");
}
// connect to db 连接数据库
$db = new dbstuff();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
// connection is done ok 连接完成
$agent = mysql_real_escape_string($_SERVER["HTTP_USER_AGENT"]);
$respid = $db->query("SELECT pid,uid FROM {$tablepre}xbtit_users  WHERE pid='" . $pid . "' LIMIT 1");
if (!$respid || mysql_num_rows($respid) != 1) {
    show_error("错误的pid值,用户不存在。请重新下载。");
}
$rowpid = mysql_fetch_assoc($respid);
$pid = $rowpid["pid"];
$uid = $rowpid["uid"];
$res_tor = $db->query("SELECT * FROM {$tablepre}xbtit_files WHERE info_hash='" . $info_hash . "' limit 1");
if (mysql_num_rows($res_tor) == 0) {
    show_error("种子还未上传到服务器,请到论坛重新上传。");
    //种子不在服务器上面
} else {
开发者ID:zzszms,项目名称:sikemi,代码行数:31,代码来源:announce.php


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