Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/05/2007, 07:46
Saldu
Invitado
 
Mensajes: n/a
Puntos:
Re: Duda con respecto a un sistema de anuncios

Lo que pido es muy simple en realidad, no necesito la complejidad de esos programas que tu me has recomendado. Es decir, yo te podría dar el código que podría utilizar yo, mira esto:
index.php

Código:
<html>
<head>
<title>Suarez Locura</title>

</head>

<body>
<body>
<?include('ver_noticia.php');?>
</body>
</html>
Ver_noticia.php:

Código:
<html>

<body>

<?php 
$link=mysql_connect("localhost","");
$campo="noticia".$_SESSION['idioma'];

//Seleccionamos la base
mysql_select_db("tryman",$link);
$result=mysql_query("select * from noticias order by fecha ASC Limit 5",$link);
echo "
<table cellpading=2 cellspacing=1 border=0 align=center>"; 
while($row=mysql_fetch_array($result)){ 
?> 

<tr> 
<td><center><b><?php echo $row[titulo]?></b></center><br> 
</td> 
</tr>

<tr> 
<td valign="justify"><?php echo $row[fecha]?></td> 
</tr> 


<tr> 
<td valign="justify"><? echo $row[$campo]; ?></td>
</tr> 
<br>
<tr>
<td>
<font size=1 bgcolor=#FFFFFF><?php echo $row[autor]?></font>
</td>
</tr>
<?php 
} 
echo "</table>"; 
?> 
<a href="ver_todas_noticias.php">Ver todas las noticias...</a>
ADMINISTRAR.PHP

Código:
<?php
session_start();
require_once('../conexion.php'); 
if (isset($_SESSION['Auth']) && $_SESSION['Auth'] == 'YES') {
	// Aquí tiene acceso
}else{
	// Aquí no tiene acceso
	echo "<script>window.location='../prohibido.php?error=No tiene acceso al sistema!!';</script>";
exit;
}
	
?>
<form action="procesanoticia.php" method="post">
Título noticia:<br>
<input type="text" name="titulo"><br>
Autor:<br>
<input type="text" name="autor"><br>
Categoría:<br>
<input type="text" name="categoria"><br>
Español<br>
<textarea name="noticiaspanish" cols="50" rows="10"></textarea><br>
English
<textarea name="noticiaenglish" cols="50" rows="10"></textarea><br>
French
<textarea name="noticiafrench" cols="50" rows="10"></textarea><br>
Italian
<textarea name="noticiaitalian" cols="50" rows="10"></textarea><br>
<input type="submit" value="Publicar"><br>
</form>
Y POR ÚLTIMO
PROCESANOTICIA.PHP

Código:
<?php
session_start();
require_once('../conexion.php'); 
if (isset($_SESSION['Auth']) && $_SESSION['Auth'] == 'YES') {
	// Aquí tiene acceso
}else{
	// Aquí no tiene acceso
header("location: ../prohibido.php?error=No tiene acceso al sistema!!");
}

$titulo=$_POST['titulo'];
$autor=$_POST['autor'];
$categoria=$_POST['categoria'];
$noticiaspanish=$_POST['noticiaspanish'];
$noticiaenglish=$_POST['noticiaenglish'];
$noticiafrench=$_POST['noticiafrench'];
$noticiaitalian=$_POST['noticiaitalian'];
$connect=mysql_connect("localhost","root","");
//Seleccionamos la base
mysql_select_db("Tryman",$connect);
$algo= mysql_query("INSERT INTO  noticias (titulo, autor, categoria, noticiaspanish,noticiaenglish,noticiafrench,noticiaitalian, fecha) VALUES ('$titulo', '$autor', '$categoria', '$noticiaspanish','$noticiaenglish','$noticiafrench','$noticiaitalian', NOW())", $connect) or die ( mysql_error());
header("location: index.php");
?>

Esos códigos, son unos que tengo yo, en otro sitio, y como veran, tiene muchos idiomas. Dependiendo de la session que tenga el navegador, en mi web, se entiende lo que hize?

Bien, a eso, yo lo voy a modificar, a 1 solo idioma, osea,mas facil, y quizas, unos campos menos en el anuncio. Pero, lo que yo quiero hacer, que, en administrar.php el cuadro para escribir,tenga todas esas opciones que tiene este foro,para escribir, osea, negrita, colores, caritas, links, fuentes,tamaño, y demas.
Y que eso se guarde, y bueno, dsp cuando se lea en VER_NOTICIA.PHP se vea tal cual yo lo escribi. Se entiende mas o menos??

Y bueno, en ver_noticia, no sé qué hay que modificar para que se vea lo que yo escribo,con caritas,y todas las caracteristicas y el formato que yo le haya dado al texto. Pero, no quiero que se vean las últimas 5 noticias, sino la última, pero eso se modifica en la línea
"select * from noticias order by fecha ASC Limit 5",$link" no?..
TABLA:
DROP TABLE IF EXISTS noticias;
CREATE TABLE `noticias` (
`id_noticia` int(4) NOT NULL auto_increment,
`autor` varchar(255) default NULL,
`titulo` varchar(255) default NULL,
`categoria` varchar(255) default NULL,
`fecha` datetime NOT NULL default '0000-00-00 00:00:00',
`noticiaspanish` blob,

`noticiaenglish` blob,
`noticiafrench` blob,
`noticiaitalian` blob,
KEY `id_noticia` (`id_noticia`)
) TYPE=MyISAM


YO a eso, le saco todo lo de los idiomas,nada mas queda noticiaspanish,que se va a llamar, noticia. Y bueh... el resto de los campos,creo que siguen.

A ver si alguien me ayuda. Además,a eso se le puede agregar algo de galeria de imagenes, no creo que sea muy complicado,pero bueh,si no, seguiré con el html :)

Gracias,y espero novedades.