public function getAttribute($attribute, &$source = null, $func = 'PDO::getAttribute', &$last_error = null) { if ($source == null) { $source =& $this->driver_options; } switch ($attribute) { case EhrlichAndreas_Pdo_Abstract::ATTR_AUTOCOMMIT: $result = mysql_unbuffered_query('SELECT @@AUTOCOMMIT', $this->link); if (!$result) { $this->set_driver_error(null, EhrlichAndreas_Pdo_Abstract::ERRMODE_EXCEPTION, $func); } $row = mysql_fetch_row($result); mysql_free_result($result); return intval($row[0]); break; case EhrlichAndreas_Pdo_Abstract::ATTR_TIMEOUT: return intval(ini_get('mysql.connect_timeout')); break; case EhrlichAndreas_Pdo_Abstract::ATTR_CLIENT_VERSION: return mysql_get_client_info(); break; case EhrlichAndreas_Pdo_Abstract::ATTR_CONNECTION_STATUS: return mysql_get_host_info($this->link); break; case EhrlichAndreas_Pdo_Abstract::ATTR_SERVER_INFO: return mysql_stat($this->link); break; case EhrlichAndreas_Pdo_Abstract::ATTR_SERVER_VERSION: return mysql_get_server_info($this->link); break; default: return parent::getAttribute($attribute, $source, $func, $last_error); break; } }
public static function castMysqlLink($h, array $a, Stub $stub, $isNested) { $a['host'] = mysql_get_host_info($h); $a['protocol'] = mysql_get_proto_info($h); $a['server'] = mysql_get_server_info($h); return $a; }
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; }
function connectMySQL() { try { $conexion = mysql_connect($this->host, $this->username, $this->password); //Establece la conexión con el servidor if ($conexion) { echo 'Conexion exitosa.'; echo "<br>Info: "; echo "<br>Host: "; echo mysql_get_host_info(); echo "<br>Server: "; echo mysql_get_server_info(); } else { die('<br>Imposible conectar: ' . mysql_error()); } $db = mysql_select_db($this->nameDB, $conexion); //Establece la conexión con una base de datos del servidor } catch (Exception $e) { echo "Error, falló la conexión con la base de datos"; echo $e->getMessage(); //Devuelve el mensaje de la exception echo $e->getCode(); //Devuelve el código de la Execption(Integer) echo $e->getLine(); //Devuelve la línea donde se lanzó la execption } }
function bmDebug() { global $pommo; echo "\n\n<br><br><b>BASIC DEBUG</b><hr><br>\n\n"; echo "\n\nPHP: " . phpversion() . "<br><br>\n\n"; echo "\n\nMYSQL CLIENT: " . mysql_get_client_info() . "<br><br>\n\n"; echo "\n\nMYSQL HOST: " . mysql_get_host_info() . "<br><br>\n\n"; echo "\n\nMYSQL SERVER: " . mysql_get_server_info() . "<br><br>\n\n"; echo "\n\nBACKTRACE: " . $this->bmBacktrace() . "<br><br>\n\n"; echo "\nBaseURL:" . Pommo::$_baseUrl . "<br>\n"; echo "\n HTTP:" . Pommo::$_http . "<br>\n"; echo "\nBaseDir: " . Pommo::$_baseDir . "<br>\n"; echo "\nWorkDir:" . Pommo::$_workDir . "<br>\n"; echo "\nLang:" . Pommo::$_lang . "<br>\n"; echo "\nVerbosity:" . Pommo::$_verbosity . "<br>\n"; echo "\nRevision: " . Pommo::$_revision . "<br>\n"; echo "\nSection: " . Pommo::$_section . "<br>\n"; echo "\n\n<br><br><b>CONFIG DEBUG</b><hr><br>\n\n"; $config = Pommo_Api::configGet('all'); if (!empty($config)) { echo "\n\n<br>CONFIG:<br>\n\n"; foreach ($config as $name => $value) { if ($name == 'admin_username' || $name == 'admin_password') { $value = '**CENSOR** - ' . strlen($value); } elseif ($name == 'messages') { continue; } echo "\n{$name}: {$value} <br>\n"; } } else { echo "\n\n<br>CONFIG: could not load\n\n"; } }
/** * * Systemstatus anzeigen * */ public function showSystemStatus($ErrorString = "", $StatusString = "") { //if(!Controler_Main::getInstance()->isUserLoggedIn())//if( $this->User->getUserLevel() < BACKEND_USERLEVEL ) if (Controler_Main::getInstance()->getUserLevel() < BACKEND_USERLEVEL) { $ControlerStart = new Controler_Start(); $ControlerStart->start(); return false; } $Request = new Request(); /* $SystemInformationFinder= new SystemInformationFinder(); $MySql = $SystemInformationFinder->mysqlVersion(); $MySqlVersion = $MySql[0]['s_MySqlVersion']; */ $PHPVersion = phpversion(); $WebserverVersion = $_SERVER['SERVER_SOFTWARE']; $WebserverVersion = "<div class='befehlskontainer' >" . str_replace(" ", "</div><div class='befehlskontainer' >", $WebserverVersion) . "</div>"; $WebserverConfig = "<div class='befehlskontainer' >:T_SERVER_NAME:: " . $_SERVER['SERVER_NAME'] . "</div><div class='befehlskontainer' >"; $WebserverConfig .= ":T_SERVER_ADDR:: " . $_SERVER['SERVER_ADDR'] . "</div><div class='befehlskontainer' >"; $WebserverConfig .= ":T_SERVER_PORT:: " . $_SERVER['SERVER_PORT'] . "</div><div class='befehlskontainer' >"; $WebserverConfig .= ":T_REMOTE_ADDR:: " . $_SERVER['REMOTE_ADDR'] . "</div><div class='befehlskontainer' >"; $WebserverConfig .= ":T_DOCUMENT_ROOT:: " . $_SERVER['DOCUMENT_ROOT'] . "</div><div class='befehlskontainer' >"; $WebserverConfig .= ":T_SERVER_ADMIN:: " . $_SERVER['SERVER_ADMIN'] . "</div>"; $Template = Template::getInstance("tpl_BE_SystemStatus.php"); $Template->assign("UserId", Controler_Main::getInstance()->getUser()->getId()); $Template->assign("WebserverConfig", $WebserverConfig); $Template->assign("WebserverVersion", $WebserverVersion); $Template->assign("PHPVersion", $PHPVersion); $Template->assign("MySqlVersion", mysql_get_server_info()); $Template->assign("MySqlClientInfo", mysql_get_client_info()); $Template->assign("MySqlProtInfo", mysql_get_proto_info()); $Template->assign("MySqlHostInfo", mysql_get_host_info()); $Template->render(); }
function sql_connect($server, $username, $password, $database) { global $dconf, $debug; if (!strlen(trim($server))) { print "<h4>MySQL server not specified</h4>\n"; return false; } if (!strlen(trim($username))) { print "<h4>MySQL server username not specified</h4>\n"; return false; } if ($dconf[verbose]) { print "<pre>Connecting to mysql://" . $username . "@" . $server . "/" . $database . "...</pre>\n"; } if (!strlen(trim($password))) { $myc = mysql_connect($server, $username); } else { $myc = mysql_connect($server, $username, $password); } if (!$myc) { print "<h4>Unable to connect to " . $server . "</h4>\n"; return false; } if ($dconf[verbose]) { print "Connected to MySQL server " . mysql_get_server_info() . " at " . mysql_get_host_info() . "\n"; } if (!mysql_select_db($database)) { print "<h4>Could not select database " . $database . "</h4>\n"; return false; } if ($dconf[verbose]) { print "<pre>Database " . $database . " selected</pre>\n"; } return $myc; }
public function index() { $this->assign('extensions', get_loaded_extensions()); $this->assign('pagetitle', '首页--ThinkPHP助手'); $this->assign('php_version', PHP_VERSION); if (strcmp(PHP_VERSION, "5.4.0") < 0) { $this->assign('mysql_client', mysql_get_client_info()); $this->assign('mysql_host', mysql_get_host_info()); $this->assign('mysql_server', mysql_get_server_info()); } cookie('version', THINK_VERSION); $this->display('index'); }
function get_details() { $result = $this->_owner->query('SHOW VARIABLES', false, true); while ($row = mysql_fetch_row($result)) { $details[$row[0]] = $row[1]; } mysql_free_result($result); $details['engine'] = 'MySQL'; $details['client'] = mysql_get_client_info(); $details['server'] = mysql_get_server_info($this->_owner->connect_id); $details['unicode'] = version_compare($details['server'], '4.1') >= 0; $details['host'] = mysql_get_host_info($this->_owner->connect_id); return $details; }
/** * @inheritdoc */ public function get(VariableWrapper $data) { if (!$this->supports($data)) { throw new \Ladybug\Exception\InvalidInspectorClassException(); } /** @var $collection CollectionType */ $collection = $this->extendedTypeFactory->factory('collection', $this->level); $var = $data->getData(); $collection->add($this->createTextType(mysql_get_host_info($var), 'Host info')); $collection->add($this->createTextType(mysql_get_proto_info($var), 'Protocol version')); $collection->add($this->createTextType(mysql_get_server_info($var), 'Server version')); $collection->setTitle('MySQL connection'); $collection->setLevel($this->level); return $collection; }
public function connect($dbIP, $dbUser, $dbPass, $dbName, $dbPort = null) { // check parameters if ($dbIP == '') { die('<b>ERROR:</b> no database host provided... <b>system/libs/phpDB.php, line 32</b>'); } if ($dbName == '') { die('<b>ERROR:</b> no database name provided... <b>system/libs/phpDB.php, line 33</b>'); } if ($dbUser == '') { die('<b>ERROR:</b> no database user provided... <b>system/libs/phpDB.php, line 34</b>'); } //if ($dbPass == '') die('no database password provided'); // connect if ($this->dbType == 'postgres') { $this->dbConn = pg_connect("host={$dbIP} " . ($dbPort != null ? "port={$dbPort} " : "") . "dbname={$dbName} user={$dbUser} password={$dbPass}"); if (!$this->dbConn) { $this->dbConn = null; print "<b>ERROR:</b> Cannot connect to postgres.<br>"; return false; } $this->dbVersion = pg_version($this->dbConn); $this->dbVersion['host'] = pg_host($this->dbConn); } if ($this->dbType == 'mysql') { $this->dbConn = mysql_connect($dbIP . ($dbPort != null ? ":" . $dbPort : ""), $dbUser, $dbPass); if (!$this->dbConn) { $this->dbConn = null; print "<b>ERROR:</b> Cannot connect to mysql.<br>"; return false; } mysql_select_db($dbName); $this->dbVersion = array(); $this->dbVersion['client'] = mysql_get_client_info(); $this->dbVersion['protocol'] = mysql_get_proto_info($this->dbConn); $this->dbVersion['server'] = mysql_get_server_info($this->dbConn); $this->dbVersion['host'] = mysql_get_host_info($this->dbConn); } }
function check_conn($action = '') { if (!($host = @mysql_get_host_info($this->conn))) { switch ($action) { case 'kill': return $host; break; case 'check': return $host; break; default: case 'active': if (!($this->conn = @mysql_connect($this->host, $this->user, $this->pass))) { $this->verbose("CONNECTION TO {$this->host} FAILED"); return FALSE; } $this->verbose("CONNECTION TO {$this->host} ESTABLISHED"); $this->select_db(); return @mysql_get_host_info($this->conn); break; } } else { switch ($action) { case 'kill': @mysql_close($this->conn); $this->conn = $this->db = null; return true; break; case 'check': return $host; break; default: case 'active': return $host; break; } } }
</div> <div class="tab-page" id="sysinfoDesc"> <h2 class="tab"><?php echo $_lang["click_to_view_details"]; ?> </h2> <script type="text/javascript">tp.addTabPage( document.getElementById( "sysinfoDesc" ) );</script> <div class="sectionHeader">サポートに必要な情報</div> <div class="sectionBody" style="padding:10px 20px;"> <p> <a href="http://forum.modx.jp/" target="_blank">公式フォーラム</a>でサポートを受けることができます。以下の情報を付記いただくと解決の助けとなります。<br /> <a href="index.php?a=114">イベントログ</a>に重要なヒントが記録されていることもあります。 </p> <?php $info = array('OS' => php_uname('s') . ' ' . php_uname('r') . ' ' . php_uname('v') . ' ' . php_uname('m'), 'PHPのバージョン' => PHP_VERSION, 'セーフモード' => ini_get('safe_mode') == 0 ? 'off' : 'on', 'php_sapi_name' => php_sapi_name(), 'MySQLのバージョン' => $modx->db->getVersion(), 'MySQLホスト情報' => mysql_get_host_info(), 'MODXのバージョン' => $modx_version, 'サイトのURL' => $modx->config['site_url'], 'ホスト名' => gethostbyaddr(getenv('SERVER_ADDR')), 'MODX_BASE_URL' => MODX_BASE_URL, 'upload_tmp_dir' => ini_get('upload_tmp_dir') . '(ファイルアップロード処理のために一時的なファイル保存領域として用いるテンポラリディレクトリ。この値が空になっている時は、OSが認識するテンポラリディレクトリが用いられます)', 'memory_limit' => ini_get('memory_limit') . '(スクリプトが確保できる最大メモリ。通常はpost_max_sizeよりも大きい値にしますが、memory_limit・post_max_size・upload_max_filesizeの3つの値を同一に揃えても支障ありません。)', 'post_max_size' => ini_get('post_max_size') . '(POSTデータに許可される最大サイズ。POSTには複数のデータが含まれるので、通常はupload_max_filesizeよりも大きい値にします)', 'upload_max_filesize' => ini_get('upload_max_filesize') . '(アップロードを受け付けるファイルの最大サイズ)', 'max_execution_time' => ini_get('max_execution_time') . '秒(PHP処理の制限時間。スクリプト暴走の継続を防止します)', 'max_input_time' => ini_get('max_input_time') . '秒(POST・GET・ファイルアップロードなどの入力を処理する制限時間。回線の太さの影響を受けることもあります)', 'session.save_path' => ini_get('session.save_path') . '(セッションデータを保存するディレクトリ。CGI版PHPの場合はユーザの違いが原因でここに書き込み権限がない場合があるため、注意が必要です)', 'magic_quotes_gpc' => get_magic_quotes_gpc() ? 'On' : 'Off' . '(クォート文字を自動的にエスケープします。トラブルの元になりやすいためOffを推奨します)'); echo '<p>' . getenv('SERVER_SOFTWARE') . '</p>' . "\n" . "\n"; echo '<table style="margin-bottom:20px;">'; foreach ($info as $key => $value) { echo '<tr><td style="padding-right:30px;vertical-align:top;">' . $key . '</td><td>' . $value . '</td></tr>' . "\n"; } echo '</table>' . "\n"; echo '<h4>mbstring</h4>' . "\n" . "\n"; echo '<table style="margin-bottom:20px;">'; $mbstring_array = array('mbstring.detect_order', 'mbstring.encoding_translation', 'mbstring.func_overload', 'mbstring.output_buffering', 'mbstring.http_input', 'mbstring.http_output', 'mbstring.internal_encoding', 'mbstring.language', 'mbstring.strict_detection', 'mbstring.substitute_character'); foreach ($mbstring_array as $v) { $key = $v; $value = ini_get($v) !== false ? ini_get($v) : 'no value'; echo '<tr><td style="padding-right:30px;">' . $key . '</td><td>' . $value . '</td></tr>' . "\n"; } echo '</table>' . "\n";
/** * Test mysql_get_host_info * * @return boolean */ public function MySQL_Get_Host_Info_Test() { $str1 = mysql_get_host_info(); return stripos($str1, 'via'); }
public function getDbInfo() { $charsets = $this->getCharsetInfo(); $charset_str = array(); foreach ($charsets as $name => $value) { $charset_str[] = "{$name} = {$value}"; } return array("MySQL Version" => @mysql_get_client_info(), "MySQL Host Info" => @mysql_get_host_info($this->database), "MySQL Server Info" => @mysql_get_server_info($this->database), "MySQL Client Encoding" => @mysql_client_encoding($this->database), "MySQL Character Set Settings" => join(", ", $charset_str)); }
/** * Evaluates the given variable * * @param mixed &$subject Variable to query * @param bool $specialStr Should this be interpreted as a special string? * @return mixed Result (both HTML and text modes generate strings) */ protected function evaluate(&$subject, $specialStr = false) { switch ($type = gettype($subject)) { // https://github.com/digitalnature/php-ref/issues/13 case 'unknown type': return $this->fmt->text('unknown'); // null value // null value case 'NULL': return $this->fmt->text('null'); // integer/double/float // integer/double/float case 'integer': case 'double': return $this->fmt->text($type, $subject, $type); // boolean // boolean case 'boolean': $text = $subject ? 'true' : 'false'; return $this->fmt->text($text, $text, $type); // arrays // arrays case 'array': // empty array? if (empty($subject)) { $this->fmt->text('array'); return $this->fmt->emptyGroup(); } if (isset($subject[static::MARKER_KEY])) { unset($subject[static::MARKER_KEY]); $this->fmt->text('array'); $this->fmt->emptyGroup('recursion'); return; } // first recursion level detection; // this is optional (used to print consistent recursion info) foreach ($subject as $key => &$value) { if (!is_array($value)) { continue; } // save current value in a temporary variable $buffer = $value; // assign new value $value = $value !== 1 ? 1 : 2; // if they're still equal, then we have a reference if ($value === $subject) { $value = $buffer; $value[static::MARKER_KEY] = true; $this->evaluate($value); return; } // restoring original value $value = $buffer; } $this->fmt->text('array'); $count = count($subject); if (!$this->fmt->startGroup($count)) { return; } $max = max(array_map('static::strLen', array_keys($subject))); $subject[static::MARKER_KEY] = true; foreach ($subject as $key => &$value) { // ignore our temporary marker if ($key === static::MARKER_KEY) { continue; } if ($this->hasInstanceTimedOut()) { break; } $keyInfo = gettype($key); if ($keyInfo === 'string') { $encoding = static::$env['mbStr'] ? mb_detect_encoding($key) : ''; $keyLen = $encoding && $encoding !== 'ASCII' ? static::strLen($key) . '; ' . $encoding : static::strLen($key); $keyInfo = "{$keyInfo}({$keyLen})"; } else { $keyLen = strlen($key); } $this->fmt->startRow(); $this->fmt->text('key', $key, "Key: {$keyInfo}"); $this->fmt->colDiv($max - $keyLen); $this->fmt->sep('=>'); $this->fmt->colDiv(); $this->evaluate($value, $specialStr); $this->fmt->endRow(); } unset($subject[static::MARKER_KEY]); $this->fmt->endGroup(); return; // resource // resource case 'resource': $meta = array(); $resType = get_resource_type($subject); $this->fmt->text('resource', strval($subject)); if (!static::$config['showResourceInfo']) { return $this->fmt->emptyGroup($resType); } // @see: http://php.net/manual/en/resource.php // need to add more... switch ($resType) { // curl extension resource case 'curl': $meta = curl_getinfo($subject); break; case 'FTP Buffer': $meta = array('time_out' => ftp_get_option($subject, FTP_TIMEOUT_SEC), 'auto_seek' => ftp_get_option($subject, FTP_AUTOSEEK)); break; // gd image extension resource // gd image extension resource case 'gd': $meta = array('size' => sprintf('%d x %d', imagesx($subject), imagesy($subject)), 'true_color' => imageistruecolor($subject)); break; case 'ldap link': $constants = get_defined_constants(); array_walk($constants, function ($value, $key) use(&$constants) { if (strpos($key, 'LDAP_OPT_') !== 0) { unset($constants[$key]); } }); // this seems to fail on my setup :( unset($constants['LDAP_OPT_NETWORK_TIMEOUT']); foreach (array_slice($constants, 3) as $key => $value) { if (ldap_get_option($subject, (int) $value, $ret)) { $meta[strtolower(substr($key, 9))] = $ret; } } break; // mysql connection (mysql extension is deprecated from php 5.4/5.5) // mysql connection (mysql extension is deprecated from php 5.4/5.5) case 'mysql link': case 'mysql link persistent': $dbs = array(); $query = @mysql_list_dbs($subject); while ($row = @mysql_fetch_array($query)) { $dbs[] = $row['Database']; } $meta = array('host' => ltrim(@mysql_get_host_info($subject), 'MySQL host info: '), 'server_version' => @mysql_get_server_info($subject), 'protocol_version' => @mysql_get_proto_info($subject), 'databases' => $dbs); break; // mysql result // mysql result case 'mysql result': while ($row = @mysql_fetch_object($subject)) { $meta[] = (array) $row; if ($this->hasInstanceTimedOut()) { break; } } break; // stream resource (fopen, fsockopen, popen, opendir etc) // stream resource (fopen, fsockopen, popen, opendir etc) case 'stream': $meta = stream_get_meta_data($subject); break; } if (!$meta) { return $this->fmt->emptyGroup($resType); } if (!$this->fmt->startGroup($resType)) { return; } $max = max(array_map('static::strLen', array_keys($meta))); foreach ($meta as $key => $value) { $this->fmt->startRow(); $this->fmt->text('resourceProp', ucwords(str_replace('_', ' ', $key))); $this->fmt->colDiv($max - static::strLen($key)); $this->fmt->sep(':'); $this->fmt->colDiv(); $this->evaluate($value); $this->fmt->endRow(); } $this->fmt->endGroup(); return; // string // string case 'string': $length = static::strLen($subject); $encoding = static::$env['mbStr'] ? mb_detect_encoding($subject) : false; $info = $encoding && $encoding !== 'ASCII' ? $length . '; ' . $encoding : $length; if ($specialStr) { $this->fmt->sep('"'); $this->fmt->text(array('string', 'special'), $subject, "string({$info})"); $this->fmt->sep('"'); return; } $this->fmt->text('string', $subject, "string({$info})"); // advanced checks only if there are 3 characteres or more if (static::$config['showStringMatches'] && $length > 2 && trim($subject) !== '') { $isNumeric = is_numeric($subject); // very simple check to determine if the string could match a file path // @note: this part of the code is very expensive $isFile = $length < 2048 && max(array_map('strlen', explode('/', str_replace('\\', '/', $subject)))) < 128 && !preg_match('/[^\\w\\.\\-\\/\\\\:]|\\..*\\.|\\.$|:(?!(?<=^[a-zA-Z]:)[\\/\\\\])/', $subject); if ($isFile) { try { $file = new \SplFileInfo($subject); $flags = array(); $perms = $file->getPerms(); if (($perms & 0xc000) === 0xc000) { // socket $flags[] = 's'; } elseif (($perms & 0xa000) === 0xa000) { // symlink $flags[] = 'l'; } elseif (($perms & 0x8000) === 0x8000) { // regular $flags[] = '-'; } elseif (($perms & 0x6000) === 0x6000) { // block special $flags[] = 'b'; } elseif (($perms & 0x4000) === 0x4000) { // directory $flags[] = 'd'; } elseif (($perms & 0x2000) === 0x2000) { // character special $flags[] = 'c'; } elseif (($perms & 0x1000) === 0x1000) { // FIFO pipe $flags[] = 'p'; } else { // unknown $flags[] = 'u'; } // owner $flags[] = $perms & 0x100 ? 'r' : '-'; $flags[] = $perms & 0x80 ? 'w' : '-'; $flags[] = $perms & 0x40 ? $perms & 0x800 ? 's' : 'x' : ($perms & 0x800 ? 'S' : '-'); // group $flags[] = $perms & 0x20 ? 'r' : '-'; $flags[] = $perms & 0x10 ? 'w' : '-'; $flags[] = $perms & 0x8 ? $perms & 0x400 ? 's' : 'x' : ($perms & 0x400 ? 'S' : '-'); // world $flags[] = $perms & 0x4 ? 'r' : '-'; $flags[] = $perms & 0x2 ? 'w' : '-'; $flags[] = $perms & 0x1 ? $perms & 0x200 ? 't' : 'x' : ($perms & 0x200 ? 'T' : '-'); $size = is_dir($subject) ? '' : sprintf(' %.2fK', $file->getSize() / 1024); $this->fmt->startContain('file', true); $this->fmt->text('file', implode('', $flags) . $size); $this->fmt->endContain(); } catch (\Exception $e) { $isFile = false; } } // class/interface/function if (!preg_match('/[^\\w+\\\\]/', $subject) && $length < 96) { $isClass = class_exists($subject, false); if ($isClass) { $this->fmt->startContain('class', true); $this->fromReflector(new \ReflectionClass($subject)); $this->fmt->endContain(); } if (!$isClass && interface_exists($subject, false)) { $this->fmt->startContain('interface', true); $this->fromReflector(new \ReflectionClass($subject)); $this->fmt->endContain('interface'); } if (function_exists($subject)) { $this->fmt->startContain('function', true); $this->fromReflector(new \ReflectionFunction($subject)); $this->fmt->endContain('function'); } } // skip serialization/json/date checks if the string appears to be numeric, // or if it's shorter than 5 characters if (!$isNumeric && $length > 4) { // url if (static::$config['showUrls'] && static::$env['curlActive'] && filter_var($subject, FILTER_VALIDATE_URL)) { $ch = curl_init($subject); curl_setopt($ch, CURLOPT_NOBODY, true); curl_exec($ch); $nfo = curl_getinfo($ch); curl_close($ch); if ($nfo['http_code']) { $this->fmt->startContain('url', true); $contentType = explode(';', $nfo['content_type']); $this->fmt->text('url', sprintf('%s:%d %s %.2fms (%d)', !empty($nfo['primary_ip']) ? $nfo['primary_ip'] : null, !empty($nfo['primary_port']) ? $nfo['primary_port'] : null, $contentType[0], $nfo['total_time'], $nfo['http_code'])); $this->fmt->endContain(); } } // date if ($length < 128 && static::$env['supportsDate'] && !preg_match('/[^A-Za-z0-9.:+\\s\\-\\/]/', $subject)) { try { $date = new \DateTime($subject); $errors = \DateTime::getLastErrors(); if ($errors['warning_count'] < 1 && $errors['error_count'] < 1) { $now = new \Datetime('now'); $nowUtc = new \Datetime('now', new \DateTimeZone('UTC')); $diff = $now->diff($date); $map = array('y' => 'yr', 'm' => 'mo', 'd' => 'da', 'h' => 'hr', 'i' => 'min', 's' => 'sec'); $timeAgo = 'now'; foreach ($map as $k => $label) { if ($diff->{$k} > 0) { $timeAgo = $diff->format("%R%{$k}{$label}"); break; } } $tz = $date->getTimezone(); $offs = round($tz->getOffset($nowUtc) / 3600); if ($offs > 0) { $offs = "+{$offs}"; } $timeAgo .= (int) $offs !== 0 ? ' ' . sprintf('%s (UTC%s)', $tz->getName(), $offs) : ' UTC'; $this->fmt->startContain('date', true); $this->fmt->text('date', $timeAgo); $this->fmt->endContain(); } } catch (\Exception $e) { // not a date } } // attempt to detect if this is a serialized string static $unserializing = 0; $isSerialized = $unserializing < 3 && ($subject[$length - 1] === ';' || $subject[$length - 1] === '}') && in_array($subject[0], array('s', 'a', 'O'), true) && ($subject[0] === 's' && $subject[$length - 2] !== '"' || preg_match("/^{$subject[0]}:[0-9]+:/s", $subject)) && ($unserialized = @unserialize($subject)) !== false; if ($isSerialized) { $unserializing++; $this->fmt->startContain('serialized', true); $this->evaluate($unserialized); $this->fmt->endContain(); $unserializing--; } // try to find out if it's a json-encoded string; // only do this for json-encoded arrays or objects, because other types have too generic formats static $decodingJson = 0; $isJson = !$isSerialized && $decodingJson < 3 && in_array($subject[0], array('{', '['), true); if ($isJson) { $decodingJson++; $json = json_decode($subject); if ($isJson = json_last_error() === JSON_ERROR_NONE) { $this->fmt->startContain('json', true); $this->evaluate($json); $this->fmt->endContain(); } $decodingJson--; } // attempt to match a regex if ($length < 768) { try { $components = $this->splitRegex($subject); if ($components) { $regex = ''; $this->fmt->startContain('regex', true); foreach ($components as $component) { $this->fmt->text('regex-' . key($component), reset($component)); } $this->fmt->endContain(); } } catch (\Exception $e) { // not a regex } } } } return; } // if we reached this point, $subject must be an object // track objects to detect recursion static $hashes = array(); // hash ID of this object $hash = spl_object_hash($subject); $recursion = isset($hashes[$hash]); // sometimes incomplete objects may be created from string unserialization, // if the class to which the object belongs wasn't included until the unserialization stage... if ($subject instanceof \__PHP_Incomplete_Class) { $this->fmt->text('object'); $this->fmt->emptyGroup('incomplete'); return; } // check cache at this point if (!$recursion && $this->fmt->didCache($hash)) { static::$debug['cacheHits']++; return; } $reflector = new \ReflectionObject($subject); $this->fmt->startContain('class'); $this->fromReflector($reflector); $this->fmt->text('object', ' object'); $this->fmt->endContain(); // already been here? if ($recursion) { return $this->fmt->emptyGroup('recursion'); } $hashes[$hash] = 1; $flags = \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED; if (static::$config['showPrivateMembers']) { $flags |= \ReflectionProperty::IS_PRIVATE; } $props = $reflector->getProperties($flags); $methods = array(); if (static::$config['showMethods']) { $flags = \ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED; if (static::$config['showPrivateMembers']) { $flags |= \ReflectionMethod::IS_PRIVATE; } $methods = $reflector->getMethods($flags); } $constants = $reflector->getConstants(); $interfaces = $reflector->getInterfaces(); $traits = static::$env['is54'] ? $reflector->getTraits() : array(); $parents = static::getParentClasses($reflector); // work-around for https://bugs.php.net/bug.php?id=49154 // @see http://stackoverflow.com/questions/15672287/strange-behavior-of-reflectiongetproperties-with-numeric-keys if (!static::$env['is54']) { $props = array_values(array_filter($props, function ($prop) use($subject) { return !$prop->isPublic() || property_exists($subject, $prop->name); })); } // no data to display? if (!$props && !$methods && !$constants && !$interfaces && !$traits) { unset($hashes[$hash]); return $this->fmt->emptyGroup(); } if (!$this->fmt->startGroup()) { return; } // show contents for iterators if (static::$config['showIteratorContents'] && $reflector->isIterateable()) { $itContents = iterator_to_array($subject); $this->fmt->sectionTitle(sprintf('Contents (%d)', count($itContents))); foreach ($itContents as $key => $value) { $keyInfo = gettype($key); if ($keyInfo === 'string') { $encoding = static::$env['mbStr'] ? mb_detect_encoding($key) : ''; $length = $encoding && $encoding !== 'ASCII' ? static::strLen($key) . '; ' . $encoding : static::strLen($key); $keyInfo = sprintf('%s(%s)', $keyInfo, $length); } $this->fmt->startRow(); $this->fmt->text(array('key', 'iterator'), $key, sprintf('Iterator key: %s', $keyInfo)); $this->fmt->colDiv(); $this->fmt->sep('=>'); $this->fmt->colDiv(); $this->evaluate($value); //$this->evaluate($value instanceof \Traversable ? ((count($value) > 0) ? $value : (string)$value) : $value); $this->fmt->endRow(); } } // display the interfaces this objects' class implements if ($interfaces) { $items = array(); $this->fmt->sectionTitle('Implements'); $this->fmt->startRow(); $this->fmt->startContain('interfaces'); $i = 0; $count = count($interfaces); foreach ($interfaces as $name => $interface) { $this->fromReflector($interface); if (++$i < $count) { $this->fmt->sep(', '); } } $this->fmt->endContain(); $this->fmt->endRow(); } // traits this objects' class uses if ($traits) { $items = array(); $this->fmt->sectionTitle('Uses'); $this->fmt->startRow(); $this->fmt->startContain('traits'); $i = 0; $count = count($traits); foreach ($traits as $name => $trait) { $this->fromReflector($trait); if (++$i < $count) { $this->fmt->sep(', '); } } $this->fmt->endContain(); $this->fmt->endRow(); } // class constants if ($constants) { $this->fmt->sectionTitle('Constants'); $max = max(array_map('static::strLen', array_keys($constants))); foreach ($constants as $name => $value) { $meta = null; $type = array('const'); foreach ($parents as $parent) { if ($parent->hasConstant($name)) { if ($parent !== $reflector) { $type[] = 'inherited'; $meta = array('sub' => array(array('Prototype defined by', $parent->name))); } break; } } $this->fmt->startRow(); $this->fmt->sep('::'); $this->fmt->colDiv(); $this->fmt->startContain($type); $this->fmt->text('name', $name, $meta, $this->linkify($parent, $name)); $this->fmt->endContain(); $this->fmt->colDiv($max - static::strLen($name)); $this->fmt->sep('='); $this->fmt->colDiv(); $this->evaluate($value); $this->fmt->endRow(); } } // object/class properties if ($props) { $this->fmt->sectionTitle('Properties'); $max = 0; foreach ($props as $idx => $prop) { if (($propNameLen = static::strLen($prop->name)) > $max) { $max = $propNameLen; } } foreach ($props as $idx => $prop) { if ($this->hasInstanceTimedOut()) { break; } $bubbles = array(); $sourceClass = $prop->getDeclaringClass(); $inherited = $reflector->getShortName() !== $sourceClass->getShortName(); $meta = $sourceClass->isInternal() ? null : static::parseComment($prop->getDocComment()); if ($meta) { if ($inherited) { $meta['sub'] = array(array('Declared in', $sourceClass->getShortName())); } if (isset($meta['tags']['var'][0])) { $meta['left'] = $meta['tags']['var'][0][0]; } unset($meta['tags']); } if ($prop->isProtected() || $prop->isPrivate()) { $prop->setAccessible(true); } $value = $prop->getValue($subject); $this->fmt->startRow(); $this->fmt->sep($prop->isStatic() ? '::' : '->'); $this->fmt->colDiv(); $bubbles = array(); if ($prop->isProtected()) { $bubbles[] = array('P', 'Protected'); } if ($prop->isPrivate()) { $bubbles[] = array('!', 'Private'); } $this->fmt->bubbles($bubbles); $type = array('prop'); if ($inherited) { $type[] = 'inherited'; } if ($prop->isPrivate()) { $type[] = 'private'; } $this->fmt->colDiv(2 - count($bubbles)); $this->fmt->startContain($type); $this->fmt->text('name', $prop->name, $meta, $this->linkify($prop)); $this->fmt->endContain(); $this->fmt->colDiv($max - static::strLen($prop->name)); $this->fmt->sep('='); $this->fmt->colDiv(); $this->evaluate($value); $this->fmt->endRow(); } } // class methods if ($methods && !$this->hasInstanceTimedOut()) { $this->fmt->sectionTitle('Methods'); foreach ($methods as $idx => $method) { $this->fmt->startRow(); $this->fmt->sep($method->isStatic() ? '::' : '->'); $this->fmt->colDiv(); $bubbles = array(); if ($method->isAbstract()) { $bubbles[] = array('A', 'Abstract'); } if ($method->isFinal()) { $bubbles[] = array('F', 'Final'); } if ($method->isProtected()) { $bubbles[] = array('P', 'Protected'); } if ($method->isPrivate()) { $bubbles[] = array('!', 'Private'); } $this->fmt->bubbles($bubbles); $this->fmt->colDiv(4 - count($bubbles)); // is this method inherited? $inherited = $reflector->getShortName() !== $method->getDeclaringClass()->getShortName(); $type = array('method'); if ($inherited) { $type[] = 'inherited'; } if ($method->isPrivate()) { $type[] = 'private'; } $this->fmt->startContain($type); $name = $method->name; if ($method->returnsReference()) { $name = "&{$name}"; } $this->fromReflector($method, $name, $reflector); $paramCom = $method->isInternal() ? array() : static::parseComment($method->getDocComment(), 'tags'); $paramCom = empty($paramCom['param']) ? array() : $paramCom['param']; $paramCount = $method->getNumberOfParameters(); $this->fmt->sep('('); // process arguments foreach ($method->getParameters() as $idx => $parameter) { $meta = null; $paramName = "\${$parameter->name}"; $optional = $parameter->isOptional(); $variadic = static::$env['is56'] && $parameter->isVariadic(); if ($parameter->isPassedByReference()) { $paramName = "&{$paramName}"; } if ($variadic) { $paramName = "...{$paramName}"; } $type = array('param'); if ($optional) { $type[] = 'optional'; } $this->fmt->startContain($type); // attempt to build meta foreach ($paramCom as $tag) { list($pcTypes, $pcName, $pcDescription) = $tag; if ($pcName !== $paramName) { continue; } $meta = array('title' => $pcDescription); if ($pcTypes) { $meta['left'] = $pcTypes; } break; } try { $paramClass = $parameter->getClass(); } catch (\Exception $e) { // @see https://bugs.php.net/bug.php?id=32177&edit=1 } if (!empty($paramClass)) { $this->fmt->startContain('hint'); $this->fromReflector($paramClass, $paramClass->name); $this->fmt->endContain(); $this->fmt->sep(' '); } if ($parameter->isArray()) { $this->fmt->text('hint', 'array'); $this->fmt->sep(' '); } $this->fmt->text('name', $paramName, $meta); if ($optional) { $paramValue = $parameter->isDefaultValueAvailable() ? $parameter->getDefaultValue() : null; $this->fmt->sep(' = '); if (static::$env['is546'] && !$parameter->getDeclaringFunction()->isInternal() && $parameter->isDefaultValueConstant()) { $this->fmt->text('constant', $parameter->getDefaultValueConstantName(), 'Constant'); } else { $this->evaluate($paramValue, true); } } $this->fmt->endContain(); if ($idx < $paramCount - 1) { $this->fmt->sep(', '); } } $this->fmt->sep(')'); $this->fmt->endContain(); $this->fmt->endRow(); } } unset($hashes[$hash]); $this->fmt->endGroup(); $this->fmt->cacheLock($hash); }
function dbcbackup_header() { $header = "-- Database Cron Backup \n"; $header .= "-- Version 1.0 for Wordpress 2.5+ \n"; $header .= "-- Copyright Chris T aka Tefra http://www.t3-design.com \n"; $header .= "-- Generated: " . date('l dS \\of F Y h:i A', time() + get_option('gmt_offset') * 3600) . " \n"; $header .= "-- MySQL Server: " . mysql_get_host_info() . "\n"; $header .= "-- MySQL Server version: " . mysql_get_server_info() . "\n"; $header .= "-- Database: " . dbcbackup_backquote(DB_NAME) . "\n"; $header .= "-- -------------------------------------------------------- \n"; return $header; }
* @Copyright (C) 2010 VINADES.,JSC. All rights reserved * @Createdate 2-1-2010 21:51 */ if (!defined('NV_IS_FILE_DATABASE')) { die('Stop!!!'); } if ($nv_Request->get_bool('show_tabs', 'post')) { nv_show_tables(); exit; } if ($nv_Request->isset_request('tab', 'get') and preg_match("/^(" . $db_config['prefix'] . ")\\_[a-zA-Z0-9\\_\\.\\-]+\$/", filter_text_input('tab', 'get'))) { nv_show_tab(); exit; } $database = array(); $database['db_host_info'] = mysql_get_host_info(); $database['db_sql_version'] = $db->sql_version; $database['db_proto_info'] = mysql_get_proto_info(); $database['server'] = $db->server; $database['db_dbname'] = $db->dbname; $database['db_uname'] = $db->user; $result = $db->sql_query('SELECT @@session.time_zone AS `db_time_zone`, @@session.character_set_database AS `db_charset`, @@session.collation_database AS `db_collation`'); $row = $db->sql_fetch_assoc($result); $db->sql_freeresult($result); $database['db_charset'] = $row['db_charset']; $database['db_collation'] = $row['db_collation']; $database['db_time_zone'] = $row['db_time_zone']; $contents = array(); $contents['captions']['database_info'] = sprintf($lang_module['database_info'], $database['db_dbname']); foreach ($database as $key => $values) { $contents['database'][$lang_module[$key]] = $values;
public function mysql_server($num = '') { switch ($num) { case 1: return mysql_get_server_info(); //MySQL 服务器信息 break; case 2: return mysql_get_host_info(); //取得 MySQL 主机信息 break; case 3: return mysql_get_client_info(); //取得 MySQL 客户端信息 break; case 4: return mysql_get_proto_info(); //取得 MySQL 协议信息 break; default: return mysql_get_client_info(); //默认取得mysql版本信息 } }
public function getServerInfo($type = null) { if ($this->conn_id && $this->state == self::OPEN) { switch ($type) { case self::CLIENT_VERSION: return mysql_get_client_info(); break; case self::HOST_INFO: return mysql_get_host_info($this->conn_id); break; case self::PROTOCOL_VERSION: return mysql_get_proto_info($this->conn_id); break; case self::SERVER_VERSION: default: return mysql_get_server_info($this->conn_id); break; } return ''; } //throw new PhPBURN_Exception() TODO CREATE EXCETION CLASS AND INPUT AN EXCEPTION HERE; }
function getAttribute($attribute) { $result = false; switch ($attribute) { case PDO_ATTR_SERVER_INFO: $result = mysql_get_host_info($this->__connection); break; case PDO_ATTR_SERVER_VERSION: $result = mysql_get_server_info($this->__connection); break; case PDO_ATTR_CLIENT_VERSION: $result = mysql_get_client_info(); break; case PDO_ATTR_PERSISTENT: $result = $this->__persistent; break; } return $result; }
function sql_doconnect() { global $dconf; if (!strlen(trim($dconf['dbhost']))) { print "<h4>MySQL server not specified</h4>\n"; return false; } if (!strlen(trim($dconf['dbuser']))) { print "<h4>MySQL server username not specified</h4>\n"; return false; } if ($dconf['verbose']) { print "<pre>\n"; } // // first try to connect to master server // $mysid = 1; $mysserv = $dconf['dbhost']; $mysuser = $dconf['dbuser']; $myspass = $dconf['dbpass']; $mysdb = $dconf['dbname']; $myc = false; while (true) { if ($dconf['verbose']) { print "Connecting to mysql://" . $mysuser . "@" . $mysserv . "/" . $mysdb . "...\n"; } if (!strlen(trim($myspass))) { $myc = mysql_connect($mysserv, $mysuser); } else { $myc = mysql_connect($mysserv, $mysuser, $myspass); } if (!$myc) { print "<h4>Unable to connect to " . $mysserv . "</h4>\n"; } else { if (!mysql_select_db($mysdb, $myc)) { print "<h4>Could not select database " . $mysdb . "</h4>\n"; } } flush(); if ($myc || $mysid > 1) { break; } else { // // try next secondary server // $mysid = 2; $mysserv = $dconf['dbsechost']; $mysuser = $dconf['dbsecuser']; $myspass = $dconf['dbsecpass']; $mysdb = $dconf['dbsecname']; } } if ($dconf['verbose']) { print "Connected to MySQL server " . mysql_get_server_info() . " at " . mysql_get_host_info() . "\n"; print "Selected database: " . $mysdb . "\n"; print "Client encoding: " . mysql_client_encoding() . "\n"; } if ($dconf['verbose']) { print "</pre>\n"; } sql_setcharset($myc, 'utf8'); return $myc; }
public function getAttribute($id) { switch ($id) { case self::ATTR_CLIENT_VERSION: return mysql_get_client_info(); case self::ATTR_SERVER_VERSION: return mysql_get_server_info($this->_connection); break; case self::ATTR_SERVER_INFO: return mysql_get_host_info($this->_connection); } return ""; }
/** * get host info. * Returns a string describing the type of MySQL connection in use * * @access public * @return string */ public function getHostInfo() { if ($this->connect()) { return mysql_get_host_info($this->_connection); } return null; }
function executemysql($getinfo, $getdumps, $getschema) { //BEGIN GET DB INFO global $getDumpsFrom; global $curdatetime; global $sugar_config; global $progress_bar_percent; global $sod_guid; global $db; if ($db->dbType != "mysql") { if ($getinfo) { sodUpdateProgressBar(MYSQL_INFO_WEIGHT); } if ($getschema) { sodUpdateProgressBar(MYSQL_SCHEMA_WEIGHT); } if ($getdumps) { sodUpdateProgressBar(MYSQL_DUMPS_WEIGHT); } return; } $mysqlInfoDir = create_cache_directory("diagnostic/" . $sod_guid . "/diagnostic" . $curdatetime . "/MySQL/"); //create directory for table definitions if ($getschema) { $tablesSchemaDir = create_cache_directory("diagnostic/" . $sod_guid . "/diagnostic" . $curdatetime . "/MySQL/TableSchema/"); } //BEGIN GET MYSQL INFO //make sure they checked the box to get basic info if ($getinfo) { ob_start(); echo "MySQL Version: " . (function_exists('mysqli_get_client_info') ? @mysqli_get_client_info() : @mysql_get_client_info()) . "<BR>"; echo "MySQL Host Info: " . (function_exists('mysqli_get_host_info') ? @mysqli_get_host_info($db->getDatabase()) : @mysql_get_host_info()) . "<BR>"; echo "MySQL Server Info: " . (function_exists('mysqli_get_client_info') ? @mysqli_get_client_info() : @mysql_get_client_info()) . "<BR>"; echo "MySQL Client Encoding: " . (function_exists('mysqli_character_set_name') ? @mysqli_character_set_name($db->getDatabase()) : @mysql_client_encoding()) . "<BR>"; /* Uncomment to get current processes as well echo "<BR>MySQL Processes<BR>"; $res = $db->query('SHOW PROCESSLIST'); echo "<table border=\"1\"><tr><th>Id</th><th>Host</th><th>db</th><th>Command</th><th>Time</th></tr>"; if($db->getRowCount($res) > 0) { while($row = $db->fetchByAssoc($res)) { printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>", $row['Id'], $row['Host'], $row['db'], $row['Command'], $row['Time'] ); } echo "</table><br>"; } else { echo "</table>"; echo "No processes running<br>"; } */ echo "<BR>MySQL Character Set Settings<BR>"; $res = $db->query("show variables like 'character\\_set\\_%'"); echo "<table border=\"1\"><tr><th>Variable Name</th><th>Value</th></tr>"; while ($row = $db->fetchByAssoc($res)) { printf("<tr><td>%s</td><td>%s</td></tr>", $row['Variable_name'], $row['Value']); } echo "</table>"; $content = ob_get_contents(); ob_clean(); $handle = sugar_fopen($mysqlInfoDir . "MySQL-General-info.html", "w"); if (fwrite($handle, $content) === FALSE) { echo "Cannot write to file " . $mysqlInfoDir . "_MySQL-General-info.html<br>"; } fclose($handle); //BEGIN UPDATING PROGRESS BAR sodUpdateProgressBar(MYSQL_INFO_WEIGHT); //END UPDATING PROGRESS BAR } //END GET MYSQL INFO if ($getschema) { //BEGIN GET ALL TABLES SCHEMAS $all_tables = $db->getTablesArray(); global $theme_path; ob_start(); echo "<style>"; echo file_get_contents($theme_path . "style.css"); echo "</style>"; foreach ($all_tables as $tablename) { //setting up table header for each file echo "<table border=\"0\" cellpadding=\"0\" class=\"tabDetailView\">"; echo "<tr>MySQL " . $tablename . " Definitions:</tr>" . "<tr><td class=\"tabDetailViewDL\"><b>Field</b></td>" . "<td class=\"tabDetailViewDL\">Type</td>" . "<td class=\"tabDetailViewDL\">Null</td>" . "<td class=\"tabDetailViewDL\">Key</td>" . "<td class=\"tabDetailViewDL\">Default</td>" . "<td class=\"tabDetailViewDL\">Extra</td></tr>"; $describe = $db->query("describe " . $tablename); while ($inner_row = $db->fetchByAssoc($describe)) { $inner_row = array_values($inner_row); echo "<tr><td class=\"tabDetailViewDF\"><b>" . $inner_row[0] . "</b></td>"; echo "<td class=\"tabDetailViewDF\">" . $inner_row[1] . "</td>"; echo "<td class=\"tabDetailViewDF\">" . $inner_row[2] . "</td>"; echo "<td class=\"tabDetailViewDF\">" . $inner_row[3] . "</td>"; echo "<td class=\"tabDetailViewDF\">" . $inner_row[4] . "</td>"; echo "<td class=\"tabDetailViewDF\">" . $inner_row[5] . "</td></tr>"; } echo "</table>"; echo "<BR><BR>"; } $content = ob_get_contents(); ob_clean(); $handle = sugar_fopen($tablesSchemaDir . "MySQLTablesSchema.html", "w"); if (fwrite($handle, $content) === FALSE) { echo "Cannot write to file " . $tablesSchemaDir . "MySQLTablesSchema.html<br>"; } fclose($handle); //END GET ALL TABLES SCHEMAS //BEGIN UPDATING PROGRESS BAR sodUpdateProgressBar(MYSQL_SCHEMA_WEIGHT); //END UPDATING PROGRESS BAR } if ($getdumps) { //BEGIN GET TABLEDUMPS $tableDumpsDir = create_cache_directory("diagnostic/" . $sod_guid . "/diagnostic" . $curdatetime . "/MySQL/TableDumps/"); foreach ($getDumpsFrom as $table) { ob_start(); //calling function defined above to get the string for dump echo getFullTableDump($table); $content = ob_get_contents(); ob_clean(); $handle = sugar_fopen($tableDumpsDir . $table . ".html", "w"); if (fwrite($handle, $content) === FALSE) { echo "Cannot write to file " . $tableDumpsDir . $table . "html<br>"; } fclose($handle); } //END GET TABLEDUMPS //BEGIN UPDATING PROGRESS BAR sodUpdateProgressBar(MYSQL_DUMPS_WEIGHT); //END UPDATING PROGRESS BAR } //END GET DB INFO }
/******************************************** * @Created on March, 2011 * @Package: Ndotdeals unlimited v2.2 * @Author: NDOT * @URL : http://www.ndot.in ********************************************/ require_once './init.php'; $gDesc = $gXpLang['manage_database_backups']; $gPage = $gXpLang['database_backup']; $gPath = 'database-backup'; require_once 'header.php'; $buttons = array(0 => array('name' => 'backup', 'img' => $gXpConfig['xpurl'] . 'admin/images/save_f2.gif', 'text' => $gXpLang['backup'])); if ($_POST['task'] == 'backup' || $_POST['backup']) { $toptext = "# MySQL variables:\n"; $toptext .= "# \tMySQL client info: " . mysql_get_client_info() . "\n"; $toptext .= "# \tMySQL host info: " . mysql_get_host_info() . "\n"; $toptext .= "# \tMySQL protocol version: " . mysql_get_proto_info() . "\n"; $toptext .= "# \tMySQL server version: " . mysql_get_server_info() . "\n"; $toptext .= "\n\n\n"; /** database backup **/ /** defines what to dump **/ if ("structure" == $_POST['db_op']) { $sql = makeDbStructureBackup(); } elseif ("data" == $_POST['db_op']) { $sql = makeDbDataBackup(); } elseif ("full" == $_POST['db_op']) { $sql = makeDbBackup(); } $sql = $copyright . $sql; /** saves to server **/ if ("server" == $_POST['savetype']) {
/** * Test mysql_get_host_info * * @return boolean */ public function MySQL_Get_Host_Info_Test() { $str1 = mysql_get_host_info(); $str2 = $this->_object->mysql_get_host_info(); return $str1 === $str2; }
/** * Returns a string representing the type of connection used * * @param resource|null $link mysql link * * @return string type of connection used */ public function getHostInfo($link) { return mysql_get_host_info($link); }
/** * Returns a string representing the type of connection used * @uses mysql_get_host_info() * @uses $GLOBALS['userlink'] as default for $link * @param resource $link mysql link * @return string type of connection used */ function PMA_DBI_get_host_info($link = null) { if (null === $link) { if (isset($GLOBALS['userlink'])) { $link = $GLOBALS['userlink']; } else { return false; } } return mysql_get_host_info($link); }
public function mysql_server($num = '') { switch ($num) { case 1: return mysql_get_server_info(); break; case 2: return mysql_get_host_info(); break; case 3: return mysql_get_client_info(); break; case 4: return mysql_get_proto_info(); break; default: return mysql_get_client_info(); } }