[ Index ]
 

Code source de Plume CMS 1.2.2

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/manager/install/ -> dbinfo.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # This file is part of Plume CMS, a website management application.
   4  # Copyright (C) 2001-2005 Loic d'Anterroches and contributors.
   5  #
   6  # Plume CMS is free software; you can redistribute it and/or modify
   7  # it under the terms of the GNU General Public License as published by
   8  # the Free Software Foundation; either version 2 of the License, or
   9  # (at your option) any later version.
  10  #
  11  # Plume CMS is distributed in the hope that it will be useful,
  12  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  # GNU General Public License for more details.
  15  #
  16  # You should have received a copy of the GNU General Public License
  17  # along with this program; if not, write to the Free Software
  18  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  19  #
  20  # ***** END LICENSE BLOCK *****
  21  require_once dirname(__FILE__).'/prepend.php';
  22  
  23  $_px_p = 30; //percentage of wizard done.
  24  
  25  //Get the info for the database.
  26  /*
  27  $_PX_config['db']['db_server']    = 'localhost'; // Server
  28  $_PX_config['db']['db_database']  = 'plume'; // Name of the database
  29  $_PX_config['db']['db_login']     = 'root'; // User/login to the database
  30  $_PX_config['db']['db_password']  = ''; // Password
  31  $_PX_config['db']['db_type']      = 'mysql'; // Type of database engine
  32  $_PX_config['db']['table_prefix'] = 'plume_'; // Prefix on the tables to access them
  33  */
  34  
  35  if (empty($_SESSION['step3'])) {
  36      header('Location: encoding.php');
  37      exit;
  38  }
  39  
  40  //load the language file
  41  $_PX_config['encoding'] = $_SESSION['manager_encoding'];
  42  $l = new l10n($_SESSION['lang'], 'install');
  43  
  44  $px_dbserver = 'localhost';
  45  $px_dbname = 'plume';
  46  $px_dblogin = 'root';
  47  $px_dbpass = '';
  48  $px_dbprefix = 'plume_';
  49  $px_dberror = false;
  50  
  51  
  52  if (!empty($_POST['dbserver'])) {
  53      $px_dbserver = (!empty($_POST['dbserver'])) ? $_POST['dbserver'] : '';
  54      $px_dbname = (!empty($_POST['dbname'])) ? $_POST['dbname'] : '';
  55      $px_dblogin = (!empty($_POST['dblogin'])) ? $_POST['dblogin'] : '';
  56      $px_dbpass = (!empty($_POST['dbpass'])) ? $_POST['dbpass'] : '';
  57      $px_dbprefix = (!empty($_POST['dbprefix'])) ? $_POST['dbprefix'] : '';
  58  
  59      //try a connection and check the results
  60      $db = new Connection($px_dblogin, $px_dbpass, $px_dbserver, $px_dbname, $px_dbprefix, true);
  61      if ($db->error()) {
  62          $px_dberror = true;
  63          $px_mess = $db->error();
  64      } else {
  65          $rsV = $db->select('SELECT VERSION() AS version');
  66          $mysql_version = preg_replace('/-log$/','',$rsV->f(0));
  67          $_SESSION['dbserver'] = $px_dbserver;
  68          $_SESSION['dbname'] = $px_dbname;
  69          $_SESSION['dblogin'] = $px_dblogin;
  70          $_SESSION['dbpass'] = $px_dbpass;
  71          $_SESSION['dbprefix'] = $px_dbprefix;
  72          $_SESSION['db_version'] = $mysql_version;
  73          $_SESSION['step4'] = true;
  74          header('Location: dbinstall.php');
  75          exit;
  76      }
  77  
  78  }
  79  
  80  
  81  
  82  include dirname(__FILE__).'/_top.php';
  83  
  84  if ($px_dberror) {
  85      echo '<p class="important">'.__('The system was enable to connect to the database, please check the error message and the information you provided to fix the problem.').'</p>'."\n\n";
  86      echo '<p>'.sprintf(__('Error message: %s'), $px_mess).'</p>'."\n\n";
  87  }
  88  echo '<h2>'.__('Database information').'</h2>'."\n\n";
  89  
  90  echo '<p>'.__('The content of the website is saved into a MySQL database. Please provide the necessary data so to connect to the database.').'</p>'."\n\n";
  91  
  92  ?>
  93  <form action="dbinfo.php" method="post" id="formPost">
  94  
  95  <p class="field"><label for="dbserver"><strong><?php  echo __('Database server:'); ?></strong></label>
  96  <?php echo php_f_textField('dbserver', 30, 255, $px_dbserver); ?>
  97  </p>
  98  
  99  <p class="field"><label for="dbname"><strong><?php  echo __('Database name:'); ?></strong></label>
 100  <?php echo php_f_textField('dbname', 30, 255, $px_dbname); ?>
 101  </p>
 102  
 103  <p class="field"><label for="dblogin"><strong><?php  echo __('Login to access the database:'); ?></strong></label>
 104  <?php echo php_f_textField('dblogin', 30, 255, $px_dblogin); ?>
 105  </p>
 106  
 107  <p class="field"><label for="dbpass"><strong><?php  echo __('Password to access the database:'); ?></strong></label>
 108  <?php echo php_f_textField('dbpass', 30, 255, $px_dbpass); ?>
 109  </p>
 110  
 111  <p class="field"><label for="dbprefix"><strong><?php  echo __('Prefix for the tables in the database:'); ?></strong></label>
 112  <?php echo php_f_textField('dbprefix', 30, 255, $px_dbprefix); ?><br />
 113  <span class="small"><?php echo __('Change it only if you have several installations of PLUME CMS with the same database.'); ?></small>
 114  </p>
 115  <p><?php echo __('In the next step the database will be initialized with the necessary tables for PLUME CMS.'); ?></p>
 116  <p>
 117  <input name="next" type="submit" class="submit" value="<?php  echo __('Next'); ?>"  accesskey="n" />
 118  </p>
 119  </form>
 120  <?php
 121  
 122  include dirname(__FILE__).'/_bottom.php';
 123  
 124  ?>


Généré le : Mon Nov 26 11:57:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics