<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
|	['hostname'] The hostname of your database server.
|	['username'] The username used to connect to the database
|	['password'] The password used to connect to the database
|	['database'] The name of the database you want to connect to
|	['dbdriver'] The database type. ie: mysql.  Currently supported:
				 mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
|	['dbprefix'] You can add an optional prefix, which will be added
|				 to the table name when using the  Active Record class
|	['pconnect'] TRUE/FALSE - Whether to use a persistent connection
|	['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
|	['cache_on'] TRUE/FALSE - Enables/disables query caching
|	['cachedir'] The path to the folder where cache files should be stored
|	['char_set'] The character set used in communicating with the database
|	['dbcollat'] The character collation used in communicating with the database
|				 NOTE: For MySQL and MySQLi databases, this setting is only used
| 				 as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
|				 (and in table creation queries made with DB Forge).
| 				 There is an incompatibility in PHP with mysql_real_escape_string() which
| 				 can make your site vulnerable to SQL injection if you are using a
| 				 multi-byte character set and are running versions lower than these.
| 				 Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
|	['swap_pre'] A default table prefix that should be swapped with the dbprefix
|	['autoinit'] Whether or not to automatically initialize the database.
|	['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
|							- good for ensuring strict SQL while developing
|
| The $active_group variable lets you choose which connection group to
| make active.  By default there is only one group (the 'default' group).
|
| The $active_record variables lets you determine whether or not to load
| the active record class
*/



$active_group = 'default';
$active_record = TRUE;
//$dsn_esf = "dbdriver://$conf_db_user:$conf_db_password@$conf_db_host/$conf_db_name?char_set=$conf_db_charset&dbcollat=utf8_general_ci&cache_on=false";
$IpHostAllow =explode('.',get_ip());


if($IpHostAllow['0']=='127')
{
    $conf_db_host       ='njesfdbmastervip.house365.com';
    $conf_dbback_host   ='njesfdbmastervip.house365.com';
    $conf_user_host   ='njesfdbmastervip.house365.com';
    $conf_userback_host   ='njesfdbmastervip.house365.com';
    $conf_db_esf        ='njesfdbmastervip.house365.com';
}
else
{
    $conf_user_host   ='njesfdbmastervip.house365.com';
    $conf_userback_host   ='njesfdbslave02.house365.com';
    if(GB_CITY=='nj') {
        $conf_db_host = 'njesfdbmastervip.house365.com';
        $conf_dbback_host = 'njesfdbslave02.house365.com';

        $db_rand = rand(1,2);

        switch($db_rand)
        {
            case 1: $conf_dbback_host = 'njesfdbslave02.house365.com';break;
            case 2: $conf_dbback_host = 'njesfdbslave01.house365.com';break;
        }
    }
    elseif(GB_CITY=='hf')
    {
        $conf_db_host = '172.17.1.176';
        $conf_dbback_host = '172.17.1.86';
    }
    else
    {
        $conf_db_host = 'wdnjesfdbmastervip.house365.com';
        $conf_dbback_host = 'wdnjesfdbslave02.house365.com';
    }
    $conf_db_esf        ='wdnjesfdbmastervip.house365.com';

}
$db['dsn_esf']['hostname'] = $conf_user_host;
$db['dsn_esf']['username'] = 'root';
$db['dsn_esf']['password'] = 'idontcare';
$db['dsn_esf']['database'] = 'user';
$db['dsn_esf']['dbdriver'] = 'mysql';
$db['dsn_esf']['dbprefix'] = '';
$db['dsn_esf']['pconnect'] = FALSE;
$db['dsn_esf']['db_debug'] = FALSE;
$db['dsn_esf']['cache_on'] = FALSE;
$db['dsn_esf']['cachedir'] = '';
$db['dsn_esf']['char_set'] = 'gbk';
$db['dsn_esf']['dbcollat'] = 'gbk';
$db['dsn_esf']['swap_pre'] = '';
$db['dsn_esf']['autoinit'] = FALSE;
$db['dsn_esf']['stricton'] = FALSE;


//$db['dsn_esfbak']['hostname'] = 'master_nj_esf_back';
$db['dsn_esfbak']['hostname'] = $conf_userback_host;
$db['dsn_esfbak']['username'] = 'root';
$db['dsn_esfbak']['password'] = 'idontcare';
$db['dsn_esfbak']['database'] = 'user';
$db['dsn_esfbak']['dbdriver'] = 'mysql';
$db['dsn_esfbak']['dbprefix'] = '';
$db['dsn_esfbak']['pconnect'] = FALSE;
$db['dsn_esfbak']['db_debug'] = FALSE;
$db['dsn_esfbak']['cache_on'] = FALSE;
$db['dsn_esfbak']['cachedir'] = '';
$db['dsn_esfbak']['char_set'] = 'gbk';
$db['dsn_esfbak']['dbcollat'] = 'gbk';
$db['dsn_esfbak']['swap_pre'] = '';
$db['dsn_esfbak']['autoinit'] = FALSE;
$db['dsn_esfbak']['stricton'] = FALSE;

if(GB_CITY=='nj')
{
    $db['dsn_esfhouse']['hostname'] = $conf_db_host;
    $db['dsn_esfhouse']['username'] = 'root';
    $db['dsn_esfhouse']['password'] = 'idontcare';
    $db['dsn_esfhouse']['database'] = 'house';
    $db['dsn_esfhouse']['dbdriver'] = 'mysql';
    $db['dsn_esfhouse']['dbprefix'] = '';
    $db['dsn_esfhouse']['pconnect'] = FALSE;
    $db['dsn_esfhouse']['db_debug'] = FALSE;
    $db['dsn_esfhouse']['cache_on'] = FALSE;
    $db['dsn_esfhouse']['cachedir'] = '';
    $db['dsn_esfhouse']['char_set'] = 'gbk';
    $db['dsn_esfhouse']['dbcollat'] = 'gbk';
    $db['dsn_esfhouse']['swap_pre'] = '';
    $db['dsn_esfhouse']['autoinit'] = FALSE;
    $db['dsn_esfhouse']['stricton'] = FALSE;

    $db['dsn_esfhousebak']['hostname'] = $conf_dbback_host;
    $db['dsn_esfhousebak']['username'] = 'root';
    $db['dsn_esfhousebak']['password'] = 'idontcare';
    $db['dsn_esfhousebak']['database'] = 'house';
    $db['dsn_esfhousebak']['dbdriver'] = 'mysql';
    $db['dsn_esfhousebak']['dbprefix'] = '';
    $db['dsn_esfhousebak']['pconnect'] = FALSE;
    $db['dsn_esfhousebak']['db_debug'] = FALSE;
    $db['dsn_esfhousebak']['cache_on'] = FALSE;
    $db['dsn_esfhousebak']['cachedir'] = '';
    $db['dsn_esfhousebak']['char_set'] = 'gbk';
    $db['dsn_esfhousebak']['dbcollat'] = 'gbk';
    $db['dsn_esfhousebak']['swap_pre'] = '';
    $db['dsn_esfhousebak']['autoinit'] = FALSE;
    $db['dsn_esfhousebak']['stricton'] = FALSE;

}elseif(GB_CITY=='hf'){
    $db['dsn_esfhouse']['hostname'] = $conf_db_host;
    $db['dsn_esfhouse']['username'] = 'root';
    $db['dsn_esfhouse']['password'] = 'idontcare';
    $db['dsn_esfhouse']['database'] = GB_CITY.'_house';
    $db['dsn_esfhouse']['dbdriver'] = 'mysql';
    $db['dsn_esfhouse']['dbprefix'] = '';
    $db['dsn_esfhouse']['pconnect'] = FALSE;
    $db['dsn_esfhouse']['db_debug'] = FALSE;
    $db['dsn_esfhouse']['cache_on'] = FALSE;
    $db['dsn_esfhouse']['cachedir'] = '';
    $db['dsn_esfhouse']['char_set'] = 'gbk';
    $db['dsn_esfhouse']['dbcollat'] = 'gbk';
    $db['dsn_esfhouse']['swap_pre'] = '';
    $db['dsn_esfhouse']['autoinit'] = FALSE;
    $db['dsn_esfhouse']['stricton'] = FALSE;

    $db['dsn_esfhousebak']['hostname'] = $conf_dbback_host;
    $db['dsn_esfhousebak']['username'] = 'root';
    $db['dsn_esfhousebak']['password'] = 'idontcare';
    $db['dsn_esfhousebak']['database'] = GB_CITY.'_house';
    $db['dsn_esfhousebak']['dbdriver'] = 'mysql';
    $db['dsn_esfhousebak']['dbprefix'] = '';
    $db['dsn_esfhousebak']['pconnect'] = FALSE;
    $db['dsn_esfhousebak']['db_debug'] = FALSE;
    $db['dsn_esfhousebak']['cache_on'] = FALSE;
    $db['dsn_esfhousebak']['cachedir'] = '';
    $db['dsn_esfhousebak']['char_set'] = 'gbk';
    $db['dsn_esfhousebak']['dbcollat'] = 'gbk';
    $db['dsn_esfhousebak']['swap_pre'] = '';
    $db['dsn_esfhousebak']['autoinit'] = FALSE;
    $db['dsn_esfhousebak']['stricton'] = FALSE;
}

else{
    $db['dsn_esfhouse']['hostname'] = $conf_db_host;
    $db['dsn_esfhouse']['username'] = 'root';
    $db['dsn_esfhouse']['password'] = 'idontcare';
    $db['dsn_esfhouse']['database'] = GB_CITY.'_house';
    $db['dsn_esfhouse']['dbdriver'] = 'mysql';
    $db['dsn_esfhouse']['dbprefix'] = '';
    $db['dsn_esfhouse']['pconnect'] = FALSE;
    $db['dsn_esfhouse']['db_debug'] = FALSE;
    $db['dsn_esfhouse']['cache_on'] = FALSE;
    $db['dsn_esfhouse']['cachedir'] = '';
    $db['dsn_esfhouse']['char_set'] = 'gbk';
    $db['dsn_esfhouse']['dbcollat'] = 'gbk';
    $db['dsn_esfhouse']['swap_pre'] = '';
    $db['dsn_esfhouse']['autoinit'] = FALSE;
    $db['dsn_esfhouse']['stricton'] = FALSE;

    $db['dsn_esfhousebak']['hostname'] = $conf_dbback_host;
    $db['dsn_esfhousebak']['username'] = 'root';
    $db['dsn_esfhousebak']['password'] = 'idontcare';
    $db['dsn_esfhousebak']['database'] = GB_CITY.'_house';
    $db['dsn_esfhousebak']['dbdriver'] = 'mysql';
    $db['dsn_esfhousebak']['dbprefix'] = '';
    $db['dsn_esfhousebak']['pconnect'] = FALSE;
    $db['dsn_esfhousebak']['db_debug'] = FALSE;
    $db['dsn_esfhousebak']['cache_on'] = FALSE;
    $db['dsn_esfhousebak']['cachedir'] = '';
    $db['dsn_esfhousebak']['char_set'] = 'gbk';
    $db['dsn_esfhousebak']['dbcollat'] = 'gbk';
    $db['dsn_esfhousebak']['swap_pre'] = '';
    $db['dsn_esfhousebak']['autoinit'] = FALSE;
    $db['dsn_esfhousebak']['stricton'] = FALSE;
}



$db['dsn_bbs']['hostname'] = '172.17.1.6';
$db['dsn_bbs']['username'] = 'root';
$db['dsn_bbs']['password'] = 'idontcare';
$db['dsn_bbs']['database'] = 'realbbs';
$db['dsn_bbs']['dbdriver'] = 'mysql';
$db['dsn_bbs']['dbprefix'] = '';
$db['dsn_bbs']['pconnect'] = FALSE;
$db['dsn_bbs']['db_debug'] = FALSE;
$db['dsn_bbs']['cache_on'] = FALSE;
$db['dsn_bbs']['cachedir'] = '';
$db['dsn_bbs']['char_set'] = 'gbk';
$db['dsn_bbs']['dbcollat'] = 'gbk';
$db['dsn_bbs']['swap_pre'] = '';
$db['dsn_bbs']['autoinit'] = TRUE;
$db['dsn_bbs']['stricton'] = FALSE;

$db['dsn_esfadmin']['hostname'] = $conf_db_esf;
$db['dsn_esfadmin']['username'] = 'root';
$db['dsn_esfadmin']['password'] = 'idontcare';
$db['dsn_esfadmin']['database'] = 'esf_admin';
$db['dsn_esfadmin']['dbdriver'] = 'mysql';
$db['dsn_esfadmin']['dbprefix'] = '';
$db['dsn_esfadmin']['pconnect'] = FALSE;
$db['dsn_esfadmin']['db_debug'] = FALSE;
$db['dsn_esfadmin']['cache_on'] = FALSE;
$db['dsn_esfadmin']['cachedir'] = '';
$db['dsn_esfadmin']['char_set'] = 'gbk';
$db['dsn_esfadmin']['dbcollat'] = 'gbk';
$db['dsn_esfadmin']['swap_pre'] = '';
$db['dsn_esfadmin']['autoinit'] = TRUE;
$db['dsn_esfadmin']['stricton'] = FALSE;


/* End of file database.php */
/* Location: ./application/config/database.php */
