Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/07/2007, 14:26
javy
 
Fecha de Ingreso: septiembre-2002
Mensajes: 153
Antigüedad: 21 años, 7 meses
Puntos: 1
Aquí les dejo este trabajillo: Editor de Textos

Hola a Todos:

Soy Javy:

Después de currar un poquillo, creo haber acabado "Mi Editor de Textos Particular (creo, jeje)".

Primero, una imagen:



Ahora, el código:

<!-- nuevproducto.php -->
<html>
<head>
<title> Añadir un nuevo producto </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
if(isset($enviar_nuevo_producto)){
if (is_uploaded_file($_FILES['imagen']['tmp_name'])) {
// REVISAR QUE SEA JPG
if ($_FILES['imagen']['type'] == "image/jpeg" || $_FILES['imagen']['type'] == "image/pjpeg"){
// NUEVO NOMBRE PARA LA IMAGEN
// AL PONER time(). DELANTE, AÑADIRÁ LA FECHA AL NOMBRE DE LA IMAGEN.
/* SI SE QUITA, DEJARÁ EL NOMBRE COMO ESTÁ. ASÍ SE PUEDEN DUPLICAR DATOS EN LA
BASE DE DATOS, PUDIENDO DAR ERRORES */
$nuevoNombre = time().$_FILES['imagen']['name'];
// METER LA IMAGEN DONDE SE QUIERE QUE ESTÉ
move_uploaded_file($_FILES['imagen']['tmp_name'], "../imagenes/productos/$nuevoNombre");
// OBTENER LA INFORMACIÓN
$data = GetImageSize("../imagenes/productos/$nuevoNombre");

// CONECTANDO CON LA BASE DE DATOS
require_once("../incluye/config.php");
require_once("../incluye/funciones.php");

// INSERTAR EL NOMBRE DENTRO DE LA BASE DE DATOS
/*=======================================*/
mysql_query("INSERT INTO lista_productos SET
lista='$prod',
cat_cid='$cat',
subcat_sid='$subcat',
fab_fid='$fab',
fot_fit='../imagenes/productos/$nuevoNombre',
prec_did='$prec' ");
/*===============================================*/
// MENSAJE DE ÉXITO
echo "<img src='../imagenes/productos/$nuevoNombre' $data[3]> <br> imagen $nuevoNombre subida con éxito";
}else{
echo "Formato no válido para fichero de imagen";
}
} else {
echo "Error al cargar imagen: " . $_FILES['imagen']['name'];
}
}
?>
</div>
</P>
<form enctype="multipart/form-data" action="<? echo $PHP_SELF;?>" method="post">
INTRODUCIR NUEVO PRODUCTO
<p></p>
<table border="1" cellpadding="4" cellspacing="4">
<tr>
<td>NOMBRE DEL PRODUCTO:</td></tr>
<tr>
<td>
<table cellpadding="2" cellspacing="2" bgcolor="#999999">
<tr align="center" valign="middle">
<td><img src="imagenes/negrita.gif" border="2" onClick="prod.value+='<B></B>'" onMouseOver="this.src='imagenes/negrita_sobre.gif'" onMouseOut="this.src='imagenes/negrita.gif'" /></td>
<td><img src="imagenes/cursiva.gif" width="21" height="20" border="2" onClick="prod.value+='<I></I>'" onMouseOver="this.src='imagenes/cursiva_sobre.gif'" onMouseOut="this.src='imagenes/cursiva.gif'" /></td>
<td><img src="imagenes/subrayar.gif" width="21" height="20" border="2" onClick="prod.value+='<U></U>'" onMouseOver="this.src='imagenes/subrayar_sobre.gif'" onMouseOut="this.src='imagenes/subrayar.gif'" /></td>
<td><img src="imagenes/izquierda.gif" width="21" height="20" border="2" onClick="prod.value+='<P align=left></P>'" onMouseOver="this.src='imagenes/izquierda_sobre.gif'" onMouseOut="this.src='imagenes/izquierda.gif'" /></td>
<td><img src="imagenes/centrar.gif" width="21" height="20" border="2" onClick="prod.value+='<P align=center></P>'" onMouseOver="this.src='imagenes/centrar_sobre.gif'" onMouseOut="this.src='imagenes/centrar.gif'" /></td>
<td><img src="imagenes/derecha.gif" width="21" height="20" border="2" onClick="prod.value+='<P align=right></P>'" onMouseOver="this.src='imagenes/derecha_sobre.gif'" onMouseOut="this.src='imagenes/derecha.gif'" /></td>
<td><img src="imagenes/justificar.gif" width="21" height="20" border="2" onClick="prod.value+='<P align=justify></P>'" onMouseOver="this.src='imagenes/justificar_sobre.gif'" onMouseOut="this.src='imagenes/justificar.gif'" /></td>
<td><select name="color_fuente" size="1" id="color_fuente" onChange="if(color_fuente.selectedIndex=='1')prod. value+='<Font Color=#FFFFFF></Font>'; if(color_fuente.selectedIndex=='2')prod.value+='<F ont Color=#000000></Font>'; if(color_fuente.selectedIndex=='3')prod.value+='<F ont Color=#CCCCCC></Font>'; if(color_fuente.selectedIndex=='4')prod.value+='<F ont Color=#666666></Font>'; if(color_fuente.selectedIndex=='5')prod.value+='<F ont Color=#FF0000></Font>'; if(color_fuente.selectedIndex=='6')prod.value+='<F ont Color=#009900></Font>'; if(color_fuente.selectedIndex=='7')prod.value+='<F ont Color=#003366></Font>'; if(color_fuente.selectedIndex=='8')prod.value+='<F ont Color=#990000></Font>'; if(color_fuente.selectedIndex=='9')prod.value+='<F ont Color=#FFFF66></Font>';">
<option>Seleccionar Color del Texto</option>
<option>Blanco</option>
<option>Negro</option>
<option>Gris Claro</option>
<option>Gris Oscuro</option>
<option>Rojo</option>
<option>Verde</option>
<option>Azul Oscuro</option>
<option>Marrón</option>
<option>Amarillo</option>
</select></td>
<td><img src="imagenes/salto_linea.gif" width="21" height="20" border="2" onClick="prod.value+='<BR>'" onMouseOver="this.src='imagenes/salto_linea_sobre.gif'" onMouseOut="this.src='imagenes/salto_linea.gif'" /></td>
<td><img src="imagenes/insertar_barra.gif" width="21" height="20" border="2" onClick="prod.value+='<HR>'" onMouseOver="this.src='imagenes/insertar_barra_sobre.gif'" onMouseOut="this.src='imagenes/insertar_barra.gif'" /></td>
<td><img src="imagenes/link.gif" width="21" height="20" border="2" onClick="prod.value+='<A HREF=></A>'" onMouseOver="this.src='imagenes/link_sobre.gif'" onMouseOut="this.src='imagenes/link.gif'" /></td>
<td><img src="imagenes/borrar.gif" width="21" height="20" border="2" onClick="prod.value=''" onMouseOver="this.src='imagenes/borrar_sobre.gif'" onMouseOut="this.src='imagenes/borrar.gif'" /></td>
<td><img src="imagenes/ayuda.gif" width="21" height="20" border="2" onClick="window.open('ayuda.php', 'v', 'width=300,height=200');" onMouseOver="this.src='imagenes/ayuda_sobre.gif'" onMouseOut="this.src='imagenes/ayuda.gif'" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><input name="prod" type="text" id="prod"value="" size="100"></td>
</tr>
</table>
<p></p>
<table border="1" cellpadding="4" cellspacing="4">
<tr>
<td>
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
A&Ntilde;ADIR IMAGEN:</td>
</tr>
<tr>
<td><input name="imagen" type="file" size="100"></td>
</tr>
</table>
<p>&nbsp;</p>
<table border="1" cellpadding="4" cellspacing="4">
<tr>
<td><input type="submit" name='enviar_nuevo_producto' value="ENVIAR"></td>
</tr>
</table>
</form>
<form action="javy.php" method="post">
<table border="1" cellpadding="4" cellspacing="4">
<tr>
<td>
<input name="entrar" type="submit" id="entrar" value="VOLVER A PÁGINA PRINCIPAL" onClick="submit()" /></td>
</tr>
</table>
</form>
</body>
</html>

Les agradecería que si vieran algún error, lo expusieran.

De todas formas, lo he probado con IE y con Firefox, y funciona de maravilla.

Falta arreglar el código de la línea roja, pues te obliga a meter las "" para el enlace (si se añaden al código, no funciona).

Como dije en otro mensaje, esto lo he hecho para una intranet.

Saludos a todos y gracias... espero que les sirva a más de uno.

Javy