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


PHP dbconn函数代码示例

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


在下文中一共展示了dbconn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setPasskey

function setPasskey($name)
{
    /*
    $dbconnnexus=mysql_connect("localhost", "root", "buptnic");
    if (!$dbconnnexus){
       die('Could not connect');
    }
    mysql_query("SET NAMES UTF8");
    mysql_select_db("nexusphp",$dbconnnexus);
    */
    require_once "include/bittorrent.php";
    dbconn(true);
    $result = mysql_query("SELECT * FROM users WHERE username = '{$name}'", $dbconnnexus);
    while ($info = mysql_fetch_assoc($result)) {
        $passkeyvalue = $info["passkey"];
        $passhash = $info["passhash"];
        //echo "</br>passhash is this: ".$passhash;
        //echo "</br>passkeyvalue is this: ".$passkeyvalue;
    }
    if (!$passkeyvalue) {
        $passkey = md5($name . date("Y-m-d H:i:s") . $passhash);
        mysql_query("UPDATE users SET passkey = '{$passkey}' WHERE username = '{$name}'");
    } else {
        return $passkeyvalue;
    }
    //mysql_close($dbconnnexus);
    return $passkey;
}
开发者ID:skygunner,项目名称:nexusphp_v1.5_play,代码行数:28,代码来源:passenger.php

示例2: activate

 public static function activate($username, $password, $email)
 {
     dbconn();
     $secret = mksecret();
     $wantpasshash = md5($secret . $password . $secret);
     $query = "INSERT INTO users (username, passhash, secret, editsecret, email, country, gender, status, class, invites, " . ($type == 'invite' ? "invited_by," : "") . " added, last_access, lang, stylesheet" . ", uploaded) VALUES \n            ('" . $username . "','" . $wantpasshash . "','" . $secret . "','" . ' ' . "','" . "{$email}" . "'," . '8' . ",'" . 'N/A' . "', 'confirmed', " . '1' . "," . 0 . ", " . ($type == 'invite' ? "'{$inviter}'," : "") . " '" . date("Y-m-d H:i:s") . "' , " . " '" . date("Y-m-d H:i:s") . "' , " . '25' . "," . '3' . "," . '0' . ")";
     print $query;
     $ret = sql_query($query) or sqlerr(__FILE__, __LINE__);
 }
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:9,代码来源:activate.php

示例3: crk

function crk($l)
{
    global $CURUSER, $btit_settings;
    $xip = $_SERVER["REMOTE_ADDRESS"];
    if (function_exists("dbconn")) {
        dbconn();
    }
    if (function_exists("write_log")) {
        write_log('Hacking Attempt! User: <a href="' . $btit_settings['url'] . '/index.php?page=userdetails&amp;id=' . $CURUSER['uid'] . '">' . $CURUSER['username'] . '</a> IP:' . $xip . ' - Attempt: ' . htmlspecialchars($l));
    }
    header('Location: index.php');
    die;
}
开发者ID:wilian32,项目名称:xbtit,代码行数:13,代码来源:crk_protection.php

示例4: crk

function crk($l)
{
    global $BASEURL;
    $xip = vars::$realip;
    if (function_exists("dbconn")) {
        dbconn();
    }
    if (function_exists("write_log")) {
        write_log('Hacking Attempt! User: <a href="' . $BASEURL . '/userdetails.php?id=' . user::$current['uid'] . '">' . user::$current['username'] . '</a> IP:' . $xip . ' - Attempt: ' . htmlspecialchars($l) . ', INFO');
    }
    header('Location: index.php');
    die;
}
开发者ID:HDVinnie,项目名称:BtiTracker-1.5.0,代码行数:13,代码来源:crk_protection.php

示例5: UserAuthorize

/**
 * Авторизация пользователя и формирование http://bx.ecklos.ru/данных в массив
 */
function UserAuthorize()
{
    if (isset($_COOKIE['user_id']) && isset($_COOKIE['user_hash'])) {
        $auth_err = 0;
        $user_id = ClearValueIntval($_COOKIE['user_id']);
        $user_hash = ClearValueString($_COOKIE['user_hash'], 32, true);
        if ($user_id >= 1) {
            $auth_err++;
        } elseif (strlen($user_hash) != 32 || !ctype_alnum($user_hash)) {
            // Хеш строго из 32х знаков и только латиница-цифры
            $auth_err++;
        }
        if ($auth_err > 0) {
            $conn = dbconn('b_users');
            // Подключаемся к шарду, на котором находиться таблица
            if ($conn) {
                $query = 'SELECT `LOGIN`, `TYPE` FROM `b_users` WHERE `ID` = ' . $user_id . ' AND `HASH` = "' . _in_base($user_hash) . '"';
                if ($result = $conn->query($query)) {
                    if ($result->num_rows == 1) {
                        if ($arUser = $result->fetch_array(MYSQLI_ASSOC)) {
                            $_SESSION["SESS_AUTH"]["AUTHORIZED"] = "Y";
                            $_SESSION["SESS_AUTH"]["USER_ID"] = $user_id;
                            $_SESSION["SESS_AUTH"]["USER_LOGIN"] = $arUser['LOGIN'];
                            $_SESSION["SESS_AUTH"]["USER_TYPE"] = $arUser['TYPE'];
                            return true;
                        }
                    }
                }
            } else {
                header('Location: /update/');
            }
        }
        UserLogout();
    }
    return false;
}
开发者ID:bossit,项目名称:php.system.orders,代码行数:39,代码来源:functions.user.php

示例6: unset

$db_road_front = "RoadFrontage";
$db_units = "TotalUnits";
$db_total_sqft = "SqFtTotal";
$db_asset_sales = "AssetSales";
$prev_prop_type = 'Residential';
/* Clear certain variables */
unset($str_url_vars);
$str_url_var_num = 0;
unset($where_clause);
$where_clause_num = 0;
unset($order_clause);
$order_clause_num = 0;
unset($order_clause_res);
$order_clause_res_num = 0;
// Connect to the Db
$dbcnx = dbconn($db_host, $db_username, $db_password, $db_name);
/* Check for variables */
if (empty($agent_id) && empty($firm_id) && empty($display_agent) && empty($display_firm)) {
    $err_msg .= "<span class='err_msg'>No Firm or Agent selected.</span>\n";
    $exit = 1;
} else {
    /* Verify agent is allowed to use our system */
    include 'allow_firms.php';
    include 'allow_agents.php';
    if (!stristr($allow_agents, $agent_id) && !stristr($allow_agents, $display_agent) && !stristr($allow_firms, $firm_id) && !stristr($allow_firms, $display_firm)) {
        $err_msg .= "<span class='err_msg'>We are sorry, but this website is not authorized to use this feature.</span>\n";
        $exit = 1;
    }
}
if (empty($show) || $show == 'all') {
    $show = "residential,vacant land,multires,commercial,business op";
开发者ID:jasmith152,项目名称:MLS_Marion,代码行数:31,代码来源:listings_11-30-13.php

示例7: p

    p($dbform);
    makehide('tablename');
    makehide('page', $page);
    makehide('doing');
    p('</form>');
    $cachetables = array();
    $pagenum = 30;
    $page = intval($page);
    if ($page) {
        $start_limit = ($page - 1) * $pagenum;
    } else {
        $start_limit = 0;
        $page = 1;
    }
    if (isset($dbhost) && isset($dbuser) && isset($dbpass) && isset($connect)) {
        $lnk = dbconn($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport);
        $mysqlver = mysql_get_server_info();
        p('<form id="setdbname" method="post" action="' . $self . '">
	<p>MySQL ' . $mysqlver . ' running in ' . $dbhost . ' as ' . $dbuser . '@' . $dbhost . '</p>');
        $highver = $mysqlver > '4.1' ? 1 : 0;
        $query = q("SHOW DATABASES");
        $dbs = array();
        $dbs[] = '-- Select a database --';
        while ($db = mysql_fetch_array($query)) {
            $dbs[$db['Database']] = $db['Database'];
        }
        makeselect(array('title' => 'Please select a database:', 'name' => 'db[]', 'option' => $dbs, 'selected' => $dbname, 'onchange' => 'moddbname(this.options[this.selectedIndex].value)', 'newline' => 1));
        p('</form>');
        $tabledb = array();
        if ($dbname) {
            p('<p>');
开发者ID:huntergregal,项目名称:tools,代码行数:31,代码来源:godshell.php

示例8: rpc_return_quarantined_file

function rpc_return_quarantined_file($msg)
{
    global $xmlrpcerruser;
    dbconn();
    $input = php_xmlrpc_decode(array_shift($msg->params));
    $input = preg_replace('[\\.\\/|\\.\\.\\/]', '', $input);
    $date = @mysql_result(dbquery("SELECT DATE_FORMAT(date,'%Y%m%d') FROM maillog where id='" . mysql_real_escape_string($input) . "'"), 0);
    $qdir = get_conf_var('QuarantineDir');
    $file = null;
    switch (true) {
        case file_exists($qdir . '/' . $date . '/nonspam/' . $input):
            $file = $date . '/nonspam/' . $input;
            break;
        case file_exists($qdir . '/' . $date . '/spam/' . $input):
            $file = $date . '/spam/' . $input;
            break;
        case file_exists($qdir . '/' . $date . '/mcp/' . $input):
            $file = $date . '/mcp/' . $input;
            break;
        case file_exists($qdir . '/' . $date . '/' . $input . '/message'):
            $file = $date . '/' . $input . '/message';
            break;
    }
    $quarantinedir = get_conf_var('QuarantineDir');
    switch (true) {
        case !is_string($file):
            return new xmlrpcresp(0, $xmlrpcerruser + 1, "Parameter type " . gettype($file) . " mismatch expected type.");
        case !is_file($quarantinedir . '/' . $file):
            return new xmlrpcresp(0, $xmlrpcerruser + 1, "{$quarantinedir}/{$file} is not a file.");
        case !is_readable($quarantinedir . '/' . $file):
            return new xmlrpcresp(0, $xmlrpcerruser + 1, "{$quarantinedir}/{$file}: permission denied.");
        default:
            $output = base64_encode(file_get_contents($quarantinedir . '/' . $file));
            break;
    }
    return new xmlrpcresp(new xmlrpcval($output, 'base64'));
}
开发者ID:thctlo,项目名称:1.2.0,代码行数:37,代码来源:rpcserver.php

示例9: dbconn

<?php

include "lib.php";
$connect = dbconn();
$user_id = trim($user_id);
$password = trim($password);
if (!$user_id) {
    Error("Please input ID");
}
if (!$password) {
    Error("Please input Password");
}
if ($id) {
    $setup = get_table_attrib($id);
    $group = group_info($setup[group_no]);
}
if ($setup[group_no]) {
    $group_no = $setup[group_no];
}
// 회원 로그인 체크
$result = mysql_query("select * from {$member_table} where user_id='{$user_id}' and password=password('{$password}')") or error(mysql_error());
$member_data = mysql_fetch_array($result);
// 회원로그인이 성공하였을 경우 세션을 생성하고 페이지를 이동함
if ($member_data[no]) {
    if ($auto_login) {
        makeZBSessionID($member_data[no]);
    }
    // 4.0x 용 세션 처리
    $zb_logged_no = $member_data[no];
    $zb_logged_time = time();
    $zb_logged_ip = $REMOTE_ADDR;
开发者ID:kkskipper,项目名称:KNOWME,代码行数:31,代码来源:login_check.php

示例10: NewOrder

/**
 * Создание нового заказа
 * Возвращается код добавленного заказа или false в случае ошибки.
 */
function NewOrder($arParams)
{
    if (is_array($arParams) && UserGetType() == 'C') {
        $name = ClearValueString($arParams['order_name'], 120);
        $text = ClearValueString($arParams['order_text']);
        $price = ClearValueIntval($arParams['order_price'], array('min' => 500, 'max' => 999999));
        if (strlen($name) > 0 && strlen($text) > 0 && !is_null($price)) {
            $tax_value = GetTaxValue();
            $tax_price = GetTaxPrice($price);
            $conn = dbconn('b_orders');
            // Подключаемся к шарду, на котором находиться таблица
            if ($conn) {
                $query = 'INSERT INTO `b_orders`
                    (`ID`, `DATE_INSERT`, `NAME`, `DESCRIPTION`, `PRICE`, `TAX_VALUE`, `TAX_PRICE`, `CUSTOMER_ID`)
                    VALUES
                    (NULL, NOW(), "' . _in_base($name) . '", "' . _in_base($text) . '", ' . $price . ', ' . $tax_value . ',
                    ' . $tax_price . ', ' . UserGetID() . ')';
                if ($conn->query($query)) {
                    return $conn->insert_id;
                } else {
                    return $conn->erorr;
                }
            } else {
                return 'DB_CONNECT_ERROR';
            }
        }
    }
    return false;
}
开发者ID:bossit,项目名称:php.system.orders,代码行数:33,代码来源:functions.order.php

示例11: header

<?php

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-store, must-revalidate");
header("Pragma: no-cache");
require_once "../donate/globle.php";
function dbconn($host, $user, $pwd, $db)
{
    $conn = mysql_connect($host, $user, $pwd) or die("数据库连接错误!");
    mysql_select_db($db) or die("无此数据库!");
    mysql_query("set names utf8;");
}
if (!dbconn(Host, Username, Password, Select_db)) {
    //echo "数据库连接成功!<br />" ;
} else {
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>云主机代购查询续费 - 章郎主机</title>
</head>
<body>
<br/><br/>
	<div class="framecenter margintop10">
		<div class="pagecontent margintleft10" style="width:500px;margin-left:auto;margin-right:auto;margin-top:20px;">
			<div class="pagecontentstr">
				<div class="righttext center lineheight200">
					<h3>您的查询结果如下</h3>
开发者ID:zhangnq,项目名称:hostPanel,代码行数:31,代码来源:IPInfo.php

示例12: api_initDb

function api_initDb()
{
    $db = mparam("db");
    $dbcred = mparam("dbcred");
    $cfgonly = (int) param("cfgonly", 0);
    if (!$cfgonly) {
        $dbcred0 = mparam("dbcred0");
        $dbcred_ro = param("dbcred_ro");
    }
    $urlPath = mparam("urlPath");
    if (!preg_match('/^(.*?)\\/(\\w+)$/', $db, $ms)) {
        die("数据库指定错误: `{$db}`");
    }
    $dbhost = $ms[1];
    $dbname = $ms[2];
    if (!$cfgonly) {
        list($dbuser0, $dbpwd0) = explode(":", $dbcred0);
        if (!$dbuser0 || !isset($dbpwd0)) {
            die("数据库管理员用户名密码指定错误: `{$dbcred0}`");
        }
        list($dbuser, $dbpwd) = explode(":", $dbcred);
        if (!$dbuser || !isset($dbpwd)) {
            die("应用程序使用的数据库用户名密码指定错误: `{$dbcred}`");
        }
        if ($dbcred_ro) {
            list($dbuser_ro, $dbpwd_ro) = explode(":", $dbcred_ro);
        }
        $dbh = dbconn($dbhost, null, $dbuser0, $dbpwd0);
        try {
            $dbh->exec("use {$dbname}");
            echo "=== 数据库`{$dbname}`已存在。\n";
        } catch (Exception $e) {
            echo "=== 创建数据库: {$dbname}\n";
            try {
                $dbh->exec("create database {$dbname}");
            } catch (Exception $e) {
                die("*** 用户`{$dbuser0}`无法创建数据库!\n");
            }
            $dbh->exec("use {$dbname}");
        }
        echo "=== 设置用户权限: {$dbuser}\n";
        try {
            $str = $dbpwd ? " identified by '{$dbpwd}'" : "";
            $sql = "grant all on {$dbname}.* to {$dbuser}@localhost {$str}";
            $dbh->exec($sql);
            $sql = "grant all on {$dbname}.* to {$dbuser}@'%' {$str}";
            $dbh->exec($sql);
        } catch (Exception $e) {
            die("*** 用户`{$dbuser0}`无法设置用户权限!\n");
        }
        if ($dbcred_ro) {
            echo "=== 设置只读用户权限: {$dbuser_ro}\n";
            $str = $dbpwd_ro ? " identified by '{$dbpwd_ro}'" : "";
            $sql = "grant select, lock tables, show view on {$dbname}.* to {$dbuser_ro} {$str}";
            $dbh->exec($sql);
            $sql = "grant select on mysql.* to {$dbuser_ro}";
            $dbh->exec($sql);
            $sql = "grant reload, replication client, replication slave on *.* to {$dbuser_ro}";
            $dbh->exec($sql);
        }
    }
    echo "=== 写配置文件 " . CONF_FILE . "\n";
    $dbcred_b64 = base64_encode($dbcred);
    $adminCred = base64_encode(param("adminCred", ""));
    $str = <<<EOL
<?php

if (getenv("P_DB") === false) {
\tputenv("P_DB={$db}");
\tputenv("P_DBCRED={$dbcred_b64}");
}
putenv("P_URL_PATH={$urlPath}");
putenv("P_ADMIN_CRED={$adminCred}");
EOL;
    file_put_contents(CONF_FILE, $str);
    echo "=== 完成! 请使用upgrade命令行工具更新数据库。\n";
}
开发者ID:skyshore2001,项目名称:JDCloud,代码行数:77,代码来源:init.php

示例13: isset

<?php

# Use the link format below: add a month and a year
# http://localhost/payroll/ws.php?month=?&year=?
require_once 'payroll.php';
$wsMonth = isset($_GET['month']) ? intval($_GET['month']) : '';
$wsYear = isset($_GET['year']) ? intval($_GET['year']) : '';
if ($wsMonth && $wsYear) {
    $wsPayroll = new payroll();
    $wsPayroll->setters($wsMonth, $wsYear);
    $wsPayrollDate = $wsPayroll->getSubmissionDate();
    $returnJsonDate = array("{$wsPayrollDate}");
    header('Content-type: application/json');
    echo json_encode($returnJsonDate);
    dbconn($wsMonth, $wsYear);
} else {
    echo "<pre>No Data Sent. <br /><br />" . "Use http://localhost/payroll/ws.php?month=?&year=? specifying a month (mm) and a year (yyyy)</pre>";
}
function dbconn($m, $y)
{
    $mysqli = new mysqli("localhost", "pyuser", "pypass", "py");
    if ($mysqli->connect_errno) {
        printf("Connect failed: %s\n", $mysqli->connect_error);
        exit;
    }
    mysqli_query($mysqli, "INSERT INTO `log`( `month`, `year` ) VALUES ( {$m} ,{$y} )");
    mysqli_close($mysqli);
}
开发者ID:jzephyr666,项目名称:payroll,代码行数:28,代码来源:ws.php

示例14: audit_log

/**
 * @param $action
 * @return bool
 */
function audit_log($action)
{
    dbconn();
    if (AUDIT) {
        $user = mysql_real_escape_string($_SESSION['myusername']);
        $action = mysql_real_escape_string($action);
        $ip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
        $ret = dbquery("INSERT INTO audit_log (user, ip_address, action) VALUES ('{$user}', '{$ip}', '{$action}')");
        if ($ret) {
            return true;
        }
    }
    return false;
}
开发者ID:thctlo,项目名称:1.2.0,代码行数:18,代码来源:functions.php

示例15: session_start

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
require_once './functions.php';
require_once 'Mail/mimeDecode.php';
session_start();
require 'login.function.php';
ini_set("memory_limit", MEMORY_LIMIT);
if (!isset($_GET['id'])) {
    die('No input Message ID');
} else {
    $message_id = sanitizeInput($_GET['id']);
    // See if message is local
    dbconn();
    // required db link for mysql_real_escape_string
    $message_data = mysql_fetch_object(dbquery("SELECT hostname, DATE_FORMAT(date,'%Y%m%d') AS date FROM maillog WHERE id='" . mysql_real_escape_string($message_id) . "' AND " . $_SESSION["global_filter"]));
    if (!$message_data) {
        die("Message '" . $message_id . "' not found\n");
    }
    if (!is_local($message_data->hostname) || RPC_ONLY) {
        // Host is remote - use XML-RPC
        //$client = new xmlrpc_client(constant('RPC_RELATIVE_PATH').'/rpcserver.php', $host, 80);
        $input = new xmlrpcval($message_id);
        $parameters = array($input);
        $msg = new xmlrpcmsg('return_quarantined_file', $parameters);
        //$rsp = $client->send($msg);
        $rsp = xmlrpc_wrapper($message_data->hostname, $msg);
        if ($rsp->faultcode() == 0) {
            $response = php_xmlrpc_decode($rsp->value());
开发者ID:rafaelbsd,项目名称:1.2.0,代码行数:30,代码来源:viewpart.php


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