[ Index ]
osCommerce Docs :: PHP Cross Reference For osCommerce 2.2 MS2
Provided By OSCdox.com

/install/templates/pages/ -> install_3.php (source)

[Summary view]

   1  <?php
   2  /*
   3    $Id: install_3.php,v 1.8 2003/07/11 14:59:01 hpdl Exp $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2003 osCommerce
   9  
  10    Released under the GNU General Public License
  11  */
  12  
  13    $script_filename = getenv('PATH_TRANSLATED');
  14    if (empty($script_filename)) {
  15      $script_filename = getenv('SCRIPT_FILENAME');
  16    }
  17  
  18    $script_filename = str_replace('\\', '/', $script_filename);
  19    $script_filename = str_replace('//', '/', $script_filename);
  20  
  21    $dir_fs_www_root_array = explode('/', dirname($script_filename));
  22    $dir_fs_www_root = array();
  23    for ($i=0, $n=sizeof($dir_fs_www_root_array)-1; $i<$n; $i++) {
  24      $dir_fs_www_root[] = $dir_fs_www_root_array[$i];
  25    }
  26    $dir_fs_www_root = implode('/', $dir_fs_www_root) . '/';
  27  ?>
  28  
  29  <p class="pageTitle">New Installation</p>
  30  
  31  <p><b>Database Import</b></p>
  32  
  33  <?php
  34    if (osc_in_array('database', $HTTP_POST_VARS['install'])) {
  35      $db = array();
  36      $db['DB_SERVER'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER']));
  37      $db['DB_SERVER_USERNAME'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_USERNAME']));
  38      $db['DB_SERVER_PASSWORD'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_PASSWORD']));
  39      $db['DB_DATABASE'] = trim(stripslashes($HTTP_POST_VARS['DB_DATABASE']));
  40  
  41      osc_db_connect($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD']);
  42  
  43      $db_error = false;
  44      $sql_file = $dir_fs_www_root . 'install/oscommerce.sql';
  45  
  46      osc_set_time_limit(0);
  47      osc_db_install($db['DB_DATABASE'], $sql_file);
  48  
  49      if ($db_error != false) {
  50  ?>
  51  <form name="install" action="install.php?step=3" method="post">
  52  
  53  <table width="95%" border="0" cellpadding="2" class="formPage">
  54    <tr>
  55      <td>
  56        <p>The following error has occurred:</p>
  57         <p class="boxme"><?php echo $db_error; ?></p>
  58      </td>
  59    </tr>
  60  </table>
  61  
  62  <?php
  63        reset($HTTP_POST_VARS);
  64        while (list($key, $value) = each($HTTP_POST_VARS)) {
  65          if (($key != 'x') && ($key != 'y') && ($key != 'DB_TEST_CONNECTION')) {
  66            if (is_array($value)) {
  67              for ($i=0; $i<sizeof($value); $i++) {
  68                echo osc_draw_hidden_field($key . '[]', $value[$i]);
  69              }
  70            } else {
  71              echo osc_draw_hidden_field($key, $value);
  72            }
  73          }
  74        }
  75  ?>
  76  
  77  <p>&nbsp;</p>
  78  
  79  <table border="0" width="100%" cellspacing="0" cellpadding="0">
  80    <tr>
  81      <td align="center"><a href="index.php"><img src="images/button_cancel.gif" border="0" alt="Cancel"></a></td>
  82      <td align="center"><input type="image" src="images/button_retry.gif" border="0" alt="Retry"></td>
  83    </tr>
  84  </table>
  85  
  86  </form>
  87  
  88  <?php
  89      } else {
  90  ?>
  91  <form name="install" action="install.php?step=4" method="post">
  92  
  93  <table width="95%" border="0" cellpadding="2" class="formPage">
  94    <tr>
  95      <td>
  96        <p>The database import was <b>successful!</b></p>
  97      </td>
  98    </tr>
  99  </table>
 100  
 101  <?php
 102        reset($HTTP_POST_VARS);
 103        while (list($key, $value) = each($HTTP_POST_VARS)) {
 104          if (($key != 'x') && ($key != 'y') && ($key != 'DB_TEST_CONNECTION')) {
 105            if (is_array($value)) {
 106              for ($i=0; $i<sizeof($value); $i++) {
 107                echo osc_draw_hidden_field($key . '[]', $value[$i]);
 108              }
 109            } else {
 110              echo osc_draw_hidden_field($key, $value);
 111            }
 112          }
 113        }
 114  ?>
 115  
 116  <p>&nbsp;</p>
 117  
 118  <table border="0" width="100%" cellspacing="0" cellpadding="0">
 119    <tr>
 120  <?php
 121        if (osc_in_array('configure', $HTTP_POST_VARS['install'])) {
 122  ?>
 123      <td align="center"><input type="image" src="images/button_continue.gif" border="0" alt="Continue"></td>
 124  <?php
 125        } else {
 126  ?>
 127      <td align="center"><a href="index.php"><img src="images/button_continue.gif" border="0" alt="Continue"></a></td>
 128  <?php
 129        }
 130  ?>
 131    </tr>
 132  </table>
 133  
 134  </form>
 135  
 136  <?php
 137      }
 138    }
 139  ?>


Generated: Tue Nov 4 23:53:39 2003
Hosted By :: AABox.com
Cross-referenced by PHPXref 0.4