--------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
(c) 2002-2003 osCommerce(install_2.php,v 1.4 2002/08/12); www.oscommerce.com
(c) 2003	    nextcommerce (install_step2.php,v 1.16 2003/08/1); www.nextcommerce.org
(c) 2004      XT - Commerce; www.xt-commerce.com
(c) 2004  		OL - Commerce; www.ol-Commerce.com

Released under the GNU General Public License
--------------------------------------------------------------*/
require 'includes/application.php';
if (!xtc_in_array('database', $_POST['install'])) {
    ActivateProg($next_step_link);
}
if (xtc_db_connect($db[$db_server_text], $db[$db_username_text], $db[$db_password_text])) {
    $db_error = xtc_db_test_create_db_permission($database);
} else {
    $db_error = true;
}
if ($db_error) {
    install_error(TEXT_CONNECTION_ERROR);
    $post_data .= '
	<tr>
		<td>
      <p><font size="1">' . HTML_BR . TEXT_DB_ERROR . '</font></p>
      <table border="0" style="text-align:left;width:100%">
		    <td class="error">' . HTML_NBSP . $db_error . '</td>
			</table>
      <p><font size="1">' . TEXT_DB_ERROR_1 . '</font></p>
      <p><font size="1">' . TEXT_DB_ERROR_2 . '</font></p>
  	 </td>
                $db_warning = '<br /><strong>' . TEXT_DB_SERVER_VERSION_ERROR . ' 4.1.2. <br /><br />' . TEXT_DB_SERVER_VERSION . mysqli_get_server_info() . '</strong>.';
            }
        }
    }
    //check MySQL *client* version
    if (!$db_error) {
        if (function_exists('version_compare')) {
            preg_match("/[0-9]\\.[0-9]\\.[0-9]/", mysqli_get_client_info($conn), $client_info);
            if (version_compare($client_info[0], "4.1.2", "<") && strpos(strtolower(mysqli_get_client_info($conn)), 'native') === false) {
                $db_warning = '<br /><strong>' . TEXT_DB_CLIENT_VERSION_WARNING . '<br /><br />' . TEXT_DB_CLIENT_VERSION . mysqli_get_client_info() . '</strong>.';
            }
        }
    }
    //check db permission
    if (!$db_error) {
        xtc_db_test_create_db_permission($db['DB_DATABASE']);
    }
    $_SESSION['configure']['HTTP_SERVER'] = trim(stripslashes($_POST['HTTP_SERVER']));
    $_SESSION['configure']['HTTPS_SERVER'] = trim(stripslashes($_POST['HTTPS_SERVER']));
    $_SESSION['configure']['ENABLE_SSL'] = trim(stripslashes($_POST['ENABLE_SSL']));
    $_SESSION['configure']['USE_SSL_PROXY'] = trim(stripslashes($_POST['USE_SSL_PROXY']));
    $_SESSION['configure']['DIR_WS_CATALOG'] = trim(stripslashes($_POST['DIR_WS_CATALOG']));
    if (!$db_error) {
        xtc_redirect(xtc_href_link('install_permissions_step.php?inst_db=' . xtc_db_prepare_input($_POST["install_db"]) . '&config=' . xtc_db_prepare_input($_POST['install_cfg']), '', 'NONSSL'));
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=<?php