• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_tables函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: startProcess

function startProcess($db)
{
    $businessComfirmUrl = Yii::app()->params['orderUrl'] . "update/order/business-confirm-order";
    $time = time();
    $formatTime = date('Y-m-d H:i:s', $time);
    try {
        //查找订单
        $payTime = $time - 1800;
        $sql = "SELECT b.business_id,o.order_sn from " . get_tables('business_info') . " as b left join " . get_tables('order_info') . " as o on b.business_id=o.business_id WHERE b.express_type in (2, 11, 12) and o.order_status=1 and o.express_type > 0  and o.pay_time <= " . $payTime . " LIMIT 100";
        $data = $db->createCommand($sql)->queryAll();
        if (!empty($data)) {
            foreach ($data as $k => $v) {
                $post = ['business_id' => $v['business_id'], 'order_sn' => $v['order_sn'], 'user_id' => 1, 'user_name' => 'jiaoben', 'source' => 'autoStockUp'];
                $return = curlPost($businessComfirmUrl, $post);
                if ($return['code'] != 0) {
                    addLog("data:" . json_encode($return, JSON_UNESCAPED_UNICODE) . '|time:' . $formatTime);
                    echo $v['order_sn'] . ":fail" . "\r\n";
                } else {
                    echo $v['order_sn'] . ":success" . "\r\n";
                }
            }
            echo "data update:" . count($data) . "\r\n";
        } else {
            echo "no data \r\n";
        }
        echo 'finish';
    } catch (Exception $e) {
        $msg = "filename:autoStockUp|functionname:start_process|error:" . $e->getMessage() . "|time:" . $formatTime;
        echo $msg . "\r\n";
        addLog($msg);
    }
}
开发者ID:pengxuhui,项目名称:murphy,代码行数:32,代码来源:autoStockUp.php


示例2: del_tables

function del_tables($prefix)
{
    $tables = get_tables($prefix);
    $query = 'drop table ' . $tables[0];
    for ($i = 0; $i < count($tables); $i++) {
        $query .= "," . $tables[$i];
    }
    $query .= ";";
    mysql_query($query);
}
开发者ID:solostyle,项目名称:iam,代码行数:10,代码来源:dropcopyfunc.php


示例3: drop_tables

function drop_tables($prefix) {
	$tables = get_tables($prefix);

	$query = 'drop table `' . $tables[0] . "`";
	for ($i=1; $i < count($tables); $i++)
		$query .= ", `" . $tables[$i] . "`";
	$query .= ";";

	print $query;
	mysql_query($query);
}
开发者ID:solostyle,项目名称:iam,代码行数:11,代码来源:drop-confirm.php


示例4: unset

<?php

// Purpose        working with data (import/export, type in, ...)
// Author         Lutz Brueckner <[email protected]>
// Copyright      (c) 2000-2006 by Lutz Brueckner,
//                published under the terms of the GNU General Public Licence v.2,
//                see file LICENCE for details
require './inc/script_start.inc.php';
require './inc/foreign_keys.inc.php';
require './inc/DataForm.php';
//
// setup $s_tables[] and $s_fields[] if necessary
//
if ($s_connected && $s_tables_valid == FALSE) {
    include_once './inc/get_tables.inc.php';
    if (get_tables($dbhandle)) {
        $s_tables_valid = TRUE;
    }
}
require './inc/handle_watchtable.inc.php';
//
// handle foreign key lookup configuration
//
$customize_changed = FALSE;
if (isset($_POST['dt_column_config_save'])) {
    $column = get_request_data('dt_column_config_column');
    $table = get_request_data('dt_column_config_table');
    $fk_column = get_request_data('dt_column_config_fk_column');
    if ($fk_column == '') {
        unset($s_cust['fk_lookups'][$table][$column]);
        if (empty($s_cust['fk_lookups'][$table])) {
开发者ID:silvadelphi,项目名称:firebirdwebadmin,代码行数:31,代码来源:data.php


示例5: export_db

function export_db($is_backup = false)
{
    global $db, $db_host, $db_user, $db_pass, $db_name, $db_port;
    $stime = microtime(true);
    if ($is_backup) {
        $output_file = str_replace('\\', '/', getcwd()) . "/backup/" . date("Y-m-d_H-i-s") . ".php";
    } else {
        $changes = get_changes();
        $i = 0;
        while (true) {
            $i += 1;
            $file_name = date("Y-m-d") . "-" . sprintf("%02d", $i);
            $ver = (int) str_replace('-', '', $file_name);
            if (array_key_exists($ver, $changes) == false) {
                break;
            }
        }
        $output_file = str_replace('\\', '/', getcwd()) . "/changes/" . $file_name . ".dump.php";
    }
    $file = fopen($output_file, 'c');
    $tables = get_tables($db_host, $db_user, $db_pass, $db_name, $db_port);
    $max_length = get_max_length($tables);
    fwrite($file, "<?php\n\n");
    fwrite($file, "echo \"\\n\\n\";\n");
    fwrite($file, "\n            execute(\"\n            /*!40101 SET NAMES utf8 */;\n\n            /*!40101 SET SQL_MODE=''*/;\n\n            /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n            /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n            /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;\n            /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n            \");\n        ");
    foreach ($tables as $table) {
        if ($table == "db_version") {
            continue;
        }
        if ($is_backup) {
            echo "backup ";
        } else {
            echo "dump ";
        }
        echo $table . " ";
        $dots = generate_char($max_length, strlen($table), '.');
        echo $dots . "......... ";
        $sql = get_create_table_sql($db, $table);
        fwrite($file, 'if ($db_version == 0)' . "\n{\n");
        fwrite($file, "    echo \"    " . $table . " " . $dots . "......... \";\n\n");
        fwrite($file, "    execute(\"\n");
        fwrite($file, $sql);
        fwrite($file, "\n\");\n\n");
        fwrite($file, "    echo \"[created]\\n\"; \n");
        fwrite($file, "}\n\n");
        if ($is_backup == false && strpos($table, "player") === 0) {
            echo "[ignore]\n";
            continue;
        }
        $fields = get_table_fields($db, $table);
        $sql = get_insert_into_sql($db, $table, $fields);
        fwrite($file, "echo \"    " . $table . " " . $dots . "......... \";\n\n");
        fwrite($file, "execute(\"DELETE FROM `" . $table . "`\");\n\n");
        if ($sql != "") {
            fwrite($file, "execute(\"\n");
            fwrite($file, $sql);
            fwrite($file, "\");\n\n");
        }
        fwrite($file, "echo \"[loaded]\\n\"; \n");
        fwrite($file, "\n");
        echo "[done]\n";
    }
    fwrite($file, "\n            execute(\"\n            /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n            /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n            /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n            /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;\n            \");\n        ");
    fwrite($file, "echo \"\\n\";\n");
    fwrite($file, "?>\n");
    fclose($file);
    if ($is_backup == false) {
        $sql = "UPDATE `db_version` SET `version` = " . $ver . ", `change_time` = UNIX_TIMESTAMP()";
        if ($db->query($sql) === FALSE) {
            die("can't update db_version");
        }
    }
    $etime = microtime(true);
    echo "\ndatabase ";
    if ($is_backup) {
        echo "backup ";
    } else {
        echo "dump ";
    }
    echo "complete in " . round($etime - $stime, 2) . "s\n";
}
开发者ID:sacramento04,项目名称:practice,代码行数:81,代码来源:main.php


示例6: connect_check_db

/**
* Used to test whether we are able to connect to the database the user has specified
* and identify any problems (eg there are already tables with the names we want to use
* @param array $dbms should be of the format of an element of the array returned by {@link get_available_dbms get_available_dbms()} necessary extensions should be loaded already
*/
function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $load_dbal = true, $unicode_check = true)
{
    global $config, $lang;
    $dbms = $dbms_details['DRIVER'];
    if ($load_dbal) {
        // Include the DB layer
        include $phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx;
    }
    // Instantiate it and set return on error true
    $sql_db = 'dbal_' . $dbms;
    $db = new $sql_db();
    $db->sql_return_on_error(true);
    // Check that we actually have a database name before going any further.....
    if ($dbms_details['DRIVER'] != 'sqlite' && $dbms_details['DRIVER'] != 'oracle' && $dbname === '') {
        $error[] = $lang['INST_ERR_DB_NO_NAME'];
        return false;
    }
    // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea
    if ($dbms_details['DRIVER'] == 'sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0) {
        $error[] = $lang['INST_ERR_DB_FORUM_PATH'];
        return false;
    }
    // Check the prefix length to ensure that index names are not too long and does not contain invalid characters
    switch ($dbms_details['DRIVER']) {
        case 'mysql':
        case 'mysqli':
            if (strspn($table_prefix, '-./\\') !== 0) {
                $error[] = $lang['INST_ERR_PREFIX_INVALID'];
                return false;
            }
            break;
    }
    if (strlen($table_prefix) > $prefix_length) {
        $error[] = sprintf($lang['INST_ERR_PREFIX_TOO_LONG'], $prefix_length);
        return false;
    }
    // Try and connect ...
    if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true))) {
        $db_error = $db->sql_error();
        $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . ($db_error['message'] ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);
    } else {
        // Likely matches for an existing phpBB installation
        if (!$prefix_may_exist) {
            $temp_prefix = strtolower($table_prefix);
            $table_ary = array($temp_prefix . 'attachments', $temp_prefix . 'config', $temp_prefix . 'sessions', $temp_prefix . 'topics', $temp_prefix . 'users');
            $tables = get_tables($db);
            $tables = array_map('strtolower', $tables);
            $table_intersect = array_intersect($tables, $table_ary);
            if (sizeof($table_intersect)) {
                $error[] = $lang['INST_ERR_PREFIX'];
            }
        }
        // Make sure that the user has selected a sensible DBAL for the DBMS actually installed
        switch ($dbms_details['DRIVER']) {
            case 'mysqli':
                if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<')) {
                    $error[] = $lang['INST_ERR_DB_NO_MYSQLI'];
                }
                break;
        }
    }
    if ($error_connect && (!isset($error) || !sizeof($error))) {
        return true;
    }
    return false;
}
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:71,代码来源:functions_install.php


示例7: make_db_connections

  <link rel="stylesheet" type="text/css" href="../css/body.css" />

  <style>
  body {font-size:80%; margin:5px;}
  h1 {font-size:140%}
  table {margin-left:40px; border-collapse:collapse}
  td {border:1px solid #C0C0C0; padding:2px}
  .grey {background-color:#EAEAEA; font-weight:bold}
  .nonexist {background-color:#FFC0C0}
  .dkred {background-color:#C00000; color:white; font-weight:bold}
  .err {color:red; font-weight:bold}
  </style>
</head>

<body>
<?php 
if (isset($_POST['submit'])) {
    make_db_connections();
    $table_list = get_tables($_POST['master_dbname'], $master_mysqli);
    foreach ($table_list as $table) {
        echo "<h1>{$table}</h1>\n";
        compare_indexes($_POST['master_dbname'], $_POST['test_dbname'], $table, $master_mysqli, $test_mysqli);
    }
} else {
    echo display_form();
}
?>
</body>
</html>
开发者ID:vinod-co,项目名称:centa,代码行数:29,代码来源:database_indexes.php


示例8: table_exists

 /**
  * Table Exists
  *
  * Check if a table exists in the DB or not
  *
  * @param string $table_name The table name to check for
  *
  * @return bool true if the table exists, false if not
  */
 function table_exists($table_name)
 {
     $this->get_table_name($table_name);
     // Use sql_table_exists if available
     if (method_exists($this->db_tools, 'sql_table_exists')) {
         $roe = $this->db->return_on_error;
         $result = $this->db_tools->sql_table_exists($table_name);
         // db_tools::sql_table_exists resets the return_on_error to false always after completing, so we must make sure we set it to true again if it was before
         if ($roe) {
             $this->db->sql_return_on_error(true);
         }
         return $result;
     }
     if (!function_exists('get_tables')) {
         global $phpbb_root_path, $phpEx;
         include $phpbb_root_path . 'includes/functions_install.' . $phpEx;
     }
     $tables = get_tables($this->db);
     if (in_array($table_name, $tables)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:poyntesm,项目名称:phpbbgarage,代码行数:33,代码来源:umil.php


示例9: get_logtables

function get_logtables($link)
{
    // Create an array of the column names in the default table
    $query = "DESCRIBE " . DEFAULTLOGTABLE;
    $result = perform_query($query, $link);
    $defaultFieldArray = array();
    while ($row = mysql_fetch_array($result)) {
        array_push($defaultFieldArray, $row['Field']);
    }
    // Create an array with the names of all the log tables
    $logTableArray = array();
    $allTablesArray = get_tables($link);
    foreach ($allTablesArray as $value) {
        // Create an array of the column names in the current table
        $query = "DESCRIBE " . $value;
        $result = perform_query($query, $link);
        // Get the names of columns in current table
        $fieldArray = array();
        while ($row = mysql_fetch_array($result)) {
            array_push($fieldArray, $row['Field']);
        }
        // If the current array is identical to the one from the
        // DEFAULTLOGTABLE then the name is added to the result
        // array.
        $diffArray = array_diff_assoc($defaultFieldArray, $fieldArray);
        if (!$diffArray) {
            array_push($logTableArray, $value);
        }
    }
    return $logTableArray;
}
开发者ID:jeroenrnl,项目名称:php-syslog-ng,代码行数:31,代码来源:common_funcs.php


示例10: connect_check_db

/**
* Used to test whether we are able to connect to the database the user has specified
* and identify any problems (eg there are already tables with the names we want to use
* @param	array	$dbms should be of the format of an element of the array returned by {@link get_available_dbms get_available_dbms()}
*					necessary extensions should be loaded already
*/
function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $load_dbal = true, $unicode_check = true)
{
    global $phpbb_root_path, $phpEx, $config, $lang;
    $dbms = $dbms_details['DRIVER'];
    if ($load_dbal) {
        // Include the DB layer
        include $phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx;
    }
    // Instantiate it and set return on error true
    $sql_db = 'dbal_' . $dbms;
    $db = new $sql_db();
    $db->sql_return_on_error(true);
    // Check that we actually have a database name before going any further.....
    if ($dbms_details['DRIVER'] != 'sqlite' && $dbms_details['DRIVER'] != 'oracle' && $dbname === '') {
        $error[] = $lang['INST_ERR_DB_NO_NAME'];
        return false;
    }
    // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea
    if ($dbms_details['DRIVER'] == 'sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0) {
        $error[] = $lang['INST_ERR_DB_FORUM_PATH'];
        return false;
    }
    // Check the prefix length to ensure that index names are not too long and does not contain invalid characters
    switch ($dbms_details['DRIVER']) {
        case 'mysql':
        case 'mysqli':
            if (strspn($table_prefix, '-./\\') !== 0) {
                $error[] = $lang['INST_ERR_PREFIX_INVALID'];
                return false;
            }
            // no break;
        // no break;
        case 'postgres':
            $prefix_length = 36;
            break;
        case 'mssql':
        case 'mssql_odbc':
        case 'mssqlnative':
            $prefix_length = 90;
            break;
        case 'sqlite':
            $prefix_length = 200;
            break;
        case 'firebird':
        case 'oracle':
            $prefix_length = 6;
            break;
    }
    if (strlen($table_prefix) > $prefix_length) {
        $error[] = sprintf($lang['INST_ERR_PREFIX_TOO_LONG'], $prefix_length);
        return false;
    }
    // Try and connect ...
    if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true))) {
        $db_error = $db->sql_error();
        $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . ($db_error['message'] ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);
    } else {
        // Likely matches for an existing phpBB installation
        if (!$prefix_may_exist) {
            $temp_prefix = strtolower($table_prefix);
            $table_ary = array($temp_prefix . 'attachments', $temp_prefix . 'config', $temp_prefix . 'sessions', $temp_prefix . 'topics', $temp_prefix . 'users');
            $tables = get_tables($db);
            $tables = array_map('strtolower', $tables);
            $table_intersect = array_intersect($tables, $table_ary);
            if (sizeof($table_intersect)) {
                $error[] = $lang['INST_ERR_PREFIX'];
            }
        }
        // Make sure that the user has selected a sensible DBAL for the DBMS actually installed
        switch ($dbms_details['DRIVER']) {
            case 'mysqli':
                if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<')) {
                    $error[] = $lang['INST_ERR_DB_NO_MYSQLI'];
                }
                break;
            case 'sqlite':
                if (version_compare(sqlite_libversion(), '2.8.2', '<')) {
                    $error[] = $lang['INST_ERR_DB_NO_SQLITE'];
                }
                break;
            case 'firebird':
                // check the version of FB, use some hackery if we can't get access to the server info
                if ($db->service_handle !== false && function_exists('ibase_server_info')) {
                    $val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION);
                    preg_match('#V([\\d.]+)#', $val, $match);
                    if ($match[1] < 2) {
                        $error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
                    }
                    $db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES);
                    preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs);
                    $page_size = intval($regs[1]);
                    if ($page_size < 8192) {
                        $error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
                    }
//.........这里部分代码省略.........
开发者ID:eyumay,项目名称:ju.ejhs,代码行数:101,代码来源:functions_install.php


示例11: get_phpbb_tables

/**
* Get all tables used by phpBB
*/
function get_phpbb_tables()
{
    global $db, $table_prefix;
    static $_tables = array();
    if (!empty($_tables)) {
        return $_tables;
    }
    if (!function_exists('get_tables')) {
        include PHPBB_ROOT_PATH . 'includes/functions_install.' . PHP_EXT;
    }
    // Function returns all tables in the database
    $all_tables = get_tables($db);
    // Only get tables using the phpBB prefix
    if (!empty($table_prefix)) {
        foreach ($all_tables as $table) {
            if (strpos($table, $table_prefix) === 0) {
                $_tables[] = $table;
            }
        }
    } else {
        // Use is using an empty table prefix (Bug #62537)
        // no way to determine the phpBB tables, in this case
        // we'll show everything with a warning that the tool
        // most likely want to trash a lot of tables '-,-
        global $template;
        $template->assign_vars(array('ERROR_MESSAGE' => user_lang('EMPTY_PREFIX_EXPLAIN'), 'ERROR_TITLE' => user_lang('EMPTY_PREFIX')));
        $_tables = $all_tables;
    }
    sort($_tables);
    return $_tables;
}
开发者ID:napus,项目名称:support-toolkit,代码行数:34,代码来源:functions_database_cleaner.php


示例12: get_tables

<?php

require_once "data.php";
require_once "connection.php";
//получаем список таблиц из БД
$tables = get_tables($mysql);
if ($_POST) {
    $name = $_POST['tables'];
    $format = $_POST['formats'];
    get_data($name, $format, $mysql);
}
?>

<html lang="ru">
<head>
    <meta charset="UTF-8" />
    <title>Работа с БД</title>
    <link href="style.css" rel="stylesheet" />
</head>
<body>
    <div class="wrapper">
        <div class="container">
            <form action="main.php" method="post">
                <select class="tables" id="tables" name="tables">
                    <?php 
echo "<option selected='selected'>Выберите таблицу</option>";
foreach ($tables as $table) {
    echo "<option>" . $table[0] . "</option>";
}
?>
                </select>
开发者ID:agolomazov,项目名称:LoftSchool-2,代码行数:31,代码来源:main.php


示例13: get_tables

<?php

require_once "main.php";
//получаем список таблиц из БД для выпадающего меню
$tables = get_tables($conn);
if ($_POST) {
    $name = $_POST['tables'];
    $format = $_POST['formats'];
    $m_format = strtolower($format);
    if (in_array($name, $tables)) {
        switch ($format) {
            case "CSV":
                create_csv($name, $conn);
                break;
            case "JSON":
                create_json($name, $conn);
                break;
            case "XML":
                create_xml($name, $conn);
                break;
            default:
                echo "<h3>Выберите формат файла!</h3>";
                break;
        }
        //проверяем существование файла
        $file = DIR . $m_format . "/" . $name . "." . $m_format;
        if (file_exists($file)) {
            download_file($file);
        }
    } else {
        echo "<h3>Выберите таблицу из списка!</h3>";
开发者ID:dynamofan27,项目名称:import,代码行数:31,代码来源:index.php


示例14: delete_suggestion

	function delete_suggestion(){
		global $conn;
		
		$tablename = $_GET['tableName'];
		$suggestion_id = $_GET['suggestion_id'];
		$token = $_GET['jwt'];
		
		
		
		//we dont have to worry about checking what the result is, as as soon as it realizes we arent logged in 401 response header sent and caight by HTTP interceptor
		userLoggedIn($token);
		flush();
		
		
		$accepted_tables = get_tables();
		if(in_array($tablename, $accepted_tables)){
			$tablename = htmlspecialchars($tablename);
			$suggestion_id = htmlspecialchars($suggestion_id);
			if($sql = $conn->prepare("DELETE FROM $tablename WHERE suggestion_id = ?")){
				$sql->bind_param('s', $suggestion_id);
				if( !($sql->execute()) ){
					echo false;
				}
			}
		}

		
	}
开发者ID:ericalas93,项目名称:whatdoyouwannado,代码行数:28,代码来源:suggestions.php


示例15: get_dependencies

        $deps = get_dependencies(OT_EXCEPTION, $dname);
        if (count($deps) > 0) {
            $message = sprintf($MESSAGES['HAVE_DEPENDENCIES'], $acc_strings['Exception'], $dname, dependencies_string($deps));
        } else {
            if ($s_cust['askdel'] == TRUE) {
                $s_confirmations['exc'] = array('msg' => sprintf($MESSAGES['CONFIRM_EXC_DELETE'], $dname), 'obj' => $dname);
            } else {
                drop_exception($dname);
            }
        }
    }
}
// setup $s_tables[] and $s_fields[] if necessary
if ($s_connected == TRUE && $s_tables_valid == FALSE) {
    include_once './inc/get_tables.inc.php';
    if (get_tables()) {
        $s_tables_valid = TRUE;
    }
}
//
// deleting of a subject is confirmed
//
if (isset($_POST['confirm_yes'])) {
    switch ($_POST['confirm_subject']) {
        case 'index':
            drop_index($s_confirmations['index']['obj']);
            break;
        case 'trigger':
            drop_trigger($s_confirmations['trigger']['obj']);
            break;
        case 'domain':
开发者ID:silvadelphi,项目名称:firebirdwebadmin,代码行数:31,代码来源:accessories.php


示例16: critical_connect_check_db


//.........这里部分代码省略.........
         include PHPBB_ROOT_PATH . 'phpbb/db/tools.' . PHP_EXT;
     }
     // Instantiate it and set return on error true
     $sql_db = 'dbal_' . $dbms;
     switch ($dbms_details['SCHEMA']) {
         case 'mysql':
         case 'mysqli':
             $db = new phpbb\db\driver\mysql();
             break;
         case 'mssql':
         case 'mssqlnative':
         case 'mssql_odbc':
             $db = new phpbb\db\driver\mssql();
             break;
         case 'postgres':
             $db = new phpbb\db\driver\postgres();
             break;
         case 'sqlite':
         case 'sqlite3':
             $db = new phpbb\db\driver\sqlite();
             break;
         case 'postgres':
             $db = new phpbb\db\driver\postgres();
             break;
     }
     $db->sql_return_on_error(true);
     // Check the prefix length to ensure that index names are not too long and does not contain invalid characters
     switch ($dbms_details['SCHEMA']) {
         case 'mysql':
         case 'mysqli':
             if (strspn($table_prefix, '-./\\') !== 0) {
                 $error[] = $user->lang['INST_ERR_PREFIX_INVALID'];
                 return false;
             }
             // no break;
         // no break;
         case 'postgres':
             $prefix_length = 36;
             break;
         case 'mssql':
         case 'mssqlnative':
         case 'mssql_odbc':
             $prefix_length = 90;
             break;
         case 'sqlite':
         case 'sqlite3':
             $prefix_length = 200;
             break;
         case 'oracle':
             $prefix_length = 6;
             break;
     }
     if (strlen($table_prefix) > $prefix_length) {
         $error[] = $user->lang['INST_ERR_PREFIX_TOO_LONG'];
         return false;
     }
     // Try and connect ...
     if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true))) {
         $db_error = $db->sql_error();
         $error[] = ' ' . $user->lang['INST_ERR_DB_CONNECT'] . '' . '<br />' . ($db_error['message'] ? $db_error['message'] : '' . $user->lang['INST_ERR_DB_NO_ERROR'] . '');
     } else {
         // Make sure that the user has selected a sensible DBAL for the DBMS actually installed
         switch ($dbms_details['SCHEMA']) {
             case 'mysqli':
                 if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<')) {
                     $error[] = $user->lang['INST_ERR_DB_NO_MYSQLI'];
                 }
                 break;
             case 'sqlite':
                 if (version_compare(sqlite_libversion(), '2.8.2', '<')) {
                     $error[] = $user->lang['INST_ERR_DB_NO_SQLITE'];
                 }
                 break;
             case 'sqlite3':
                 if (version_compare(sqlite_libversion(), '3.6.15', '<')) {
                     $error[] = $user->lang['INST_ERR_DB_NO_SQLITE3'];
                 }
                 break;
             case 'postgres':
                 if ($unicode_check) {
                     $sql = "SHOW server_encoding;";
                     $result = $db->sql_query($sql);
                     $row = $db->sql_fetchrow($result);
                     $db->sql_freeresult($result);
                     if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') {
                         $error[] = $user->lang['INST_ERR_DB_NO_POSTGRES'];
                     }
                 }
                 break;
         }
         $tables = get_tables($db);
         if (!in_array($table_prefix . 'acl_options', $tables) || !in_array($table_prefix . 'config', $tables) || !in_array($table_prefix . 'forums', $tables)) {
             $error[] = $user->lang['CONFIG_REPAIR_NO_TABLES'];
         }
     }
     if ($error_connect && empty($error)) {
         return true;
     }
     return false;
 }
开发者ID:melvingb,项目名称:phpbb3.1-STK,代码行数:101,代码来源:config_repair.php


示例17: show_install_err

$link = @mysql_connect($mysqlhost, $mysqllogin, $mysqlpass) or show_install_err('Could not connect: ' . mysql_error());
if ($act == "silentcreateall") {
    mysql_query("CREATE DATABASE {$mysqldb}", $link) or show_install_err(' Query failed: ' . mysql_error($link));
    foreach ($dbtables as $id) {
        create_table($id, $link);
    }
} else {
    if ($act == "createdb") {
        mysql_query("CREATE DATABASE {$mysqldb}", $link) or show_install_err(' Query failed: ' . mysql_error($link));
    } else {
        mysql_select_db($mysqldb, $link) or show_install_err('Could not select database');
        if ($force_charset_in_connection) {
            mysql_query("SET character set {$dbencoding}", $link);
        }
        if ($act == "ct") {
            $curr_tables = get_tables($link);
            if ($curr_tables === false) {
                show_install_err($errors[0]);
            }
            $tocreate = array_diff(array_keys($dbtables), $curr_tables);
            foreach ($tocreate as $id) {
                create_table($id, $link);
            }
        } else {
            if ($act == "dt") {
                # comment this line to be able to drop tables
                show_install_err("For security reasons, removing tables is disabled by default");
                foreach (array_keys($dbtables) as $id) {
                    mysql_query("DROP TABLE IF EXISTS {$id}", $link) or show_install_err(' Query failed: ' . mysql_error($link));
                }
            } else {
开发者ID:paulcn,项目名称:mibew,代码行数:31,代码来源:dbperform.php


示例18: display_options

	function display_options()
	{
		global $config, $db, $plugin, $template, $umil, $user;

		$continue = (isset($_POST['continue'])) ? true : false;
		$step = request_var('step', 0);
		$selected = request_var('items', array('' => ''));

		// Apply Changes to the DB?
		$apply_changes = true;

		if ($step > 0)
		{
			// Kick them if bad form key
			check_form_key('database_cleaner', false, append_sid(STK_INDEX, 't=database_cleaner'), true);
		}

		// include the required file for this version
		$version_file = preg_replace('#([^0-9]+)#', '_', $config['version']) . '.' . PHP_EXT;
		if (!file_exists(STK_ROOT_PATH . 'includes/database_cleaner/' . $version_file))
		{
			trigger_error('PHPBB_VERSION_NOT_SUPPORTED');
		}
		include(STK_ROOT_PATH . 'includes/database_cleaner/functions.' . PHP_EXT);
		include(STK_ROOT_PATH . 'includes/database_cleaner/' . $version_file);
		$cleaner = new database_cleaner_data();

		$user->add_lang('acp/common');

		switch ($step)
		{
			case 0 :
				// Display a quick intro here and make sure they know what they are doing...
				$template->assign_vars(array(
					'S_NO_INSTRUCTIONS'	=> true,
					'SUCCESS_TITLE'		=> $user->lang['DATABASE_CLEANER'],
					'SUCCESS_MESSAGE'	=> $user->lang['DATABASE_CLEANER_WELCOME'],
					'ERROR_TITLE'		=> ' ',
					'ERROR_MESSAGE'		=> $user->lang['DATABASE_CLEANER_WARNING'],
				));
			break;

			case 1 :
				// Redirect if they selected quit
				if (isset($_POST['quit']))
				{
					redirect(append_sid(STK_ROOT_PATH . 'index.' . PHP_EXT));
				}

				// Start by disabling the board
				if ($apply_changes)
				{
					set_config('board_disable', 1);
				}
				$template->assign_var('SUCCESS_MESSAGE', $user->lang['BOARD_DISABLE_SUCCESS']);

				// Find any extra tables and list them as options to remove
				if (!function_exists('get_tables'))
				{
					include(PHPBB_ROOT_PATH . 'includes/functions_install.' . PHP_EXT);
				}

				$existing_tables = get_tables($db);
				$tables = array_unique(array_merge(array_keys($cleaner->tables), $existing_tables));
				sort($tables);

				$template->assign_block_vars('section', array(
					'NAME'		=> $user->lang['DATABASE_TABLES'],
					'TITLE'		=> $user->lang['DATABASE_TABLES'],
				));

				foreach ($tables as $table)
				{
					if ((isset($cleaner->tables[$table]) && !in_array($table, $existing_tables)) || (!isset($cleaner->tables[$table]) && in_array($table, $existing_tables)))
					{
						$template->assign_block_vars('section.items', array(
							'NAME'			=> $table,
							'FIELD_NAME'	=> $table,
							'MISSING'		=> (isset($cleaner->tables[$table])) ? true : false,
						));
					}
				}

			break;

			case 2:

				// Remove the extra selected tables, and add the missing removed tables
				$error = array();
				if ($apply_changes)
				{
					if (!function_exists('get_tables'))
					{
						include(PHPBB_ROOT_PATH . 'includes/functions_install.' . PHP_EXT);
					}

					$existing_tables = get_tables($db);
					$tables = array_unique(array_merge(array_keys($cleaner->tables), $existing_tables));

					foreach ($tables as $table)
//.........这里部分代码省略.........
开发者ID:sietf,项目名称:sietf.org,代码行数:101,代码来源:database_cleaner.php


示例19: get_rows

function get_rows($table_id, $id = false)
{
    global $dbh;
    global $cms_user;
    $results = array();
    // Get table name info based on ID... forces to check if table exists
    $tables = get_tables();
    $table = $tables[$table_id];
    if ($table) {
        // If the user has header preferences for this table
        $results['header_fields'] = false;
        $results['sort_field'] = false;
        $sth = $dbh->prepare("SELECT * FROM `directus_preferences` WHERE `user` = :user AND `name` = :name ");
        $sth->bindParam(':user', $cms_user['id']);
        $sth->bindParam(':name', $table);
        $sth->execute();
        while ($user_table_preferences = $sth->fetch()) {
            $results[$user_table_preferences['type']] = $user_table_preferences['value'];
        }
        // Set the table names
        $results['table_id'] = $table_id;
        $results['name'] = $table;
        $results['name_uc'] = uc_table($table);
        // Get and set the table info
        $table_info = get_rows_info($table);
        $results['info'] = $table_info['info'];
        $results['active'] = $table_info['active'];
        $results['sort'] = $table_info['sort'];
        $results['num'] = $table_info['num'];
        $results['fields'] = $table_info['fields'];
        // Get the rows
        if ($id != 'bypass') {
            $query_rows = "SELECT * FROM `{$table}` WHERE 1=1 ";
            if ($id !== false) {
                // Check to make sure this is JUST an ID
                $id = intval($id);
                // Limit results to just this ID if given
                $query_rows .= "AND `id` = '{$id}' LIMIT 1 ";
                $results['item_id'] = $id;
            } else {
                //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                // Add or Update user field sort preference
                // Clean variables
                $_GET['direction'] = $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC';
                $_GET['sort'] = $_GET['sort'] == 'sort' || in_array($_GET['sort'], $results['fields']) ? $_GET['sort'] : false;
                if ($_GET['sort'] && $_GET['direction']) {
                    if ($results['sort_field']) {
                        $query = "UPDATE `directus_preferences` SET `value` = :value WHERE `user` = :user AND `name` = :name AND `type` = 'sort_field' ";
                    } else {
                        $query = "INSERT INTO `directus_preferences` SET `value` = :value, `user` = :user, `name` = :name, `type` = 'sort_field' ";
                    }
                    $results['sort_field'] = $_GET['sort'] . ' ' . $_GET['direction'];
                    $sth = $dbh->prepare($query);
                    $sth->bindParam(':user', $cms_user['id']);
                    $sth->bindParam(':name', $table);
                    $sth->bindParam(':value', $results['sort_field']);
                    $sth->execute();
                }
                if ($results['sort_field']) {
                    // Sort by user preferences
                    $query_rows .= $table_info['sort'] ? "ORDER BY " . $results['sort_field'] . ", `sort` ASC " : "ORDER BY " . $results['sort_field'] . " ";
                } else {
                    // Sort by SORT and ID if there is an sort field, or just ID if not
                    $query_rows .= $table_info['sort'] ? "ORDER BY `sort` ASC, `id` ASC " : "ORDER BY `id` ASC ";
                }
            }
            $results['sql'] = $query_rows;
            $results['rows'] = array();
            $sth = $dbh->query($query_rows);
            while ($row_rows = $sth->fetch()) {
                $results['rows'][$row_rows['id']] = $row_rows;
            }
        }
        return $results;
    } else {
        return false;
    }
}
开发者ID:Shairi,项目名称:directus-5-legacy,代码行数:78,代码来源:functions.php


示例20: critical_connect_check_db

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_tabs函数代码示例发布时间:2022-05-15
下一篇:
PHP get_table_prefix函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap