本文整理汇总了PHP中db::close方法的典型用法代码示例。如果您正苦于以下问题:PHP db::close方法的具体用法?PHP db::close怎么用?PHP db::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
function authenticate($U, $P, $recordar = 0, $by = 'usuario')
{
$RESULT = false;
if (trim($U) != '' && trim($P) != '') {
$db = new db();
$db->connect();
$sql = ' SELECT * FROM usuarios
WHERE ( ' . $by . ' = "' . mysql_real_escape_string($U) . '" )
AND ( password = "' . md5($P) . '" )
';
$db->query($sql);
// no existe
$RESULT = false;
while ($record = $db->next()) {
// LOGEAR
$this->creaSession($record);
$RESULT = true;
if ($recordar) {
$two_months = time() + 30 * 24 * 3600;
setcookie('id_usuario', $U, $two_months);
setcookie('contrasena', $P, $two_months);
}
}
$db->close();
}
return $RESULT;
}
示例2: GuardarAlbaranes
public function GuardarAlbaranes()
{
$db = new db();
$db->connect();
$C = new ActiveRecord('albaranes');
$C->fields["fecha"] = $this->fecha;
$C->fields["operacion"] = $this->operacion;
$C->fields["guia"] = $this->guia;
$C->fields["remitente"] = $this->remitente;
$C->fields["beneficiario"] = $this->beneficiario;
$C->fields["documento"] = $this->documento;
$C->fields["pais"] = $this->pais;
$C->fields["direccion"] = $this->direccion;
$C->fields["ciudad"] = $this->ciudad;
$C->fields["telefono"] = $this->telefono;
$C->fields["descripcion"] = $this->descripcion;
$C->fields["peso"] = $this->peso;
$C->fields["comision"] = $this->comision;
$C->fields["seguro"] = $this->seguro;
$C->fields["iv"] = $this->iv;
$C->fields["total"] = $this->total;
$C->fields["direccion_agencia"] = $this->direccion_agencia;
$C->insert();
$db->close();
}
示例3: verEstadosPais
public static function verEstadosPais()
{
$db = new db();
$db->connect();
$query = 'SELECT * FROM lista_estados WHERE id_pais = ' . self::$id_pais;
$db->query($query);
$Arr = array();
while ($r = $db->next()) {
$Arr[] = $r;
}
$db->close();
return $Arr;
}
示例4: verCiudadPais
function verCiudadPais()
{
$db = new db();
$db->connect();
$query = 'SELECT * FROM lista_estados WHERE id_pais = ' . $this->id_pais;
$db->query($query);
$Arr = array();
while ($r = $db->next()) {
$Arr[] = $r;
}
return $Arr;
$db->close();
}
示例5: verFuncionalidades
public function verFuncionalidades()
{
$db = new db();
$db->connect();
$query = 'SELECT * FROM fk_privileges';
$db->query($query);
$Arr = array();
while ($r = $db->next()) {
$r['privilege_desc'] = utf8_encode($r['privilege_desc']);
$Arr[] = $r;
}
$db->close();
return $Arr;
}
示例6: correctMysqlUsers
/**
* This file is part of the SysCP project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.syscp.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package Functions
* @version $Id$
*/
function correctMysqlUsers($mysql_access_host_array)
{
global $db, $settings, $sql, $sql_root;
foreach ($sql_root as $mysql_server => $mysql_server_details) {
$db_root = new db($mysql_server_details['host'], $mysql_server_details['user'], $mysql_server_details['password'], '');
unset($db_root->password);
$users = array();
$users_result = $db_root->query('SELECT * FROM `mysql`.`user`');
while ($users_row = $db_root->fetch_array($users_result)) {
if (!isset($users[$users_row['User']]) || !is_array($users[$users_row['User']])) {
$users[$users_row['User']] = array('password' => $users_row['Password'], 'hosts' => array());
}
$users[$users_row['User']]['hosts'][] = $users_row['Host'];
}
$databases = array($sql['db']);
$databases_result = $db->query('SELECT * FROM `' . TABLE_PANEL_DATABASES . '` WHERE `dbserver` = \'' . $mysql_server . '\'');
while ($databases_row = $db->fetch_array($databases_result)) {
$databases[] = $databases_row['databasename'];
}
foreach ($databases as $username) {
if (isset($users[$username]) && is_array($users[$username]) && isset($users[$username]['hosts']) && is_array($users[$username]['hosts'])) {
$password = $users[$username]['password'];
foreach ($mysql_access_host_array as $mysql_access_host) {
$mysql_access_host = trim($mysql_access_host);
if (!in_array($mysql_access_host, $users[$username]['hosts'])) {
$db_root->query('GRANT ALL PRIVILEGES ON `' . str_replace('_', '\\_', $db_root->escape($username)) . '`.* TO `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` IDENTIFIED BY \'password\'');
$db_root->query('SET PASSWORD FOR `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` = \'' . $db_root->escape($password) . '\'');
}
}
foreach ($users[$username]['hosts'] as $mysql_access_host) {
if (!in_array($mysql_access_host, $mysql_access_host_array)) {
$db_root->query('REVOKE ALL PRIVILEGES ON * . * FROM `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '`');
$db_root->query('REVOKE ALL PRIVILEGES ON `' . str_replace('_', '\\_', $db_root->escape($username)) . '` . * FROM `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '`');
$db_root->query('DELETE FROM `mysql`.`user` WHERE `User` = "' . $db_root->escape($username) . '" AND `Host` = "' . $db_root->escape($mysql_access_host) . '"');
}
}
}
}
$db_root->query('FLUSH PRIVILEGES');
$db_root->close();
unset($db_root);
}
}
示例7: SelectStat
/**
* Selectionnez la liste des stats
*
* @return $none
*/
public function SelectStat()
{
$requette = "SELECT ID,REFCHANGEMENT,DATEPUBIR,DATEPUBPM,TYPECAUSE,TYPECAUSESECONDAIRE,TYPOLIGYGTS,KINDIMPACT,RESPONSIBLETEAM,FOURNISSEURRESPONSIBLE,POWERPROD,LEGACY,COMPOSANT,COMPOSANTCOMPLEMENT,ZONEGEOGRAPHIQUE ";
$requette = "FROM " . SCHEMA . ".STATISTIQUE ";
$db = new db();
$db->db_connect();
$db->db_query($requette);
$res = $db->db_fetch_array();
$db->close();
$tab = array();
for ($i = 0; $i < count($res); $i++) {
$valeur = $res[$i];
array_push($tab, $this->SetParam($valeur[0], $valeur[1], $valeur[2], $valeur[3], $valeur[4], $valeur[5], $valeur[6], $valeur[7], $valeur[8], $valeur[9], $valeur[10], $valeur[11], $valeur[12], $valeur[13], $valeur[14]));
}
return $tab;
}
示例8: CrearUsuarioPriv
public function CrearUsuarioPriv()
{
$db = new db();
$db->connect();
$C = new ActiveRecord('fk_perfiles_privs');
$C->fields['id_usuario'] = $this->id_usuario;
$C->fields['id_priv'] = $this->id_priv;
$C->fields['access'] = $this->access;
$C->insert();
$db->close();
}
示例9: syntable
function syntable()
{
$id = $this->input['id'];
$table = array_keys($this->table);
$sql = 'SELECT id,host,port,user,pass,`database`,`charset`,`pconnect` FROM ' . DB_PREFIX . 'login_server WHERE id IN(' . $id . ') AND status=1';
$query = $this->db->query($sql);
$db = array();
while ($row = $this->db->fetch_array($query)) {
$row['pass'] = hg_encript_str($row['pass'], false);
$dbserver[] = $row;
}
//$this->errorOutput(var_export($dbserver,1));
$table_struct = array();
$data = array();
if (!$dbserver) {
$this->errorOutput("没有可同步服务器");
}
foreach ($table as $name) {
$t = $this->db->query_first('SHOW CREATE TABLE ' . $name);
$table_struct[$name] = $t['Create Table'];
if ($this->table[$name] == 2) {
$table_struct[$name] = str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $table_struct[$name]);
}
if ($this->table[$name] == 1) {
$sql = 'SELECT * FROM ' . $name;
$query = $this->db->query($sql);
$data[$name] = 'INSERT INTO ' . $name . ' VALUES ';
while ($row = $this->db->fetch_array($query)) {
$data[$name] .= "('" . implode("','", $row) . "'),";
}
$data[$name] = trim($data[$name], ',');
}
}
include_once ROOT_PATH . 'lib/db/db_mysql.class.php';
$ServDB = new db();
foreach ($dbserver as $server) {
$ServDB->connect($server['host'], $server['user'], $server['pass'], $server['database'], $server['charset'], $server['pconnect']);
foreach ($table_struct as $tn => $ts) {
////删除原表
//$ServDB->query('DROP TABLE IF EXISTS '.$tn.';');
if ($this->table[$tn] == 3 || $this->table[$tn] == 1) {
$ServDB->query('DROP TABLE IF EXISTS ' . $tn . ';');
}
//创建表
$ServDB->query($ts);
//插入数据
if ($this->table[$tn] == 1) {
$ServDB->query($data[$tn]);
}
}
$ServDB->close();
}
$this->addItem($dbserver);
$this->output();
}
示例10: Supprimer
public function Supprimer()
{
$base = new db();
$base->db_connect();
//Suppression de Stat
if ($this->getIdStat()) {
$rq = "DELETE FROM " . SCHEMA . ".STATISTIQUE ";
$rq .= "WHERE ID=" . $this->getIdStat();
$base->db_query($rq);
}
//Suppression d'impact
$rq = "DELETE FROM " . SCHEMA . ".IMPACT ";
$rq .= "WHERE INCIDENT_ID=" . $this->getNumero();
$base->db_query($rq);
// SUppression de l'incident
$rq = "DELETE FROM " . SCHEMA . ".INCIDENT ";
$rq .= "WHERE ID=" . $this->getNumero();
$base->db_query($rq);
$base->close();
}
示例11: db
require CORE_PATH . '/db.php';
$db = new db();
if (isset($config['DB_DRIVER'])) {
$db->set_driver($config['DB_DRIVER']);
}
if (isset($config['DB_PREFIX'])) {
$db->prefix($config['DB_PREFIX']);
}
$db_host = $config['DB_HOST'] . (isset($config['DB_PORT']) ? ':' . $config['DB_PORT'] : '');
$db->setting($db_host, $config['DB_USER'], $config['DB_PSWD'], $config['DB_NAME']);
$script = APP_PATH . 'action/' . MODULE . 'Action.php';
if (!file_exists($script)) {
error_404('Can not find the action ' . MODULE . 'Action.php');
} else {
require $script;
$class = MODULE . 'Action';
$method = ACTION;
if ($method != $class) {
$run = new $class();
if (is_callable(array($run, $method))) {
$run->{$method}();
} else {
error_404("Call to undefined method({$method}) in the class({$class})");
}
} else {
error("The action name({$method}) must be not the same as the module name({$class})");
}
}
if ($db->conn) {
$db->close();
}
示例12: change_work
function change_work($swork_name, $work, $swork_desc, $swork_cat, $swork_cat_n, $swork_color, $swork_date, $swork_mpic, $swork_mpicr, $swork_ipic, $swork_ipicr, $swork_show)
{
$DB = new db();
?>
<!-- Page Header -->
<div class="content bg-gray-lighter">
<div class="row items-push">
<div class="col-sm-7">
<h1 class="page-heading">
Radovi <small>Izmena postojećeg rada.</small> <?php
echo $swork_name;
?>
<img class="img-avatar img-avatar48" src="<?php
echo $swork_mpic;
?>
" alt="<?php
echo $swork_name;
?>
">
</h1>
</div>
<div class="col-sm-5 text-right hidden-xs">
<ol class="breadcrumb push-10-t">
<li>Radovi</li>
<li><a class="link-effect" href="works.php?loc=1&work=<?php
echo $work;
?>
">Izmeni</a></li>
</ol>
</div>
</div>
</div>
<!-- END Page Header -->
<!-- Page Content -->
<div class="content">
<!-- <h2 class="content-heading">Your content</h2> -->
<div class="col-sm-6 col-sm-offset-3">
<!-- Floating Labels -->
<div class="block">
<div class="block-content block-content-narrow">
<form class="js-validation-material form-horizontal push-10-t" action="works_edit_save.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<div class="form-group has-info">
<div class="col-xs-12">
<div class="form-material floating">
<input class="form-control" type="text" id="work_name" name="work_name" value="<?php
echo $swork_name;
?>
">
<label for="work_name">Naziv rada</label>
</div>
</div>
</div>
<div class="form-group has-info">
<div class="col-xs-12">
<div class="form-material floating">
<input class="form-control" type="text" id="work_opis" name="work_opis" value="<?php
echo $swork_desc;
?>
">
<label for="work_opis">Kratak opis</label>
</div>
</div>
</div>
<div class="form-group has-info">
<div class="col-xs-12">
<div class="form-material floating">
<select class="form-control" id="work_cat" name="work_cat" size="1">
<option value="<?php
echo $swork_cat;
?>
" selected="selected"><?php
echo $swork_cat_n;
?>
</option>
<?php
echo $cat_name_act;
$SQL = "SELECT id_cat, cat_name FROM categories ORDER BY cat_name ASC";
$DB->query($SQL);
while ($row = $DB->fetch_assoc()) {
$id_cat = $row['id_cat'];
$cat_name = $row['cat_name'];
echo '
<option value="' . $id_cat . '">' . $cat_name . '</option>';
}
$DB->close();
?>
</select>
<label for="work_cat">Kategorija</label>
</div>
</div>
</div>
<div class="form-group has-info">
<div class="col-xs-12">
<div class="form-material floating">
<input class="js-colorpicker form-control" type="text" id="work_color" name="work_color" value="<?php
echo $swork_color;
?>
">
<label for="work_color">Odaberi boju</label>
//.........这里部分代码省略.........
示例13: show
public function show()
{
$progressPath = CACHE_DIR . 'progress.txt';
$totalPath = CACHE_DIR . 'total.txt';
$is_next = true;
if (file_exists($progressPath) && file_exists($totalPath)) {
$progress = file_get_contents($progressPath);
$total = file_get_contents($totalPath);
} else {
file_put_contents($progressPath, 0);
$sql = 'SELECT max(member_id) as max,min(member_id) as min FROM ' . DB_PREFIX . 'member_bind WHERE member_id != platform_id AND type = \'m2o\' AND inuc = 0';
$max_min = $this->db->query_first($sql);
file_put_contents($totalPath, $max_min['max']);
file_put_contents($progressPath, $max_min['min']);
$progress = $max_min['min'] - 1;
$total = $max_min['max'];
}
$newlegth = intval($progress + LENGTH);
if ($newlegth > intval($total)) {
$newlegth = $total;
$is_next = false;
}
$sql = 'SELECT member_id FROM ' . DB_PREFIX . 'member_bind where ( member_id >' . $progress . ' AND member_id != platform_id AND type = \'m2o\' AND inuc = 0) AND ( member_id <= ' . $newlegth . ' AND member_id != platform_id AND type = \'m2o\' AND inuc = 0) order by member_id asc ';
$query = $this->db->query($sql);
$arr = array();
$member_id = array();
while ($row = $this->db->fetch_array($query)) {
$arr[$row['member_id']] = array('member_id' => $row['member_id']);
$member_id[] = $row['member_id'];
}
$source_db = array('host' => 'localhost', 'user' => 'root', 'pass' => 'hogesoft', 'database' => 'dev_member', 'charset' => 'utf8', 'pconncet' => '0', 'dbprefix' => 'm2o_');
$sourceDB = new db();
$sourceDB->connect($source_db['host'], $source_db['user'], $source_db['pass'], $source_db['database'], $source_db['charset'], $source_db['pconnect'], $source_db['dbprefix']);
if (!empty($member_id)) {
$sql = 'SELECT * FROM ' . DB_PREFIX . 'member_bound WHERE member_id IN (' . implode(',', $member_id) . ')';
$query = $sourceDB->query($sql);
$platform_id = array();
while ($row = $sourceDB->fetch_array($query)) {
$arr[$row['member_id']]['platform_id'] = $row['platform_id'];
$platform_id[] = $row['platform_id'];
}
$sourceDB->close();
}
if ($platform_id && $this->settings['App_share']) {
$platform_id_str = implode(',', $platform_id);
//$access_plat_token_str .= ',d4cf3e1c11842fc401dac4785fc7cb74,4161492c9e237fc3a6a33b6420fdbb73';
$this->curl->setSubmitType('post');
$this->curl->initPostData();
$this->curl->addRequestData('a', 'get_user_by_id');
$this->curl->addRequestData('id', $platform_id_str);
$ret = $this->curl->request('get_user.php');
$ret = $ret[0];
}
if (!empty($arr)) {
foreach ($arr as $key => $val) {
if (!empty($ret[$val['platform_id']])) {
$arr[$key]['type'] = $this->plat_maps[$ret[$val['platform_id']]['plat_type']]['type'];
$arr[$key]['type_name'] = $this->plat_maps[$ret[$val['platform_id']]['plat_type']]['type_name'];
$arr[$key]['platform_id'] = $ret[$val['platform_id']]['uid'];
} else {
$arr[$key]['type'] = 'm2o';
$arr[$key]['type_name'] = 'm2o';
}
}
$source_db = array('host' => 'localhost', 'user' => 'root', 'pass' => 'hogesoft', 'database' => 'hoolo_members', 'charset' => 'utf8', 'pconncet' => '0', 'dbprefix' => 'm2o_');
$_sourceDB = new db();
$_sourceDB->connect($source_db['host'], $source_db['user'], $source_db['pass'], $source_db['database'], $source_db['charset'], $source_db['pconnect'], $source_db['dbprefix']);
foreach ($arr as $key => $val) {
if ($val['platform_id']) {
$sql = 'UPDATE ' . DB_PREFIX . 'member SET type=\'' . $val['type'] . '\',type_name = \'' . $val['type_name'] . '\' WHERE member_id = ' . $val['member_id'];
$_sourceDB->query($sql);
$sql = 'UPDATE ' . DB_PREFIX . 'member_bind SET
platform_id = \'' . $val['platform_id'] . '\',type=\'' . $val['type'] . '\',type_name = \'' . $val['type_name'] . '\' WHERE member_id = ' . $val['member_id'];
$_sourceDB->query($sql);
} else {
echo "数据修复出错";
exit;
}
}
$_sourceDB->close();
file_put_contents($progressPath, $newlegth);
if ($is_next) {
$percent = round(intval($newlegth) / intval($total) * 100, 2) . "%";
echo $message = '系统正在修复数据,别打扰唉...' . $percent;
$this->redirect('membersDataRecovery.php');
}
echo "数据修复完成";
exit;
} else {
echo "已经修复完成,请勿重复修复数据";
}
exit;
}
示例14: Restore
function Restore($target_path)
{
$DB = new db();
$handle = fopen($target_path, "rt");
if ($handle) {
$poruka = "<BR>Start import...<BR>";
while ($strSQL = fgets($handle)) {
$strSQL = rtrim($strSQL);
while (substr($strSQL, -1, 1) != ";") {
$strNextLine = fgets($handle);
$strNextLine = rtrim($strNextLine);
$strSQL .= $strNextLine;
}
if (strlen($strSQL) > 1 && substr($strSQL, 0, 3) != "-- " && substr($strSQL, 0, 1) != "#") {
$DB->query($strSQL);
}
}
$poruka .= "<br />Import ended...OK.<br />";
fclose($handle);
return $poruka;
}
$DB->close();
}
示例15:
<DIV id="content">
<DIV id="primaryContentContainer">
<DIV id="primaryContent">
<DIV class="box">
<H3>Channel <?php
echo $strReturnChannelInfo;
?>
</H3>
<DIV class="boxContent">
<?php
echo $return . $but_to_back . $but_to_next;
?>
</DIV>
</DIV>
</DIV>
</DIV>
<DIV class="clear"></DIV>
</DIV>
</DIV>
<DIV id="footer">
<P>Copyright © 2008-2009 GlobalArchive.ru</P>
</DIV>
</DIV>
</BODY>
</HTML>
<?php
$cDb->close();