2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Harris Wong */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
14 if (AT_INCLUDE_PATH !== 'NULL') {
15 $db = @mysql_connect(DB_HOST . ':' . DB_PORT, DB_USER, DB_PASSWORD);
18 /* AT_ERROR_NO_DB_CONNECT */
19 require_once(AT_INCLUDE_PATH . 'classes/ErrorHandler/ErrorHandler.class.php');
20 $err = new ErrorHandler();
21 trigger_error('VITAL#Unable to connect to db.', E_USER_ERROR);
24 if (!@mysql_select_db(DB_NAME, $db)) {
25 require_once(AT_INCLUDE_PATH . 'classes/ErrorHandler/ErrorHandler.class.php');
26 $err = new ErrorHandler();
27 trigger_error('VITAL#DB connection established, but database "'.DB_NAME.'" cannot be selected.',
33 $sql = 'SELECT * FROM '.TABLE_PREFIX."config WHERE name='set_utf8'";
34 $result = mysql_query($sql, $db);
36 $row = mysql_fetch_assoc($result);
38 if ($row['value']==1){
39 mysql_query("SET NAMES 'utf8'", $db);