getConfigKey('is_upgrade'); // process submitted data if (isset($_POST['submit'])) { // process POSTed data $zc_install->validateDatabaseSetup($_POST); $zc_install->logDetails('Installer - Page: database_setup -- collected information: ' . str_replace($_POST['db_pass'], '*****', $zc_install->getConfigKey('-', TRUE)), 'database_setup1'); if (ZC_UPG_DEBUG !== false) $zc_install->throwException('DIAGNOSTIC: database_setup -- session vars: ' . str_replace(array($zc_install->getConfigKey('DB_SERVER_PASSWORD'), $_POST['db_pass']), '*****', print_r($_SESSION, true)), 'database_setup'); if (!$zc_install->fatal_error) { //now let's connect to the database and load the tables: if ($is_upgrade) { //if upgrading, move on to the upgrade page // update post-install settings such as paths $zc_install->dbAfterLoadActions(); header('location: index.php?main_page=database_upgrade' . zcInstallAddSID() ); exit; } elseif ($_POST['submit']==SAVE_DATABASE_SETTINGS) { // not upgrading - load the fresh database if ($zc_show_progress == 'yes') { ?> Zen Cart® Setup - Database Loading ...


dbLoadProcedure(); if ($zc_show_progress == 'yes') { $linkto = 'index.php?main_page=system_setup' . zcInstallAddSID() ; $link = '' . '

Done!
Click Here To Continue

' . '
'; echo "\n\n"; echo '

'; echo '
'; } else { header('location: index.php?main_page=system_setup' . zcInstallAddSID() ); } exit; } elseif ($write_config_files_only && !$zc_install->fatal_error) { header('location: index.php?main_page=database_upgrade' . zcInstallAddSID() ); exit; } //endif $is_upgrade } } if ($is_upgrade) { // read previous settings from configure.php $zdb_type = zen_read_config_value('DB_TYPE', FALSE); $zdb_coll = zen_read_config_value('DB_CHARSET', FALSE); if ($zdb_coll != 'latin1') $zdb_coll = 'utf8'; $zdb_prefix = zen_read_config_value('DB_PREFIX', FALSE); $zdb_server = zen_read_config_value('DB_SERVER', FALSE); $zdb_user = zen_read_config_value('DB_SERVER_USERNAME', FALSE); $zdb_pwd = zen_read_config_value('DB_SERVER_PASSWORD', FALSE); $zdb_name = zen_read_config_value('DB_DATABASE', FALSE); $zdb_sql_cache = ($zc_install->getConfigKey('DIR_FS_SQL_CACHE')=='') ? zen_read_config_value('DIR_FS_SQL_CACHE', FALSE) : $zc_install->getConfigKey('DIR_FS_SQL_CACHE'); $zdb_cache_type = zen_read_config_value('SQL_CACHE_METHOD', FALSE); } else { // set defaults: $zdb_type = 'MySQL'; $zdb_coll = 'utf8'; $zdb_prefix = ''; $zdb_server = 'localhost'; $zdb_user = ''; $zdb_name = 'zencart'; $zdb_sql_cache = $zc_install->getConfigKey('DIR_FS_SQL_CACHE'); $zdb_cache_type = 'none'; } //endif $is_upgrade if (!isset($dir_fs_www_root) || $dir_fs_www_root == '') $dir_fs_www_root = $zc_install->detectDocumentRoot(); if ($zdb_sql_cache == '') $zdb_sql_cache = $dir_fs_www_root . '/cache'; if (!isset($_POST['db_host'])) $_POST['db_host'] = $zdb_server; if (!isset($_POST['db_username'])) $_POST['db_username']= $zdb_user; if (!isset($_POST['db_name'])) $_POST['db_name'] = $zdb_name; if (!isset($_POST['sql_cache'])) $_POST['sql_cache'] = $zdb_sql_cache; if (!isset($_POST['db_prefix'])) $_POST['db_prefix'] = $zdb_prefix; if (!isset($_POST['db_type'])) $_POST['db_type'] = $zdb_type; if (!isset($_POST['db_coll'])) $_POST['db_coll'] = $zdb_coll; if (!isset($_POST['cache_type'])) $_POST['cache_type'] = $zdb_cache_type; // quick sanitization foreach($_POST as $key=>$val) { if(is_array($val)){ foreach($val as $key2 => $val2){ $_POST[$key][$key2] = htmlspecialchars($val2, ENT_COMPAT, CHARSET, TRUE); } } else { $_POST[$key] = htmlspecialchars($val, ENT_COMPAT, CHARSET, TRUE); } } setInputValue($_POST['db_host'], 'DATABASE_HOST_VALUE', $zdb_server); setInputValue($_POST['db_username'],'DATABASE_USERNAME_VALUE', $zdb_user); setInputValue($_POST['db_name'], 'DATABASE_NAME_VALUE', $zdb_name); setInputValue($_POST['sql_cache'], 'SQL_CACHE_VALUE', $zdb_sql_cache); setInputValue($_POST['db_prefix'], 'DATABASE_NAME_PREFIX', $zdb_prefix ); $zc_first_field= 'onload="document.getElementById(\'db_username\').focus()"';