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

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

[Summary view]

   1  <?php
   2  /*
   3    $Id: install_2.php,v 1.7 2003/07/12 08:10:08 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  
  14  <p class="pageTitle">New Installation</p>
  15  
  16  <p><b>Database Import</b></p>
  17  
  18  <?php
  19    if (isset($HTTP_POST_VARS['DB_SERVER']) && !empty($HTTP_POST_VARS['DB_SERVER']) && isset($HTTP_POST_VARS['DB_TEST_CONNECTION']) && ($HTTP_POST_VARS['DB_TEST_CONNECTION'] == 'true')) {
  20      $db = array();
  21      $db['DB_SERVER'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER']));
  22      $db['DB_SERVER_USERNAME'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_USERNAME']));
  23      $db['DB_SERVER_PASSWORD'] = trim(stripslashes($HTTP_POST_VARS['DB_SERVER_PASSWORD']));
  24      $db['DB_DATABASE'] = trim(stripslashes($HTTP_POST_VARS['DB_DATABASE']));
  25  
  26      $db_error = false;
  27      osc_db_connect($db['DB_SERVER'], $db['DB_SERVER_USERNAME'], $db['DB_SERVER_PASSWORD']);
  28  
  29      if ($db_error == false) {
  30        osc_db_test_create_db_permission($db['DB_DATABASE']);
  31      }
  32  
  33      if ($db_error != false) {
  34  ?>
  35  <form name="install" action="install.php?step=2" method="post">
  36  
  37  <table width="95%" border="0" cellpadding="2" class="formPage">
  38    <tr>
  39      <td>
  40        <p>A test connection made to the database was <b>NOT</b> successful.</p>
  41        <p>The error message returned is:</p>
  42        <p class="boxme"><?php echo $db_error; ?></p>
  43        <p>Please click on the <i>Back</i> button below to review your database server settings.</p>
  44        <p>If you require help with your database server settings, please consult your hosting company.</p>
  45      </td>
  46    </tr>
  47  </table>
  48  
  49  <?php
  50        reset($HTTP_POST_VARS);
  51        while (list($key, $value) = each($HTTP_POST_VARS)) {
  52          if (($key != 'x') && ($key != 'y') && ($key != 'DB_TEST_CONNECTION')) {
  53            if (is_array($value)) {
  54              for ($i=0; $i<sizeof($value); $i++) {
  55                echo osc_draw_hidden_field($key . '[]', $value[$i]);
  56              }
  57            } else {
  58              echo osc_draw_hidden_field($key, $value);
  59            }
  60          }
  61        }
  62  ?>
  63  
  64  <p>&nbsp;</p>
  65  
  66  <table border="0" width="100%" cellspacing="0" cellpadding="0">
  67    <tr>
  68      <td align="center"><a href="index.php"><img src="images/button_cancel.gif" border="0" alt="Cancel"></a></td>
  69      <td align="center"><input type="image" src="images/button_back.gif" border="0" alt="Back"></td>
  70    </tr>
  71  </table>
  72  
  73  </form>
  74  
  75  <?php
  76      } else {
  77        $script_filename = getenv('PATH_TRANSLATED');
  78        if (empty($script_filename)) {
  79          $script_filename = getenv('SCRIPT_FILENAME');
  80        }
  81  
  82        $script_filename = str_replace('\\', '/', $script_filename);
  83        $script_filename = str_replace('//', '/', $script_filename);
  84  
  85        $dir_fs_www_root_array = explode('/', dirname($script_filename));
  86        $dir_fs_www_root = array();
  87        for ($i=0, $n=sizeof($dir_fs_www_root_array)-1; $i<$n; $i++) {
  88          $dir_fs_www_root[] = $dir_fs_www_root_array[$i];
  89        }
  90        $dir_fs_www_root = implode('/', $dir_fs_www_root) . '/';
  91  ?>
  92  
  93  <form name="install" action="install.php?step=3" method="post">
  94  
  95  <table width="95%" border="0" cellpadding="2" class="formPage">
  96    <tr>
  97      <td>
  98        <p>A test connection made to the database was <b>successful</b>.</p>
  99        <p>Please continue the installation process to execute the database import procedure.</p>
 100        <p>It is important this procedure is not interrupted, otherwise the database may end up corrupt.</p>
 101        <p>The file to import must be located and named at:</p>
 102        <p><?php echo $dir_fs_www_root . 'install/oscommerce.sql'; ?></p>
 103      </td>
 104    </tr>
 105  </table>
 106  
 107  <?php
 108        reset($HTTP_POST_VARS);
 109        while (list($key, $value) = each($HTTP_POST_VARS)) {
 110          if (($key != 'x') && ($key != 'y') && ($key != 'DB_TEST_CONNECTION')) {
 111            if (is_array($value)) {
 112              for ($i=0; $i<sizeof($value); $i++) {
 113                echo osc_draw_hidden_field($key . '[]', $value[$i]);
 114              }
 115            } else {
 116              echo osc_draw_hidden_field($key, $value);
 117            }
 118          }
 119        }
 120  ?>
 121  
 122  <p>&nbsp;</p>
 123  
 124  <table border="0" width="100%" cellspacing="0" cellpadding="0">
 125    <tr>
 126      <td align="center"><a href="index.php"><img src="images/button_cancel.gif" border="0" alt="Cancel"></a></td>
 127      <td align="center"><input type="image" src="images/button_continue.gif" border="0" alt="Continue"></td>
 128    </tr>
 129  </table>
 130  
 131  </form>
 132  
 133  <?php
 134      }
 135    } else {
 136  ?>
 137  
 138  <form name="install" action="install.php?step=2" method="post">
 139  
 140  <p><b>Please enter the database server information:</b></p>
 141  
 142  <table width="95%" border="0" cellpadding="2" class="formPage">
 143    <tr>
 144      <td width="30%" valign="top">Database Server:</td>
 145      <td width="70%" class="smallDesc">
 146        <?php echo osc_draw_input_field('DB_SERVER'); ?>
 147        <img src="images/layout/help_icon.gif" onClick="toggleBox('dbHost');"><br>
 148        <div id="dbHostSD">Hostame or IP-address of the database server</div>
 149        <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</div>
 150      </td>
 151    </tr>
 152    <tr>
 153      <td width="30%" valign="top">Username:</td>
 154      <td width="70%" class="smallDesc">
 155        <?php echo osc_draw_input_field('DB_SERVER_USERNAME'); ?>
 156        <img src="images/layout/help_icon.gif"  onClick="toggleBox('dbUser');"><br>
 157        <div id="dbUserSD">Database username</div>
 158        <div id="dbUser" class="longDescription">The username used to connect to the database server. An example username is 'mysql_10'.<br><br>Note: Create and Drop permissions <b>are required</b> at this point of the installation procedure.</div>
 159      </td>
 160    </tr>
 161    <tr>
 162      <td width="30%" valign="top">Password:</td>
 163      <td width="70%" class="smallDesc">
 164        <?php echo osc_draw_password_field('DB_SERVER_PASSWORD'); ?>
 165        <img src="images/layout/help_icon.gif" onClick="toggleBox('dbPass');"><br>
 166        <div id="dbPassSD">Database password</div>
 167        <div id="dbPass" class="longDescription">The password is used together with the username, which forms the database user account.</div>
 168      </td>
 169    </tr>
 170    <tr>
 171      <td width="30%" valign="top">Database Name:</td>
 172      <td width="70%" class="smallDesc">
 173        <?php echo osc_draw_input_field('DB_DATABASE'); ?>
 174        <img src="images/layout/help_icon.gif" onClick="toggleBox('dbName');"><br>
 175        <div id="dbNameSD">Database Name</div>
 176        <div id="dbName" class="longDescription">The database used to hold the data. An example database name is 'osCommerce'.</div>
 177      </td>
 178    </tr>
 179    <tr>
 180      <td width="30%" valign="top">Persistent Connections:</td>
 181      <td width="70%" class="smallDesc">
 182        <?php echo osc_draw_checkbox_field('USE_PCONNECT', 'true'); ?>
 183        <img src="images/layout/help_icon.gif" onClick="toggleBox('dbConn');"><br>
 184        <div id="dbConnSD"></div>
 185        <div id="dbConn" class="longDescription">Enable persistent database connections.<br><br>Note: Persistent connections should be disabled for shared servers.</div>
 186      </td>
 187    </tr>
 188    <tr>
 189      <td width="30%" valign="top">Session Storage:</td>
 190      <td width="70%" class="smallDesc">
 191        <?php echo osc_draw_radio_field('STORE_SESSIONS', 'files', true); ?>&nbsp;Files&nbsp;&nbsp;<?php echo osc_draw_radio_field('STORE_SESSIONS', 'mysql'); ?>&nbsp;Database&nbsp;&nbsp;
 192        <img src="images/layout/help_icon.gif" onClick="toggleBox('dbSess');"><br>
 193        <div id="dbSessSD"></div>
 194        <div id="dbSess" class="longDescription">Store user session data as files on the server, or in the database.<br><br>Note: Due to security related issues, database session storage is recommended for shared servers.</td></div>
 195      </td>
 196    </tr>
 197  </table>
 198  
 199  <p>&nbsp;</p>
 200  
 201  <table border="0" width="100%" cellspacing="0" cellpadding="0" align="center">
 202    <tr>
 203      <td align="center"><a href="index.php"><img src="images/button_cancel.gif" border="0" alt="Cancel"></a></td>
 204      <td align="center"><input type="image" src="images/button_continue.gif" border="0" alt="Continue"></td>
 205    </tr>
 206  </table>
 207  
 208  <?php
 209    reset($HTTP_POST_VARS);
 210    while (list($key, $value) = each($HTTP_POST_VARS)) {
 211      if (($key != 'x') && ($key != 'y') && ($key != 'DB_SERVER') && ($key != 'DB_SERVER_USERNAME') && ($key != 'DB_SERVER_PASSWORD') && ($key != 'DB_DATABASE') && ($key != 'USE_PCONNECT') && ($key != 'STORE_SESSIONS') && ($key != 'DB_TEST_CONNECTION')) {
 212        if (is_array($value)) {
 213          for ($i=0; $i<sizeof($value); $i++) {
 214            echo osc_draw_hidden_field($key . '[]', $value[$i]);
 215          }
 216        } else {
 217          echo osc_draw_hidden_field($key, $value);
 218        }
 219      }
 220    }
 221  
 222    echo osc_draw_hidden_field('DB_TEST_CONNECTION', 'true');
 223  ?>
 224  
 225  </form>
 226  
 227  <?php
 228    }
 229  ?>


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