Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/08/2003, 20:30
kotosh
 
Fecha de Ingreso: mayo-2002
Mensajes: 486
Antigüedad: 22 años
Puntos: 0
Aqui te va un script sencillo

cualquier duda solo tienes que hacermelo saber
-------------------------------grabar_noticias.php --------------------
<?php
include("../conexion.php");
$link=Conectarse();
IF ($num>0) { $n=$num;} ELSE { $n=0; }
$result=mysql_query("select * from noticias order by id desc LIMIT ".$n.", 1",$link);
while ($row=mysql_fetch_array($result)){
$tipo='.jpg';
$id=$row['id']+1;
$foto=$id.$tipo;
}
if($Imagen_name!= ""){
copy("$Imagen", "../imagenes/$foto") or die("Es Imposible copiar el fichero!");
mysql_query("insert into noticias (principal,titulo,id_cat,cat_prod,copete,contenido ,imagen,fecha) values ('$Principal','$Titulo','$Categoria','$Relacion',' $Copete','$Contenido','$foto',curdate())",$link);
echo "<meta http-equiv=\"refresh\" content=\"0;URL=ingresar_noticias.php?Login=$Login &Password=$Password\">";
}
else
{
mysql_query("insert into noticias (principal,titulo,id_cat,cat_prod,copete,contenido ,fecha) values ('$Principal','$Titulo','$Categoria','$Relacion',' $Copete','$Contenido',curdate())",$link);
echo "<meta http-equiv=\"refresh\" content=\"0;URL=ingresar_noticias.php?Login=$Login &Password=$Password\">";
}
?>



--------------------- formulario_subir.php -----------------------
<form name="form1" method="post" action="grabar_noticias.php" enctype=multipart/form-data>
<div align="center">
<table width="100%" border="0" cellspacing="0">
<tr>
<td width="20%" bgcolor="#EFEFEF"> <div align="right">Titulo:</div></td>
<td width="0%" bgcolor="#EFEFEF">&nbsp;</td>
<td width="57%" bgcolor="#EFEFEF"> <input name="Titulo" type="text" size="37">
</td>
<td colspan="2" bgcolor="#CCCCCC"> <div align="center"><b>Ubicacion</b></div></td>
</tr>
<tr>
<td bgcolor="#EFEFEF" width="20%"> <div align="right">Categor&iacute;a::</div></td>
<td bgcolor="#EFEFEF" width="0%">&nbsp;</td>
<td bgcolor="#EFEFEF" width="57%">
<?php
echo "<select name=Categoria>";
$result2=mysql_query("select * from categorias",$link);
while ($row2 = mysql_fetch_array($result2)){
echo"<option value=\"$row2[id_cate]\">$row2[nombre]</option>";
}
echo "</select>";
?>
</td>
<td bgcolor="#CCCCCC" width="4%"> <input type="radio" name="Principal" value="1">
</td>
<td bgcolor="#CCCCCC" width="19%">Principal 1</td>
</tr>
<tr>
<td bgcolor="#EFEFEF" width="20%">&nbsp;</td>
<td bgcolor="#EFEFEF" width="0%">&nbsp;</td>
<td bgcolor="#EFEFEF" height="20" width="57%">&nbsp;</td>
<td bgcolor="#CCCCCC" width="4%"> <input type="radio" name="Principal" value="2">
</td>
<td bgcolor="#CCCCCC" width="19%">Principal 2</td>
</tr>
<tr>
<td bgcolor="#EFEFEF" width="20%"> <div align="right">Se
relaciona con:</div></td>
<td bgcolor="#EFEFEF" width="0%">&nbsp;</td>
<td bgcolor="#EFEFEF" width="57%">
<?php
echo "<select name=Relacion>";
$result2=mysql_query("select * from cproductos",$link);
while ($row2 = mysql_fetch_array($result2)){
echo"<option value=\"$row2[id_productos]\">$row2[seccion]</option>";
}
echo "</select>";
?>
</td>
<td bgcolor="#CCCCCC" width="4%"> <input type="radio" name="Principal" value="3">
</td>
<td bgcolor="#CCCCCC" width="19%">Recomendado</td>
</tr>
<tr bgcolor="#DDDDDD" valign="top">
<td width="20%"> <div align="right">Copete:</div></td>
<td width="0%">&nbsp;</td>
<td width="57%"> <textarea name="Copete" cols="60" rows="3"></textarea>
</td>
<td width="4%" bgcolor="#CCCCCC"> <input type="radio" name="Principal" value="0" checked>
</td>
<td width="19%" bgcolor="#CCCCCC">Titulares</td>
</tr>
<tr bgcolor="#DDDDDD" valign="top">
<td width="20%"> <div align="right">Contenido:</div></td>
<td width="0%">&nbsp;</td>
<td width="57%"> <textarea name="Contenido" cols="60" rows="5"></textarea>
</td>
<td width="4%" bgcolor="#CCCCCC">&nbsp;</td>
<td width="19%" bgcolor="#CCCCCC">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#EFEFEF" width="20%"> <div align="right">Imagen:</div></td>
<td bgcolor="#EFEFEF" width="0%">&nbsp;</td>
<td bgcolor="#EFEFEF" width="57%"> <input type="file" name="Imagen">
</td>
<td bgcolor="#CCCCCC" width="4%">&nbsp;</td>
<td bgcolor="#CCCCCC" width="19%">&nbsp;</td>
</tr>
<tr>
<td width="20%"> <div align="right"></div></td>
<td width="0%">&nbsp;</td>
<td width="57%">&nbsp;</td>
<td width="4%" bgcolor="#CCCCCC">&nbsp;</td>
<td width="19%" bgcolor="#CCCCCC">&nbsp;</td>
</tr>
<tr>
<td width="20%">&nbsp;</td>
<td width="0%">&nbsp;</td>
<td width="57%"> <input type="submit" name="Submit" value="Grabar">
</td>
<td width="4%" bgcolor="#CCCCCC">&nbsp;</td>
<td width="19%" bgcolor="#CCCCCC">&nbsp;</td>
</tr>
<tr>
<td width="20%">&nbsp;</td>
<td width="0%">&nbsp;</td>
<td width="57%">&nbsp;</td>
<td width="4%" bgcolor="#CCCCCC">&nbsp;</td>
<td width="19%" bgcolor="#CCCCCC">&nbsp;</td>
</tr>
<tr>
<td width="20%"> <div align="right"></div></td>
<td width="0%">&nbsp;</td>
<td width="57%">&nbsp;</td>
<td width="4%" bgcolor="#CCCCCC">&nbsp;</td>
<td width="19%" bgcolor="#CCCCCC">&nbsp;</td>
</tr>
</table>
</div>
</form></
__________________
Sistemass.com - Centro de capacitación profesional
http://www.sistemass.com