getErrorMsg(); if (!$database->_resource) { db_err ('stepBack2','password ed username inseriti non sono corretti.'); } // Does this code actually do anything??? $configArray['DBhostname'] = $DBhostname; $configArray['DBuserName'] = $DBuserName; $configArray['DBpassword'] = $DBpassword; $configArray['DBname'] = $DBname; $configArray['DBPrefix']= $DBPrefix; $sql = "CREATE DATABASE `$DBname`"; $database->setQuery( $sql ); $database->query(); $test = $database->getErrorNum(); if ($test != 0 && $test != 1007) { db_err( 'stepBack', 'Avvenuto un errore database: ' . $database->getErrorMsg() ); } // db is now new or existing, create the db object connector to do the serious work $database = new database( $DBhostname, $DBuserName, $DBpassword, $DBname, $DBPrefix ); // delete existing mos table if exists $query = "SHOW TABLES FROM `$DBname`"; $database->setQuery( $query ); $errors = array(); if ($tables = $database->loadResultArray()) { foreach ($tables as $table) { $query = "DROP TABLE IF EXISTS `$table`"; $database->setQuery( $query ); $database->query(); if ($database->getErrorNum()) { $errors[$database->getQuery()] = $database->getErrorMsg(); } } } populate_db( $database, 'eleonline.sql' ); $DBcreated = 1; } function db_err($step, $alert) { global $DBhostname,$DBuserName,$DBpassword,$DBname,$DBPrefix; echo "
\n"; echo ""; //echo ""; exit(); } /** * @param object * @param string File name */ function populate_db( &$database, $sqlfile='eleonline.sql') { global $errors; $mqr = @get_magic_quotes_runtime(); @set_magic_quotes_runtime(0); $query = fread( fopen( 'sql/' . $sqlfile, 'r' ), filesize( 'sql/' . $sqlfile ) ); @set_magic_quotes_runtime($mqr); $pieces = split_sql($query); for ($i=0; $i