Example #1
0
// DBinfo column: char_host;char_port;char_username;char_password;charDBname;
// world_host;world_port;world_username;world_pass;worldDBname
$Realm_DB_Info = array('char_db_host' => $dbinfo['0'], 'char_db_port' => $dbinfo['1'], 'char_db_username' => $dbinfo['2'], 'char_db_password' => $dbinfo['3'], 'char_db_name' => $dbinfo['4'], 'w_db_host' => $dbinfo['5'], 'w_db_port' => $dbinfo['6'], 'w_db_username' => $dbinfo['7'], 'w_db_password' => $dbinfo['8'], 'w_db_name' => $dbinfo['9']);
// Free up memory.
unset($dbinfo, $DB_info);
// === Establish the Character DB connection === //
$CDB = new Database($Realm_DB_Info['char_db_host'], $Realm_DB_Info['char_db_port'], $Realm_DB_Info['char_db_username'], $Realm_DB_Info['char_db_password'], $Realm_DB_Info['char_db_name']);
// Check the CDB status. 0 = cannot connect, 1 = success, 2 = DB doesnt exist
if ($CDB->status() != 1) {
    echo "Cannot connect to the Character database. Please make sure you have this realm setup successfully in the Admin Panel. \n\tDelete your cookies to reset realm selection back to default";
    die;
}
// === Establish the World DB connection === //
$WDB = new Database($Realm_DB_Info['w_db_host'], $Realm_DB_Info['w_db_port'], $Realm_DB_Info['w_db_username'], $Realm_DB_Info['w_db_password'], $Realm_DB_Info['w_db_name']);
// Check the CDB status. 0 = cannot connect, 1 = success, 2 = DB doesnt exist
if ($WDB->status() != 1) {
    echo "Cannot connect to the World database. Please make sure you have this realm setup successfully in the Admin Panel. \n\tDelete your cookies to reset realm selection back to default";
    die;
}
// Free up memory
unset($Realm_DB_Info);
/***************************************************************
 * Load the Account / Auth Class
 ***************************************************************/
$Account = new Account();
$user = $Account->user;
$user['cur_selected_realm'] = $GLOBALS['cur_selected_realm'];
/***************************************************************
 * Load the Template class and setup the template system
 ***************************************************************/
$Template = new MangosTemplate();