[Alba-desarrollo] SVN Alba r5126 -
prosistem/alba/trunk/alba/web/instalar
commits en pressenter.com.ar
commits en pressenter.com.ar
Mie Sep 19 21:16:45 CEST 2007
Author: ftoledo
Date: 2007-09-19 16:16:44 -0300 (Wed, 19 Sep 2007)
New Revision: 5126
Added:
prosistem/alba/trunk/alba/web/instalar/paso4.php
Modified:
prosistem/alba/trunk/alba/web/instalar/instalar.php
prosistem/alba/trunk/alba/web/instalar/paso3.php
Log:
comprobacion de la conexion
Modified: prosistem/alba/trunk/alba/web/instalar/instalar.php
===================================================================
--- prosistem/alba/trunk/alba/web/instalar/instalar.php 2007-09-19 17:48:49 UTC (rev 5125)
+++ prosistem/alba/trunk/alba/web/instalar/instalar.php 2007-09-19 19:16:44 UTC (rev 5126)
@@ -86,6 +86,9 @@
case 3:
include ("paso3.php");
break;
+ case 4:
+ include ("paso4.php");
+ break;
}
?>
</div>
Modified: prosistem/alba/trunk/alba/web/instalar/paso3.php
===================================================================
--- prosistem/alba/trunk/alba/web/instalar/paso3.php 2007-09-19 17:48:49 UTC (rev 5125)
+++ prosistem/alba/trunk/alba/web/instalar/paso3.php 2007-09-19 19:16:44 UTC (rev 5126)
@@ -32,27 +32,55 @@
if (!defined('ALBA_INSTALLER')) die();
+$cnx_error_flag = false;
+$cnx_error_msg = "";
+$error_flag = true;
+
+$host = "";
+$user = "";
+$pass = "";
+$db = "";
+$creardb = "";
if (isset($_POST['test_conn']) && $_POST['test_conn']==1) {
$host = $_POST['host'];
$user = $_POST['user'];
$pass = $_POST['pass'];
$db = $_POST['db'];
-
+ $creardb = (isset($_POST['creardb']) && $_POST['creardb'] == 1);
+
$conn = @mysql_connect($host,$user,$pass);
if (!$conn) {
- $error_flag = true;
- $error_msg = "No se puede conectar a la base de datos: <br>" . mysql_error();
+ $cnx_error_flag = true;
+ $cnx_error_msg = "No se puede conectar a la base de datos: <br>" . mysql_error();
}
+ else {
+ if ($creardb) {
+ $ret = @mysql_query('CREATE DATABASE ' . $db , $conn);
+ if (!$ret) {
+ $cnx_error_flag = true;
+ $cnx_error_msg = "No se puede crear la base de datos: <br>" . mysql_error();
+ $error_flag = true;
+ }
+ }
+ else {
+ $error_flag = false;
+ }
+ $_SESSION['albainstall']['host'] = $host;
+ $_SESSION['albainstall']['user'] = $user;
+ $_SESSION['albainstall']['pass'] = $pass;
+ $_SESSION['albainstall']['db'] = $db;
+ $_SESSION['albainstall']['creardb'] = $creardb;
+ }
}
?>
<div id="detalle">
<p>Detalle de conexión con la base de datos:</p>
</div>
-<?php if ($error_flag):?>
+<?php if ($cnx_error_flag):?>
<div class="error">
<p>Ocurrió el siguiente error:</p>
- <p><?php echo $error_msg?></p>
+ <p><?php echo $cnx_error_msg?></p>
</div>
<?php endif;?>
<form name="test_conn" method="post">
@@ -60,27 +88,27 @@
<table>
<tr>
<td>Servidor:</td>
- <td><input type="text" name="host"></td>
+ <td><input type="text" name="host" value="<?php echo $host?>"></td>
</tr>
<tr>
<td>Usuario:</td>
- <td><input type="text" name="user"></td>
+ <td><input type="text" name="user" value="<?php echo $user?>"></td>
</tr>
<tr>
<td>Clave:</td>
- <td><input type="text" name="pass"></td>
+ <td><input type="password" name="pass" value="<?php echo $pass?>"></td>
</tr>
<tr>
<td>Base de datos:</td>
- <td><input type="text" name="db"></td>
+ <td><input type="text" name="db" value="<?php echo $db?>"></td>
</tr>
<tr>
<td>Crear base de datos:<br/><span style="font-size:9px">(debe tener los permisos para poder hacerlo)</style></td>
- <td><input type="checkbox" name="creardb" value="1"></td>
+ <td><input type="checkbox" name="creardb" value="1" <?php echo $creardb ? "checked" : ""?>></td>
</tr>
</table>
<br/>
-<input type="submit" name="btTextConn" value="Conectar a la Base de Datos">
+<input type="submit" name="btTextConn" value="Comprobar conexión a la Base de Datos">
</form>
<?php
// ir al siguiente paso
Added: prosistem/alba/trunk/alba/web/instalar/paso4.php
===================================================================
--- prosistem/alba/trunk/alba/web/instalar/paso4.php 2007-09-19 17:48:49 UTC (rev 5125)
+++ prosistem/alba/trunk/alba/web/instalar/paso4.php 2007-09-19 19:16:44 UTC (rev 5126)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * This file is part of Alba.
+ *
+ * Alba is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Alba is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Alba; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+/**
+ * instalador
+ *
+ * @package alba
+ * @author José Luis Di Biase <josx en interorganic.com.ar>
+ * @author Héctor Sanchez <hsanchez en pressenter.com.ar>
+ * @author Fernando Toledo <ftoledo en pressenter.com.ar>
+ * @version SVN: $Id: instalar.php 4883 2007-07-30 21:41:42Z ftoledo $
+ * @filesource
+ * @license GPL
+ */
+
+if (!defined('ALBA_INSTALLER')) die();
+
+ $host = $_SESSION['albainstall']['host'];
+ $user = $_SESSION['albainstall']['user'];
+ $pass = $_SESSION['albainstall']['pass'];
+ $db = $_SESSION['albainstall']['db'];
+
+?>
+<div id="detalle">
+<p>Selección de base de datos inicial:</p>
+<p>Ahora ud. podrá elegir si desea comenzar
+a utilizar el sistema con una base vacía (datos mínimos)<br/>
+ó con una base de datos de Ejemplo (datos de prueba).</p>
+</div>
+
+<?php
+// ir al siguiente paso
+ $paso = 5;
+
+?>
\ No newline at end of file
Property changes on: prosistem/alba/trunk/alba/web/instalar/paso4.php
___________________________________________________________________
Name: svn:keywords
+ "Id Author URL Date Rev"
Más información sobre la lista de distribución Alba-desarrollo