Instalador: Agregado funciones SQL.
[CLab.git] / instalar.php
blobe30f759db2c18a9199ea990cb11d3ba487b1030e
1 <?php/*Instalador de cLab.*/?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta http-equiv="Content-Style-type" content="text/css" />
7 <meta http-equiv="Content-Script-type" content="text/javascript" />
8 <meta http-equiv="Content-Language" content="es" />
9 <link rel="StyleSheet" href="estilo.css" type="text/css" />
10 <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
11 <link rel="start" href="/" />
12 <title>Instalador de Control de Laboratorio</title>
13 </head>
14 <body>
15 <?php
16 if (!isset($_POST['instalar'])) {
17 echo '
18 <h3>cLab - Instalador</h3><br />
19 <form action="'. $_SERVER['PHP_SELF'] .'" method="post">
20 <table border=0>
21 <tr><td>Configuración MySQL</td></tr>
22 <tr>
23 <td>Dirección del servidor MySQL:</td>
24 <td><input type="text" name="motor" style="background-color:#FFF7DF;color:#800000" maxlength="50" size="20" value="localhost" /></td>
25 </tr>
26 <tr>
27 <td>Base de datos a utilizar:</td>
28 <td><input type="text" name="base" style="background-color:#FFF7DF;color:#800000" maxlength="10" size="20" value="" /></td>
29 </tr>
30 <tr>
31 <td>Usuario:</td>
32 <td><input type="text" name="usuario" style="background-color:#FFF7DF;color:#800000" maxlength="10" size="20" value="" /></td>
33 </tr>
34 <tr>
35 <td>Clave:</td>
36 <td><input type="password" name="clave" style="background-color:#FFF7DF;color:#800000" maxlength="20" size="20" value="" /></td>
37 </tr>
38 <tr>
39 <tr><td><br />Administración</td></tr>
40 <td>Nombre Administrador:</td>
41 <td><input type="text" name="admin" style="background-color:#FFF7DF;color:#800000" maxlength="10" size="20" value="" /></td>
42 </tr>
43 <tr>
44 <td>Clave:</td>
45 <td><input type="password" name="admin_clave" style="background-color:#FFF7DF;color:#800000" maxlength="20" size="20" value="" /></td>
46 </tr>
47 <tr>
48 <td>Clave (repetir):</td>
49 <td><input type="password" name="admin_clave2" style="background-color:#FFF7DF;color:#800000" maxlength="20" size="20" value="" /></td>
50 </tr>
51 </table>
52 <br />
53 <input type="submit" name="instalar" value="Instalar" />
54 </form>
56 } else {
57 echo '<h3>cLab - Instalador : Instalando</h3><br />';
58 $link = @mysql_connect($_POST['motor'], $_POST['usuario'], $_POST['clave']) or die('Por favor revise sus datos, puesto que se produjo el siguiente error:<br /><pre>' . mysql_error() . '</pre>');
59 echo 'Base de datos conectada...<br />';
60 mysql_select_db($_POST['base']) or die('!->La base de datos seleccionada "'.$_POST['base'].'" no existe');
61 $query = 'DROP TABLE IF EXISTS cLab_usr;';
62 $result = @mysql_query($query) or die('!->No se pudo eliminar la tabla cLab_usr:<br /><pre>' . mysql_error() . '</pre>');
63 $query = 'DROP TABLE IF EXISTS cLab_usr;';
64 $result = @mysql_query($query) or die('!->Consulta fallida:<br /><pre>' . mysql_error() . '</pre>');
67 mysql_close($link);
68 echo 'Instalación completa<br />';
71 </body>
72 </html>