[ Index ]
 

Code source de Dotclear 1.2.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/install/ -> db-pref.php (source)

   1  <?php
   2  # ***** BEGIN LICENSE BLOCK *****
   3  # This file is part of DotClear.
   4  # Copyright (c) 2004 Olivier Meunier and contributors. All rights
   5  # reserved.
   6  #
   7  # DotClear is free software; you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation; either version 2 of the License, or
  10  # (at your option) any later version.
  11  # 
  12  # DotClear is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  # 
  17  # You should have received a copy of the GNU General Public License
  18  # along with DotClear; if not, write to the Free Software
  19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20  #
  21  # ***** END LICENSE BLOCK *****
  22  
  23  define('STEP',3);
  24  
  25  require dirname(__FILE__).'/prepend.php';
  26  
  27  $db_host = '';
  28  $db_user = '';
  29  $db_pass = '';
  30  $db_name = '';
  31  $db_prefix = 'dc_';
  32  
  33  $err = '';
  34  
  35  if (!empty($_POST['check']))
  36  {
  37      $db_host = trim($_POST['db_host']);
  38      $db_user = trim($_POST['db_user']);
  39      $db_pass = trim($_POST['db_pass']);
  40      $db_name = trim($_POST['db_name']);
  41      $db_prefix = trim($_POST['db_prefix']);
  42      
  43      if (!preg_match('/^[A-Za-z_]+$/',$db_prefix)) {
  44          $err = __('Invalid tables prefix. It can contain only letters or "_".');
  45      }
  46      
  47      # On tente une connexion
  48      if ($err == '')
  49      {
  50          $con = new connection($db_user,$db_pass,$db_host,$db_name);
  51          if ($con->error()) {
  52              $err = $con->error();
  53          } else {
  54              $ses->reg('db_host',$db_host);
  55              $ses->reg('db_user',$db_user);
  56              $ses->reg('db_pass',$db_pass);
  57              $ses->reg('db_name',$db_name);
  58              $ses->reg('db_prefix',$db_prefix);
  59              
  60              $ses->reg('step',4);
  61              header('Location: db-install.php');
  62              exit;
  63          }
  64      }
  65  }
  66  
  67  require dirname(__FILE__).'/__top.php';
  68  
  69  echo '<h2>'.__('Database parameters').'</h2>';
  70  
  71  if ($err != '') {
  72      echo
  73      '<p><strong>'.__('Error, check your parameters.').'</strong></p>'.
  74      '<p class="important">'.$err.'</p>';
  75  }
  76  
  77  echo
  78  '<form action="db-pref.php" method="post">'.
  79  '<p class="field"><label for="db_host" class="float">'.__('Server address').' :</label>'.
  80  form::field('db_host',30,255,$db_host).'</p>'.
  81  '<p class="field"><label for="db_user" class="float">'.__('User ID').' :</label>'.
  82  form::field('db_user',30,255,$db_user).'</p>'.
  83  '<p class="field"><label for="db_pass" class="float">'.__('Password').' :</label>'.
  84  form::field('db_pass',30,255,$db_pass).'</p>'.
  85  '<p class="field"><label for="db_name" class="float">'.__('Database name').' :</label>'.
  86  form::field('db_name',30,255,$db_name).'</p>'.
  87  '<p class="field"><label for="db_prefix" class="float">'.__('Tables prefix').' :</label>'.
  88  form::field('db_prefix',30,255,$db_prefix).'</p>'.
  89  '<p class="field"><input type="submit" class="submit" value="'.__('Create tables').' &#187;" />'.
  90  form::hidden('check','1').'</p>';
  91  '</form>';
  92  
  93  ?>
  94  
  95  <?php require dirname(__FILE__).'/__bottom.php'; ?>


Généré le : Fri Feb 23 21:40:15 2007 par Balluche grâce à PHPXref 0.7