
<p><b>Datenbankimport / Database import</b></p>

<?php
  if (isset($_POST['DB_SERVER']) && !empty($_POST['DB_SERVER']) && isset($_POST['DB_TEST_CONNECTION']) && ($_POST['DB_TEST_CONNECTION'] == 'true')) {
    $db = array();
    $db['DB_SERVER'] = trim(stripslashes($_POST['DB_SERVER']));
    $db['DB_SERVER_USERNAME'] = trim(stripslashes($_POST['DB_SERVER_USERNAME']));
    $db['DB_SERVER_PASSWORD'] = trim(stripslashes($_POST['DB_SERVER_PASSWORD']));
    $db['DB_DATABASE'] = trim(stripslashes($_POST['DB_DATABASE']));

    $db_error = false;
    bigware_db_connect($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD']);

    if ($db_error == false) {
      bigware_db_test_create_db_permission($db['DB_DATABASE']);
    }

    if ($db_error != false) {
?>
<form name="install" action="install.php?step=2" method="post">

<table width="95%" border="0" cellpadding="2" class="formPage">
  <tr>
    <td>
      <p>Eine Testverbindung zur Datenbank war <b>nicht erfolgreich</b><br>
	  A test connection made to the database was <b>NOT</b> successful.<br></p>
      <p>The error message returned is:<br> Die Fehlermeldung war:</p>
      <p class="frameme"><?php echo $db_error; ?></p>
      <p>Please click on the <i>Back</i> button below to review your database server settings.<br>Bitte drücken Sie den <i>Zurück</i> Button damit Sie wieder zu Ihren Datenbankeinstellungen gelangen</p>
      <p>If you require help with your database server settings, please consult your hosting company.<br>Wenn Sie nicht wissen was Sie eingeben müssen, wenden Sie sich an Ihren Provider oder nehmen Sie den Installationsservice von <a href="http://www.bigware.de/index2.php">www.bigware.de</a> in Anspruch</p>
    </td>
  </tr>
</table>

<?php
      reset($_POST);
      while (list($key, $value) = each($_POST)) {
        if (($key != 'x') && ($key != 'y') && ($key != 'DB_TEST_CONNECTION')) {
          if (is_array($value)) {
            for ($i=0; $i<sizeof($value); $i++) {
              echo bigware_fetch_hidden_field($key . '[]', $value[$i]);
            }
          } else {
            echo bigware_fetch_hidden_field($key, $value);
          }
        }
      }
?>

<p>&nbsp;</p>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"><a href="index.php"><img src="picture/button_cancel.gif" border="0" alt="Cancel"></a></td>
    <td align="center"><input type="image" src="picture/button_back.gif" border="0" alt="Back"></td>
  </tr>
</table>

</form>

<?php
    } else {
      $script_filename = getenv('PATH_TRANSLATED');
      if (empty($script_filename)) {
        $script_filename = getenv('SCRIPT_FILENAME');
      }

      $script_filename = str_replace('\\', '/', $script_filename);
      $script_filename = str_replace('//', '/', $script_filename);

      $dir_fs_www_root_array = explode('/', dirname($script_filename));
      $dir_fs_www_root = array();
      for ($i=0, $n=sizeof($dir_fs_www_root_array)-1; $i<$n; $i++) {
        $dir_fs_www_root[] = $dir_fs_www_root_array[$i];
      }
      $dir_fs_www_root = implode('/', $dir_fs_www_root) . '/';
?>

<form name="install" action="install.php?step=3" method="post">

<table width="95%" border="0" cellpadding="2" class="formPage">
  <tr>
    <td>
	  <br>Eine Testverbindung zur Datenbank <b>war erfolgreich</b>
      <p>Bitte setzen Sie den Installationsprozess fort, um das Datenbankimportverfahren durchzuführen. Es ist wichtig, dass dieser Vorgang nicht unterbrochen wird, damit die Datenbank korrekt angelegt wird.</p>
      <p>Die Datei des Importes wird hier angezeigt und lokalisiert:
      <br><?php echo $dir_fs_www_root . 'setup/bigware.sql'; ?></p>
	  <p>--------------------------------------------------------------------------------------------</p>
      <p>A test connection made to the database was <b>successful</b>.
	  <p>Please continue the installation process to execute the database import procedure. It is important to not interrupted this process, otherwise the database may end up corrupted.</p>
	  <p>The file to import must be located and named at:
	  <br><?php echo $dir_fs_www_root . 'setup/bigware.sql'; ?></p>
	</td>
  </tr>
</table>

<?php
      reset($_POST);
      while (list($key, $value) = each($_POST)) {
        if (($key != 'x') && ($key != 'y') && ($key != 'DB_TEST_CONNECTION')) {
          if (is_array($value)) {
            for ($i=0; $i<sizeof($value); $i++) {
              echo bigware_fetch_hidden_field($key . '[]', $value[$i]);
            }
          } else {
            echo bigware_fetch_hidden_field($key, $value);
          }
        }
      }
?>

<p>&nbsp;</p>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"><a href="index.php"><img src="picture/button_cancel.gif" border="0" alt="Cancel"></a></td>
    <td align="center"><input type="image" src="picture/button_continue.gif" border="0" alt="Continue"></td>
  </tr>
</table>

</form>

<?php
    }
  } else {
?>

<form name="install" action="install.php?step=2" method="post">

<p><b>Please enter the database server information:<br>
Tragen Sie bitte die Datenbankinformationen ein:</b></p>

<table width="95%" border="0" cellpadding="2" class="formPage">
  <tr>
    <td width="30%" valign="top">Database Server:<br>
    Datenbank Server</td>
    <td width="70%" class="smallDesc">
      <?php echo bigware_fetch_inputfeld('DB_SERVER'); ?>
      <img src="picture/layout/help_icon.gif" onClick="toggleBox('dbHost');"><br>
      <div id="dbHostSD">Hostname or IP-address of the database server<br>
      Hostname oder IP-Adresse des Datenbankservers/ der Datenbank</div>
      <div id="dbHost" class="longDescription">The database server can be in the form of a hostname, such as db1.myserver.com, or as an IP-address, such as 192.168.0.1. If the database is local (on the same server) please use the IP 127.0.0.1<br>Der Datenbankhostname kann die Form von z.B. db1.myserver.com oder als IP Adresse z.B. 192.168.0.1 haben. Sollte die Datenbank lokal liegen (auf dem gleichen Server) geben Sie bitte die IP 127.0.0.1 ein.</div>
    </td>
  </tr>
  <tr>
    <td width="30%" valign="top">Username:<br>Benutzername</td>
    <td width="70%" class="smallDesc">
      <?php echo bigware_fetch_inputfeld('DB_SERVER_USERNAME'); ?>
      <img src="picture/layout/help_icon.gif"  onClick="toggleBox('dbUser');"><br>
      <div id="dbUserSD">Database username<br>Datenbank Benutzername</div>
      <div id="dbUser" class="longDescription">The username used to connect to the database server. An example username is 'mysql_10'.<br>Note: Create and Drop permissions <b>are required</b> at this point of the installation procedure.<br>Der Benutzername verbindet Sie mit Ihrem Datenbankserver. Ein Beispiel ist: web1. <br>Anmerkung: Der Create und Drop Befehl muss in Ihrer Datenbankadministration erlaubt sein.</div>
    </td>
  </tr>
  <tr>
    <td width="30%" valign="top">Password:<br>Passwort</td>
    <td width="70%" class="smallDesc">
      <?php echo bigware_fetch_password_field('DB_SERVER_PASSWORD'); ?>
      <img src="picture/layout/help_icon.gif" onClick="toggleBox('dbPass');"><br>
      <div id="dbPassSD">Database password</div>
      <div id="dbPass" class="longDescription">The password is used together with the username, which forms the database user member.<br>
      Das Passwort wird zusammen mit dem Benutzernamen verwendet, das das Datenbankbenutzerkonto bildet</div>
    </td>
  </tr>
  <tr>
    <td width="30%" valign="top">Database Name:<br>Datenbankname</td>
    <td width="70%" class="smallDesc">
      <?php echo bigware_fetch_inputfeld('DB_DATABASE'); ?>
      <img src="picture/layout/help_icon.gif" onClick="toggleBox('dbName');"><br>
      <div id="dbNameSD">Database Name</div>
      <div id="dbName" class="longDescription">The database used to hold the data. An example database name is 'Bigware'.<br>
      Die Datenbank enthält die Informationen des Shops. Ein Beispiel ist "Bigware". Sollten Sie selber die Datenbank angelegt haben, wurde Ihnen ein Datenbankname vergeben oder Sie konnten Ihn selber bestimmen.</div>
    </td>
  </tr>

  <tr>
    <td width="30%" valign="top">
      
<?php echo bigware_fetch_hidden_field('SHOP_SESSIONS', 'mysql'); ?>
<?php echo bigware_fetch_hidden_field('USE_PCONNECT', ''); ?>
      
    </td>
  </tr>
</table>

<p>&nbsp;</p>

<table border="0" width="100%" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td align="center"><a href="index.php"><img src="picture/button_cancel.gif" border="0" alt="Cancel"></a></td>
    <td align="center"><input type="image" src="picture/button_continue.gif" border="0" alt="Continue"></td>
  </tr>
</table>

<?php
  reset($_POST);
  while (list($key, $value) = each($_POST)) {
    if (($key != 'x') && ($key != 'y') && ($key != 'DB_SERVER') && ($key != 'DB_SERVER_USERNAME') && ($key != 'DB_SERVER_PASSWORD') && ($key != 'DB_DATABASE') && ($key != 'USE_PCONNECT') && ($key != 'SHOP_SESSIONS') && ($key != 'DB_TEST_CONNECTION')) {
      if (is_array($value)) {
        for ($i=0; $i<sizeof($value); $i++) {
          echo bigware_fetch_hidden_field($key . '[]', $value[$i]);
        }
      } else {
        echo bigware_fetch_hidden_field($key, $value);
      }
    }
  }

  echo bigware_fetch_hidden_field('DB_TEST_CONNECTION', 'true');
?>

</form>

<?php
  }
?>
