Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/02/2005, 20:56
mgrunfeldm
 
Fecha de Ingreso: febrero-2005
Mensajes: 14
Antigüedad: 19 años, 2 meses
Puntos: 0
<?php

*/


function print1(){
echo"<html><head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<title>Bienvenidos al instalador del registro de usuarios de phpfácil.net</title>
<style type=\"text/css\">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.titulo {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
}
.subtitulo {font-size: 14px}
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
.Estilo2 {font-size: 10px}
-->
</style></head>

<body>
<table width=\"100%\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" bgcolor=\"#CCCCCC\" style=\"border-bottom: 1px #666666 dashed; \">
<tr>
<td><span class=\"titulo\">PHPF&aacute;cil.net <span class=\"subtitulo\"> Registro de usuarios </span></span></td>
</tr>
</table>
<table width=\"90%\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"0\">
<tr>
<td>";

}

function print2(){
echo"<p>Bienvenidos al instalador del script &quot;registro de usuarios&quot; de <a href=\"http://www.phpfacil.net\" target=\"_blank\">phpfacil.net</a><br>
Versi&oacute;n del script: <strong>2.1</strong></p>
<form name=\"formulario\" method=\"post\" action=\"instalar.php\">
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
<tr bgcolor=\"#CCCCCC\" style=\"border: 1px #00000 solid; \">
<td colspan=\"2\" style=\"border: 1px #00000 solid; \"><strong>Datos de la base de datos </strong></td>
</tr>
<tr>
<td width=\"12%\">Host:</td>
<td width=\"88%\"><input name=\"host\" type=\"text\" id=\"host\" value=\"localhost\"></td>
</tr>
<tr>
<td>Usuario:</td>
<td><input name=\"user\" type=\"text\" id=\"user\"></td>
</tr>
<tr>
<td>Contrase&ntilde;a:</td>
<td><input name=\"pass\" type=\"password\" id=\"pass\"></td>
</tr>
<tr>
<td>Base de datos:</td>
<td><input name=\"basedatos\" type=\"text\" id=\"basedatos\"></td>
</tr>
<tr bgcolor=\"#CCCCCC\">
<td colspan=\"2\" style=\"border: 1px #00000 solid; \"><strong>Datos generales </strong></td>
</tr>
<tr>
<td>Foro:</td>
<td><input name=\"foro\" type=\"radio\" value=\"si\" checked>
Si
<input name=\"foro\" type=\"radio\" value=\"no\">
No</td>
</tr>
<tr>
<td colspan=\"2\" bgcolor=\"#CCCCCC\" style=\"border: 1px #000000 solid; \"><strong>Datos del administrador</strong></td>
</tr>
<tr bgcolor=\"#FFFFFF\">
<td colspan=\"2\" ><span class=\"Estilo2\"><strong>Ayuda:</strong> este usuario que crees ser&aacute; el administrador del resto de usuarios </span></td>
</tr>
<tr bgcolor=\"#FFFFFF\">
<td >Nick:</td>
<td ><input name=\"nick\" type=\"text\" id=\"nick\"></td>
</tr>
<tr bgcolor=\"#FFFFFF\">
<td >Contrase&ntilde;a:</td>
<td ><input name=\"contrasena\" type=\"password\" id=\"contrasena\"></td>
</tr>
<tr bgcolor=\"#FFFFFF\">
<td >E-mail:</td>
<td ><input name=\"email\" type=\"text\" id=\"email\"></td>
</tr>
<tr bgcolor=\"#FFFFFF\">
<td colspan=\"2\"><div align=\"center\">
<input name=\"install\" type=\"submit\" id=\"install\" value=\"Instalar\">
</div></td>
</tr>
</table>
</form>
<p>&nbsp;</p>";

}
function print3(){
echo"
</td>
</tr>
</table>

</body>
</html>";
}

print1();

if($install){

/* Creamos el config.php */
$directorios_777 = array(dirname(__FILE__),"buttons","eforo_imagenes" ,"eforo_estilos","sounds","imagenes","JavaScript", "eforo_imagenes/avatares","eforo_imagenes/caretos");
$total_directorios = count($directorios_777);
$total_directorios-=1;

for($i=0; $i<= $total_directorios; $i++){

if ($i!=0){

$path=dirname(__FILE__)."/";

}

@chmod($directorios_777[$i], 0777);
$chmod_actual=@decoct(@fileperms($directorios_777[$i])) % 1000;

if(is_writable($directorios_777[$i])){
$file_status = "";
} else {
$chmod_error= true;
}

}

if($chmod_error){
$_SESSION['insall_refer']=false;
$error = true;
$msg_error = "El instalador no pudo colocarle automáticamente permiso 777 a los siguientes directorios, <strong>por favor colóqueselo usted a través de su cliente FTP</strong>";
}


$abrir = fopen("config.php","w");
$config = "<?php

/* Config generado por www.phpfacil.net */

\$tuweb = \"$HTTP_HOST\";
\$admin = \"$nick\";

\$host = \"$host\";
\$usdb = \"$user\";
\$padb = \"$pass\";
\$datb = \"$basedatos\";

if(!\$conectar = @mysql_connect(\$host,\$usdb,\$padb)) {

\$error = mysql_error() ;
echo\"<font size=2 face=Verdana>Error al conectar a la base de datos, vuelva a intentarlo en 5 minutos, gracias. <br><br><B>Code Error: </b>\$error</font>\" ;
exit ;

}
mysql_select_db(\$datb,\$conectar) ;
?>";

fputs($abrir,$config);
fclose($abrir);

/* Final del config */

/* Conectamos a la base de datos */

include('config.php');

/* Creamos las tablas */

mysql_query("DROP TABLE IF EXISTS usuarios");
mysql_query("DROP TABLE IF EXISTS mensajes");
mysql_query("DROP TABLE IF EXISTS eforo_foros");
mysql_query("DROP TABLE IF EXISTS eforo_mensajes");
mysql_query("DROP TABLE IF EXISTS eforo_categorias");
mysql_query("DROP TABLE IF EXISTS eforo_config");
mysql_query("DROP TABLE IF EXISTS eforo_enlinea");
mysql_query("DROP TABLE IF EXISTS eforo_moderadores");
mysql_query("DROP TABLE IF EXISTS eforo_rangos");
mysql_query("DROP TABLE IF EXISTS eforo_privados");
mysql_query("DROP TABLE IF EXISTS eforo_recientes");
mysql_query("DROP TABLE IF EXISTS puntos");


$sql1 = "
CREATE TABLE usuarios (
id smallint(5) unsigned NOT NULL auto_increment,
fecha int(10) unsigned DEFAULT '0' NOT NULL,
nick varchar(20) NOT NULL,
contrasena varchar(255) NOT NULL,
Página varchar(150) NOT NULL,
email varchar(40) NOT NULL,
pais varchar(20) NOT NULL,
sexo enum('0','1') DEFAULT '0' NOT NULL,
descripcion tinytext NOT NULL,
ip varchar(15) NOT NULL,
avatar varchar(100) NOT NULL,
web varchar(100) NOT NULL,
firma varchar(100) NOT NULL,
mensajes smallint(5) unsigned DEFAULT '0' NOT NULL,
nombre varchar(20) NOT NULL,
conectado int(10) DEFAULT '0' NOT NULL,
lista varchar(20) NOT NULL,
messenger varchar(200) NOT NULL,
yahoo_messenger varchar(200) NOT NULL,
icq varchar(200) NOT NULL,
aim varchar(200) NOT NULL,
puntos varchar(20) NOT NULL,
rango varchar(3) NOT NULL,
n_dia varchar(5) NOT NULL,
n_mes varchar(5) NOT NULL,
n_ano varchar(5) NOT NULL,
PRIMARY KEY (id),
KEY nick (nick, email),
KEY nick_2 (nick)
);";
mysql_query($sql1);

$sql2 = "
CREATE TABLE mensajes (
id smallint(5) unsigned NOT NULL auto_increment,
nuevo tinyint(1) unsigned DEFAULT '0' NOT NULL,
fecha int(10) unsigned DEFAULT '0' NOT NULL,
remitente varchar(20) NOT NULL,
destinatario varchar(20) NOT NULL,
mensaje text NOT NULL,
asunto varchar(255) NOT NULL,
PRIMARY KEY (id),
KEY destinatario (destinatario)
);";
mysql_query($sql2);

$sql3 = "
CREATE TABLE eforo_categorias (
id tinyint(3) unsigned NOT NULL auto_increment,
orden tinyint(3) unsigned DEFAULT '0' NOT NULL,
categoria varchar(100) NOT NULL,
PRIMARY KEY (id),
KEY orden (orden)
);";
mysql_query($sql3);

$sql4 = "
CREATE TABLE eforo_config (
administrador varchar(20) NOT NULL,
email varchar(100) NOT NULL,
titulo varchar(100) NOT NULL,
temas tinyint(3) unsigned DEFAULT '0' NOT NULL,
mensajes tinyint(3) unsigned DEFAULT '0' NOT NULL,
ultimos tinyint(3) unsigned DEFAULT '0' NOT NULL,
codigo enum('ON','OFF') DEFAULT 'ON' NOT NULL,
caretos enum('ON','OFF') DEFAULT 'ON' NOT NULL,
url enum('ON','OFF') DEFAULT 'ON' NOT NULL,
censurar enum('ON','OFF') DEFAULT 'ON' NOT NULL,
estilo varchar(30) NOT NULL,
privados tinyint(3) unsigned DEFAULT '0' NOT NULL,
avatarlargo smallint(5) unsigned DEFAULT '0' NOT NULL,
avatarancho smallint(5) unsigned DEFAULT '0' NOT NULL,
avatartamano smallint(5) unsigned DEFAULT '0' NOT NULL,
htmlcab text NOT NULL,
htmlpie text NOT NULL,
error404 varchar(5) NOT NULL
);";
mysql_query($sql4);

$sql5 = "
CREATE TABLE eforo_enlinea (
fecha int(10) unsigned DEFAULT '0' NOT NULL,
ip varchar(15) NOT NULL,
usuario varchar(20) NOT NULL,
KEY fecha (fecha)
);";
mysql_query($sql5);