Código
<? $dbhost = "localhost"; $dbuser = "root"; $dbpass = "pwd"; $db = "rci"; ?>
Archivo Instalar
Código
require_once("conexion.php"); switch ($lk) { case "inicio": break; case "parte2": $host = "".$_POST['host_bd'].""; $usuario_bd = "".$_POST['usuario_bd'].""; $contrasena_bd = "".$_POST['contrasena_bd'].""; $nombre_bd = "".$_POST['nombre_bd'].""; $admin = "".$_POST['admin'].""; $passadmin = "".$_POST['passadmin'].""; $basedatos = "$nombre_bd"; // comprobamos que hemos estabecido conexión en el servidor if (! $link){ echo "<center><br><br>ERROR: Imposible establecer conexión con el servidor.<br><br></center>"; } // obtenemos una lista de las bases de datos del servidor // vemos cuantas BD hay //comprobamos si la BD que queremos crear exite ya $existe = "NO" ; for ($i=0; $i<$num_bd; $i++) { $existe = "SI" ; break; } } // si no existe la creamos if ($existe == "NO") { /* manera 1 */ echo "<br><br>ERROR 1: Imposible crear base de datos. .<br>"; } /* manera 2 if (! mysql_query("CREATE DATABASE $basedatos", $link)){ echo "ERROR2: Imposible crear base de datos. <br>"; } */ }
Codigo form incluido en la pagina instalar.php
Código
<form target="_self" name="lwd" action="instalar.php?lk=parte2" method="post"> <table border="0" width="300" cellspacing="1" height="18"> <center> <tr> <b>Datos para conexion a la base de datos :</b><br> </tr> <tr> <td width="50%" height="1">Host :</td> <td width="50%" align="left" height="1"> <input value="'.$dbhost.'" type="text" name="host_bd" size="20"></td> <td width="5%" align="left" height="0"> '; echo" <a onMouseOver=\"showmessage('Host donde este tu Base de datos, casi siempre es localhost .')\" onMouseOut=\"hideticker()\" ><img border=\"0\" src=\"imagenes/web/masinfo.gif\" width=\"14\" height=\"14\"></a> "; echo' </td> </tr> <tr> <td width="50%" height="0">Usuario :</td> <td width="45%" align="left" height="0"> <input value="'.$dbuser.'" type="text" name="usuario_bd" size="20"></td> <td width="5%" align="left" height="0"> '; echo" <a onMouseOver=\"showmessage('Nombre de usuario para la conexion con la base de datos.')\" onMouseOut=\"hideticker()\" ><img border=\"0\" src=\"imagenes/web/masinfo.gif\" width=\"14\" height=\"14\"></a> "; echo' </td> </tr> <tr> <td width="50%" height="0">Contraseña :</td> <td width="45%" align="left" height="0"> <input value="'.$dbpass.'" type="text" name="contrasena_bd" size="20"></td> <td width="5%" align="left" height="0"> '; echo" <a onMouseOver=\"showmessage('Contraseña nesesaria para la conexion con la base de datos.')\" onMouseOut=\"hideticker()\" ><img border=\"0\" src=\"imagenes/web/masinfo.gif\" width=\"14\" height=\"14\"></a> "; echo' </td> </tr> <tr> <td width="50%" height="0">Base de datos :</td> <td width="45%" align="left" height="0"> <input value="'.$db.'" type="text" name="nombre_bd" size="20"></td> <td width="5%" align="left" height="0"> '; echo" <a onMouseOver=\"showmessage('Nombre de tu base de datos previamente creada en tu phpmyadmin.')\" onMouseOut=\"hideticker()\" ><img border=\"0\" src=\"imagenes/web/masinfo.gif\" width=\"14\" height=\"14\"></a> "; echo' </td> </tr> </center> </table> <table border="0" width="300" cellspacing="1" height="18"> <center> <tr> <br><br><b>Datos para el acceso a la administracion :</b><br> </tr> <tr> <td width="50%" height="1">Administrador :</td> <td width="45%" align="left" height="1"> <input value="admin" type="text" name="admin" size="20"></td> <td width="5%" align="left" height="0"> '; echo" <a onMouseOver=\"showmessage('Nombre de administrador nesesario para acceder al panel de administracion de los lanzadores .')\" onMouseOut=\"hideticker()\" ><img border=\"0\" src=\"imagenes/web/masinfo.gif\" width=\"14\" height=\"14\"></a> "; echo' </td> </tr> <tr> <td width="50%" height="0">contraseña :</td> <td width="45%" align="left" height="0"> <input value="admin" type="text" name="passadmin" size="20"></td> <td width="5%" align="left" height="0"> '; echo" <a onMouseOver=\"showmessage('Contraseña nesesaria para acceder al panel de administracion de los lanzadores.')\" onMouseOut=\"hideticker()\" ><img border=\"0\" src=\"imagenes/web/masinfo.gif\" width=\"14\" height=\"14\"></a> "; echo' </td> </tr> </center> </table> <table border="0" width="300" cellspacing="1" height="18"> <center> <tr> <br><br> <td width="50%" height="0"><input type="submit" value="Enviar" name="crear" size="20"></td> <td width="50%" align="left" height="0"><input type="reset" value="Restablecer" name="B2" size="20"></td> </tr> </center> </table> </form> </div> '; } else { echo "<br> <center>Por favor para poder continuar tienes que darle permisos de ecritura <br> al archivo con nombre : <br><b>conexion.php</b></center> "; } break;
Nose porque no me carga el formulario form al darle enviar veis algun error de codigo lo he revisado vastantes veces