Example #1
0
	<?php 
    exit;
} elseif (!isset($conf)) {
    ?>
	<p>An error occurred while attempting to fetch your config.php file. The file seems to contain no configuration values.</p>
	<?php 
    exit;
}
// ------------------------------
//  Connect to the database
// ------------------------------
require PATH_DB . 'db.' . $conf['db_type'] . EXT;
$db_config = array('hostname' => $conf['db_hostname'], 'username' => $conf['db_username'], 'password' => $conf['db_password'], 'database' => $conf['db_name'], 'prefix' => $conf['db_prefix'], 'conntype' => $conf['db_conntype'], 'debug' => 1, 'show_queries' => FALSE, 'enable_cache' => FALSE);
$DB = new DB($db_config);
$DB->error_header = "<div class='error'>Error:  The following error was encountered</div>";
$DB->error_footer = Update::page_footer();
if (!$DB->db_connect(0)) {
    exit("Database Error:  Unable to connect to your database. Your database appears to be turned off or the database connection settings in your config file are not correct. Please contact your hosting provider if the problem persists.");
}
if (!$DB->select_db()) {
    exit("Database Error:  Unable to select your database");
}
// Check for "strict mode", some queries used are incompatible
if (version_compare(mysql_get_server_info(), '4.1-alpha', '>=')) {
    $mode_query = $DB->query("SELECT CONCAT(@@global.sql_mode, @@session.sql_mode) AS sql_mode");
    if (strpos(strtoupper($mode_query->row['sql_mode']), 'STRICT') !== FALSE) {
        Update::page_header();
        $DB->db_error("Database Error: ExpressionEngine will not run on a MySQL server operating in strict mode");
    }
}
// ------------------------------