예제 #1
0
 function connect()
 {
     global $adminer;
     $connection = new Min_DB();
     $credentials = $adminer->credentials();
     if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
         return $connection;
     }
     return $connection->error;
 }
예제 #2
0
 /** Connect to the database
  * @return mixed Min_DB or string for error
  */
 function connect()
 {
     global $adminer;
     $connection = new Min_DB();
     $credentials = $adminer->credentials();
     if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
         $connection->set_charset(charset($connection));
         // available in MySQLi since PHP 5.0.5
         $connection->query("SET sql_quote_show_create = 1, autocommit = 1");
         return $connection;
     }
     $return = $connection->error;
     if (function_exists('iconv') && !is_utf8($return) && strlen($s = iconv("windows-1250", "utf-8", $return)) > strlen($return)) {
         // windows-1250 - most common Windows encoding
         $return = $s;
     }
     return $return;
 }