diff --git a/includes/adodb.php b/includes/adodb.php index 81de3cc..bce275e 100644 --- a/includes/adodb.php +++ b/includes/adodb.php @@ -63,7 +63,7 @@ class ADOdb { $hostport = $host . ":" . $port; $this->conn = NewADOConnection($db_type); while ($try <= $retries) { - if ($this->conn->PConnect($hostport,$user,$pass,$db_name)) { + if ($this->conn->NConnect($hostport,$user,$pass,$db_name)) { $this->conn = $this->conn; return 0; } diff --git a/includes/config.php b/includes/config.php index b882093..1f3eccb 100644 --- a/includes/config.php +++ b/includes/config.php @@ -30,12 +30,12 @@ */ // ** database settings ** // -$db_type = 'mysql'; // Name of the DBMS hosting the tsmmonitor database -$db_name = 'tsmmonitor'; // Name of the tsmmonitor database -$db_user = 'tsmmonitor'; // Username used to connect to the tsmmonitor database -$db_password = 'tsmmonitor'; // Password used to connect to the tsmmonitor database -$db_host = 'localhost'; // Hostname or IP address the DBMS is listening on -$db_port = '3306'; // Port number the DBMS is listening on -$db_charset = 'utf8'; -$db_collate = ''; +$config["db_type"] = 'mysql'; // Name of the DBMS hosting the tsmmonitor database +$config["db_name"] = 'tsmmonitor'; // Name of the tsmmonitor database +$config["db_user"] = 'tsmmonitor'; // Username used to connect to the tsmmonitor database +$config["db_password"] = 'tsmmonitor'; // Password used to connect to the tsmmonitor database +$config["db_host"] = 'localhost'; // Hostname or IP address the DBMS is listening on +$config["db_port"] = '3306'; // Port number the DBMS is listening on +$config["db_charset"] = 'utf8'; +$config["db_collate"] = ''; ?> diff --git a/includes/global.php b/includes/global.php index d234ace..cb493cd 100644 --- a/includes/global.php +++ b/includes/global.php @@ -38,22 +38,22 @@ */ +// ** Global configuration array ** // +$config = array(); + // ** Default database settings ** // -$db_type = 'mysql'; -$db_name = 'tsmmonitor'; -$db_user = 'tsmmonitor'; -$db_password = 'tsmmonitor'; -$db_host = 'localhost'; -$db_port = '3306'; -$db_charset = 'utf8'; -$db_collate = ''; +$config["db_type"] = 'mysql'; +$config["db_name"] = 'tsmmonitor'; +$config["db_user"] = 'tsmmonitor'; +$config["db_password"] = 'tsmmonitor'; +$config["db_host"] = 'localhost'; +$config["db_port"] = '3306'; +$config["db_charset"] = 'utf8'; +$config["db_collate"] = ''; // ** Include user configureable definitions ** // include(dirname(__FILE__) . "/config.php"); -// ** Global configuration array ** // -$config = array(); - // ** Current TSM Monitor version ** // $config["tsm_monitor_version"] = '0.0.1'; @@ -89,13 +89,13 @@ include_once($config["include_path"] . "/tsmmonitor.php"); include_once($config["include_path"] . "/polld.php"); // ** Connect to the database ** // -$adodb = new ADOdb($db_host, $db_port, $db_user, $db_password, $db_name, $db_type); +$adodb = new ADOdb($config["db_host"], $config["db_port"], $config["db_user"], $config["db_password"], $config["db_name"], $config["db_type"]); // ** instantiate TSMMonitor Class ** // $tsmmonitor = new TSMMonitor($adodb); // check to see if this is a new installation -$version = $adodb->fetchCellDB("select confval from cfg_config where confkey='version'", ''); +$version = $adodb->fetchCellDB("SELECT confval FROM cfg_config WHERE confkey='version'", ''); if ($version != $config["tsm_monitor_version"] && basename($_SERVER['REQUEST_URI']) != 'install.php') { header("Location: install.php"); exit;