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


PHP mysql_get_server_info函数代码示例

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


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

示例1: db_connect

function db_connect()
{
    if (defined('CONN')) {
        return;
    }
    define('CONN', @mysql_pconnect(DBHOST, DBUSER, DBPASS));
    $db = @mysql_select_db(DBDATE, CONN);
    if (!CONN) {
        die('Verbindung nicht m&ouml;glich, bitte pr&uuml;fen Sie ihre mySQL Daten wie Passwort, Username und Host<br />');
    }
    if (!$db) {
        die('Kann Datenbank "' . DBDATE . '" nicht benutzen : ' . mysql_error(CONN));
    }
    if (function_exists('mysql_set_charset') and version_compare(mysql_get_server_info(CONN), '5.0.7') !== -1) {
        //Für ältere Installation die init.php nachladen
        if (!defined('ILCH_DB_CHARSET') && file_exists('include/includes/init.php')) {
            require_once 'include/includes/init.php';
        }
        mysql_set_charset(ILCH_DB_CHARSET, CONN);
    }
    $timeZoneSetted = false;
    if (function_exists('date_default_timezone_get')) {
        $timeZoneSetted = mysql_query('SET time_zone = "' . date_default_timezone_get() . '"');
    }
    if (!$timeZoneSetted && version_compare(PHP_VERSION, '5.1.3')) {
        $timeZoneSetted = mysql_query('SET time_zone = "' . date('P') . '"');
    }
}
开发者ID:kveldscholten,项目名称:Ilch-1.1,代码行数:28,代码来源:mysql.php

示例2: connect

 /**
  * 连接数据库方法
  * @access public
  * @throws ThinkExecption
  */
 public function connect($config='',$linkNum=0,$force=false) {
     if ( !isset($this->linkID[$linkNum]) ) {
         if(empty($config))  $config =   $this->config;
         // 处理不带端口号的socket连接情况
         $host = $config['hostname'].($config['hostport']?":{$config['hostport']}":'');
         // 是否长连接
         $pconnect   = !empty($config['params']['persist'])? $config['params']['persist']:$this->pconnect;
         if($pconnect) {
             $this->linkID[$linkNum] = mysql_pconnect( $host, $config['username'], $config['password'],131072);
         }else{
             $this->linkID[$linkNum] = mysql_connect( $host, $config['username'], $config['password'],true,131072);
         }
         if ( !$this->linkID[$linkNum] || (!empty($config['database']) && !mysql_select_db($config['database'], $this->linkID[$linkNum])) ) {
             E(mysql_error());
         }
         $dbVersion = mysql_get_server_info($this->linkID[$linkNum]);
         //使用UTF8存取数据库
         mysql_query("SET NAMES '".C('DB_CHARSET')."'", $this->linkID[$linkNum]);
         //设置 sql_model
         if($dbVersion >'5.0.1'){
             mysql_query("SET sql_mode=''",$this->linkID[$linkNum]);
         }
         // 标记连接成功
         $this->connected    =   true;
         // 注销数据库连接配置信息
         if(1 != C('DB_DEPLOY_TYPE')) unset($this->config);
     }
     return $this->linkID[$linkNum];
 }
开发者ID:bigsui,项目名称:php-learncode,代码行数:34,代码来源:Mysql.class.php

示例3: __connect

 /**
  * DB Connect
  * this method is private
  * @param array $connection connection's value is db_hostname, db_port, db_database, db_userid, db_password
  * @return resource
  */
 function __connect($connection)
 {
     // Ignore if no DB information exists
     if (strpos($connection["db_hostname"], ':') === false && $connection["db_port"]) {
         $connection["db_hostname"] .= ':' . $connection["db_port"];
     }
     // Attempt to connect
     $result = @mysql_connect($connection["db_hostname"], $connection["db_userid"], $connection["db_password"]);
     if (!$result) {
         exit('XE cannot connect to DB.');
     }
     if (mysql_error()) {
         $this->setError(mysql_errno(), mysql_error());
         return;
     }
     // Error appears if the version is lower than 4.1
     if (version_compare(mysql_get_server_info($result), '4.1', '<')) {
         $this->setError(-1, 'XE cannot be installed under the version of mysql 4.1. Current mysql version is ' . mysql_get_server_info());
         return;
     }
     // select db
     @mysql_select_db($connection["db_database"], $result);
     if (mysql_error()) {
         $this->setError(mysql_errno(), mysql_error());
         return;
     }
     return $result;
 }
开发者ID:perzona420,项目名称:xe-core,代码行数:34,代码来源:DBMysql.class.php

示例4: EchoConnInfo

function EchoConnInfo($conn)
{
	$str = GetBlock(mysql_get_host_info($conn));
	$str .= GetBlock(mysql_get_proto_info($conn));
	$str .= GetBlock(mysql_get_server_info($conn));
	echo $str;
}
开发者ID:xl7dev,项目名称:WebShell,代码行数:7,代码来源:ntunnel_mysql.php

示例5: connect

 function connect($db_user, $db_pass, $db_name, $db_location = 'localhost', $show_error = 1)
 {
     if (!($this->db_id = @mysql_connect($db_location, $db_user, $db_pass))) {
         if ($show_error == 1) {
             $this->display_error(mysql_error(), mysql_errno());
         } else {
             return false;
         }
     }
     if (!@mysql_select_db($db_name, $this->db_id)) {
         if ($show_error == 1) {
             $this->display_error(mysql_error(), mysql_errno());
         } else {
             return false;
         }
     }
     $this->mysql_version = mysql_get_server_info();
     if (!defined('COLLATE')) {
         define("COLLATE", "cp1251");
     }
     if (version_compare($this->mysql_version, '4.1', ">=")) {
         mysql_query("/*!40101 SET NAMES '" . COLLATE . "' */");
     }
     $this->connected = true;
     return true;
 }
开发者ID:Hadryan,项目名称:L2LWEB,代码行数:26,代码来源:mysql.class.php

示例6: db_version

 public function db_version($handle)
 {
     if (is_resource($handle)) {
         return mysql_get_server_info();
     }
     return null;
 }
开发者ID:archcidburnziso,项目名称:Bilboplanet,代码行数:7,代码来源:class.mysql.php

示例7: connect

 /**
  * 连接数据库方法
  * @access public
  * @throws ThinkExecption
  */
 public function connect()
 {
     if (!$this->connected) {
         $config = $this->config;
         // 处理不带端口号的socket连接情况
         $host = $config['hostname'] . ($config['hostport'] ? ":{$config['hostport']}" : '');
         $pconnect = !empty($config['params']['persist']) ? $config['params']['persist'] : $this->pconnect;
         if ($pconnect) {
             $this->linkID = mysql_pconnect($host, $config['username'], $config['password'], CLIENT_MULTI_RESULTS);
         } else {
             $this->linkID = mysql_connect($host, $config['username'], $config['password'], true, CLIENT_MULTI_RESULTS);
         }
         if (!$this->linkID || !empty($config['database']) && !mysql_select_db($config['database'], $this->linkID)) {
             throw_exception(mysql_error());
         }
         $dbVersion = mysql_get_server_info($this->linkID);
         if ($dbVersion >= "4.1") {
             //使用UTF8存取数据库 需要mysql 4.1.0以上支持
             mysql_query("SET NAMES '" . C('DB_CHARSET') . "'", $this->linkID);
         }
         //设置 sql_model
         if ($dbVersion > '5.0.1') {
             mysql_query("SET sql_mode=''", $this->linkID);
         }
         // 标记连接成功
         $this->connected = true;
         // 注销数据库连接配置信息
         unset($this->config);
     }
 }
开发者ID:DoveChen,项目名称:tp,代码行数:35,代码来源:Db.class.php

示例8: connect

 /**
  * 连接数据库
  * param  string  $dbhost		数据库主机名<br/>
  * param  string  $dbuser		数据库用户名<br/>
  * param  string  $dbpw			数据库密码<br/>
  * param  string  $dbname		数据库名称<br/>
  * param  string  $dbcharset	数据库字符集<br />
  * param  string  $pconnect		持久链接,1为开启,0为关闭
  * return bool
  **/
 function connect($dbhost, $dbuser, $dbpwd, $dbname = '', $dbcharset = 'utf8', $pconnect = 0)
 {
     if ($pconnect) {
         if (!($this->link_id = mysql_pconnect($dbhost, $dbuser, $dbpwd))) {
             $this->ErrorMsg();
         }
     } else {
         if (!($this->link_id = mysql_connect($dbhost, $dbuser, $dbpwd, 1))) {
             $this->ErrorMsg();
         }
     }
     $this->version = mysql_get_server_info($this->link_id);
     if ($this->getVersion() > '4.1') {
         if ($dbcharset) {
             mysql_query("SET character_set_connection=" . $dbcharset . ", character_set_results=" . $dbcharset . ", character_set_client=binary", $this->link_id);
         }
         if ($this->getVersion() > '5.0.1') {
             mysql_query("SET sql_mode=''", $this->link_id);
         }
     }
     if (mysql_select_db($dbname, $this->link_id) === false) {
         $this->ErrorMsg();
     }
     mysql_query("set names utf8;");
 }
开发者ID:sdgdsffdsfff,项目名称:crm,代码行数:35,代码来源:db_function.php

示例9: url

	function url($action = 'check') {
        $modules = '';
        $site = getcache('sitelist','commons');
        $sitename = $site['1']['name'];
		$siturl = $site['1']['domain'];
        foreach ($site as $list) $sitelist .= $list['domain'].',';
		$pars = array(
			'action'=>$action,
			'ZLCMS_username'=>'',
			'sitename'=>$sitename,
			'siteurl'=>$siturl,
			'charset'=>CHARSET,
			'version'=>PC_VERSION,
			'release'=>PC_RELEASE,
			'os'=>PHP_OS,
			'php'=>phpversion(),
			'mysql'=>mysql_get_server_info(),
			'browser'=>urlencode($_SERVER['HTTP_USER_AGENT']),
			'username'=>urlencode(param::get_cookie('admin_username')),
			'email'=> urlencode(param::get_cookie('admin_email')),
			'modules'=>ROUTE_M,
			'sitelist'=>urlencode($sitelist),
			'uuid'=>urlencode($this->uuid),
			);
		$data = http_build_query($pars);
		$verify = md5($this->uuid);		
		if($s = $this->module()) {
			$p = '&p='.$s;
		}
		return $this->update_url.'?'.$data.'&verify='.$verify.$p;
	}
开发者ID:panhongsheng,项目名称:zl_cms,代码行数:31,代码来源:update.class.php

示例10: getDBVersion

 function getDBVersion()
 {
     if (!$this->v('db_version')) {
         $this->db_version = preg_match("/^([0-9]+)\\.([0-9]+)\\.([0-9]+)/", mysql_get_server_info($this->getDBCon()), $m) ? sprintf("%02d-%02d-%02d", $m[1], $m[2], $m[3]) : '00-00-00';
     }
     return $this->db_version;
 }
开发者ID:joedevon,项目名称:arc2,代码行数:7,代码来源:ARC2_Store.php

示例11: execute

 /**
  * Execute the script
  *
  * @param void
  * @return boolean
  */
 function execute()
 {
     // ---------------------------------------------------
     //  Check MySQL version
     // ---------------------------------------------------
     $mysql_version = mysql_get_server_info($this->database_connection);
     if ($mysql_version && version_compare($mysql_version, '4.1', '>=')) {
         $constants['DB_CHARSET'] = 'utf8';
         @mysql_query("SET NAMES 'utf8'", $this->database_connection);
         tpl_assign('default_collation', $default_collation = 'collate utf8_unicode_ci');
         tpl_assign('default_charset', $default_charset = 'DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci');
     } else {
         tpl_assign('default_collation', $default_collation = '');
         tpl_assign('default_charset', $default_charset = '');
     }
     // if
     tpl_assign('table_prefix', TABLE_PREFIX);
     // ---------------------------------------------------
     //  Execute migration
     // ---------------------------------------------------
     $total_queries = 0;
     $executed_queries = 0;
     $upgrade_script = tpl_fetch(get_template_path('db_migration/1_0_milanga'));
     if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
         $this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
     } else {
         $this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
         return false;
     }
     // if
     $this->printMessage('Feng Office has been upgraded. You are now running Feng Office ' . $this->getVersionTo() . ' Enjoy!');
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:38,代码来源:MilangaUpgradeScript.class.php

示例12: welcome

 public function welcome()
 {
     /* 系统信息 */
     $conn = mysql_connect(C('DB_HOST'), C('DB_USER'), C('DB_PWD'));
     $gd = gd_version();
     $sys_info['os'] = PHP_OS;
     $sys_info['ip'] = $_SERVER['SERVER_ADDR'];
     $sys_info['web_server'] = $_SERVER['SERVER_SOFTWARE'];
     $sys_info['php_ver'] = PHP_VERSION;
     $sys_info['mysql_ver'] = mysql_get_server_info($conn);
     $sys_info['zlib'] = function_exists('gzclose') ? L('yes') : L('no');
     $sys_info['safe_mode'] = (boolean) ini_get('safe_mode') ? L('yes') : L('no');
     $sys_info['safe_mode_gid'] = (boolean) ini_get('safe_mode_gid') ? L('yes') : L('no');
     $sys_info['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : L('no_timezone');
     $sys_info['socket'] = function_exists('fsockopen') ? L('yes') : L('no');
     
     if ($gd == 0) {
         $sys_info['gd'] = 'N/A';
     } else {
         if ($gd == 1) {
             $sys_info['gd'] = 'GD1';
         } else {
             $sys_info['gd'] = 'GD2';
         }
         
         $sys_info['gd'] .= ' (';
         
         /* 检查系统支持的图片类型 */
         if ($gd && (imagetypes() & IMG_JPG) > 0) {
             $sys_info['gd'] .= ' JPEG';
         }
         
         if ($gd && (imagetypes() & IMG_GIF) > 0) {
             $sys_info['gd'] .= ' GIF';
         }
         
         if ($gd && (imagetypes() & IMG_PNG) > 0) {
             $sys_info['gd'] .= ' PNG';
         }
         
         $sys_info['gd'] .= ')';
     }
     
     /* IP库版本 */
     $sys_info['ip_version'] = ecs_geoip('255.255.255.0');
     
     /* 允许上传的最大文件大小 */
     $sys_info['max_filesize'] = ini_get('upload_max_filesize');
     $this->assign('sys_info', $sys_info);
     
     $this->assign('ecs_version', VERSION);
     $this->assign('ecs_release', RELEASE);
     $this->assign('ecs_charset', strtoupper(EC_CHARSET));
     $this->assign('install_date', local_date(C('date_format'), C('install_date')));
     // 检测是否授权
     $data = array('appid' => ECTOUCH_AUTH_KEY);
     $empower = $this->cloud->data($data)->act('get.license');
     $this->assign('empower', $empower);
     $this->display('welcome');
 }
开发者ID:sayi21cn,项目名称:ecshopAndEctouch,代码行数:60,代码来源:IndexController.class.php

示例13: DB

 function DB()
 {
     global $txpcfg;
     $this->host = $txpcfg['host'];
     $this->db = $txpcfg['db'];
     $this->user = $txpcfg['user'];
     $this->pass = $txpcfg['pass'];
     $this->client_flags = isset($txpcfg['client_flags']) ? $txpcfg['client_flags'] : 0;
     $this->link = @mysql_connect($this->host, $this->user, $this->pass, false, $this->client_flags);
     if (!$this->link) {
         die(db_down());
     }
     $this->version = mysql_get_server_info();
     if (!$this->link) {
         $GLOBALS['connected'] = false;
     } else {
         $GLOBALS['connected'] = true;
     }
     @mysql_select_db($this->db) or die(db_down());
     $version = $this->version;
     // be backwardscompatible
     if (isset($txpcfg['dbcharset']) && (intval($version[0]) >= 5 || preg_match('#^4\\.[1-9]#', $version))) {
         mysql_query("SET NAMES " . $txpcfg['dbcharset']);
     }
 }
开发者ID:bgarrels,项目名称:textpattern,代码行数:25,代码来源:txplib_db.php

示例14: createTable

 protected function createTable()
 {
     $sql = file_get_contents(dirname(__FILE__) . '/sae.sql');
     $tablepre = C('DB_PREFIX');
     $tablesuf = C('DB_SUFFIX');
     $dbcharset = C('DB_CHARSET');
     $sql = str_replace("\r", "\n", $sql);
     $ret = array();
     $num = 0;
     foreach (explode(";\n", trim($sql)) as $query) {
         $queries = explode("\n", trim($query));
         foreach ($queries as $query) {
             $ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query;
         }
         $num++;
     }
     unset($sql);
     foreach ($ret as $query) {
         $query = trim($query);
         if ($query) {
             if (substr($query, 0, 12) == 'CREATE TABLE') {
                 $name = preg_replace("/CREATE TABLE ([a-z0-9_]+) .*/is", "\\1", $query);
                 $type = strtoupper(preg_replace("/^\\s*CREATE TABLE\\s+.+\\s+\\(.+?\\).*(ENGINE|TYPE)\\s*=\\s*([a-z]+?).*\$/isU", "\\2", $query));
                 $type = in_array($type, array('MYISAM', 'HEAP')) ? $type : 'MYISAM';
                 $query = preg_replace("/^\\s*(CREATE TABLE\\s+.+\\s+\\(.+?\\)).*\$/isU", "\\1", $query) . (mysql_get_server_info() > '4.1' ? " ENGINE={$type} DEFAULT CHARSET={$dbcharset}" : " TYPE={$type}");
             }
             self::$db->runSql($query);
         }
     }
 }
开发者ID:zjstage,项目名称:ThinkPHP,代码行数:30,代码来源:SaeObject.class.php

示例15: dumper

 function dumper()
 {
     $this->SET['comp_method'] = '';
     $this->SET['comp_level'] = 5;
     $this->backup_file = $this->restore_file = '';
     $this->comp_methods = array();
     // Версия MySQL вида 40101
     preg_match("/^(\\d+)\\.(\\d+)\\.(\\d+)/", mysql_get_server_info(), $m);
     $this->mysql_version = sprintf("%d%02d%02d", $m[1], $m[2], $m[3]);
     $this->only_create = explode(',', ONLY_CREATE);
     $this->forced_charset = false;
     $this->restore_charset = $this->restore_collate = '';
     if (preg_match("/^(forced->)?(([a-z0-9]+)(\\_\\w+)?)\$/", RESTORE_CHARSET, $matches)) {
         $this->forced_charset = $matches[1] == 'forced->';
         $this->restore_charset = $matches[3];
         $this->restore_collate = !empty($matches[4]) ? ' COLLATE ' . $matches[2] : '';
     }
     $this->comp_methods[] = array('id' => '0', 'text' => TEXT_INFO_USE_NO_COMPRESSION);
     if (function_exists("gzopen")) {
         $this->comp_methods[] = array('id' => 'gz', 'text' => TEXT_INFO_USE_GZIP);
     }
     if (function_exists("bzopen")) {
         $this->comp_methods[] = array('id' => 'bz2', 'text' => TEXT_INFO_USE_BZIP2);
     }
 }
开发者ID:rabbit-source,项目名称:setbook.ru,代码行数:25,代码来源:backup.php


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