當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。