Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/08/2009, 05:47
Avatar de rompeguesos
rompeguesos
 
Fecha de Ingreso: marzo-2009
Mensajes: 692
Antigüedad: 15 años, 1 mes
Puntos: 8
Pregunta Duda con mi foro. ¿Como puedo hacer que el usuario pueda editar sus mensajes?

Hola amigos, estoy haciendo un foro y me gustaria que los usuarios que escriben mensajes puedan luego editarlos, para ello he hecho que cuando un usuario escribe un mensaje se guarde tambien su direccion de email ya que es con lo que se logean, ahora mi duda es como podria hacer para que el sistema detecte cuales son los mensajes de ese usuario y en caso de ser el usuario le de la opcion de editar?

Mi php es este:

foro.php
Código PHP:
<?php
session_start
();
require(
'configuracion.php');
require(
'funciones.php');
include(
"funcionicono/emoticonos.php");
$id $_GET["id"];
if(empty(
$id)) Header("Location: index.php");

$sql "SELECT id, email, titulo, mensaje, youtube_video, login, ";
$sql.= "DATE_FORMAT(fecha, '%d/%m/%Y %H:%i:%s') as enviado FROM foro ";
$sql.= "WHERE id='$id' OR identificador='$id' ORDER BY fecha ASC";
$rs mysql_query($sql$con);

if(
mysql_num_rows($rs)>0)
{
    include(
'titulos_post.html');
    
$template implode(""file('post.php'));
    while(
$row mysql_fetch_assoc($rs))
    {
        
$color=($color==""?"#5b69a6":"");
        
$row["color"] = $color;
        
//manipulamos el mensaje
        
$row["mensaje"] = nl2br($row["mensaje"]);
        
$row["mensaje"] = parsearTags(emoticonos($row["mensaje"]));
        
mostrarTemplate($template$row);
    }
}
?>
y el post.php es este:
Código PHP:
<?php
$idprimera 
$_GET["id"];
?>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr bgcolor="<?=$color?>"> 
    <td width="25%" valign="top"> <b><a name="<?=$id?>">
      <?=$email?></a>
      </b><br>
      <font size="-2">Enviado el : <?=$enviado?></font>
    </td>
    <td> <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><strong><font size="-1"><?=$titulo?></font></strong> </td>
          <?php
          
if(isset($_SESSION['login'])){
          echo 
"<td align=\"right\" width=\"10%\">[ <a href=\"respuesta.php?id=$idprimera\">Responder</a> ]</td>";
          
?>
          <td align="right" width="10%"> [ <a href="respuesta.php?id=<?=$id?>&citar=1">Citar</a> 
            ]
          <?php
          
}
          
?>
          </td>
        </tr>
      </table>
      <hr align="center" width="100%" size="2" noshade>
      <?=$mensaje?>
      <br />
      <?php
      
if(!$youtube_video==NULL){
      
?>
      <object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/<?php echo $youtube_video ;?>&rel=1&color1=0x2b405b&    color2=0x6b8ab6&border=1"></param>  <param name="wmode" value="transparent"></param>  <embed src="http://www.youtube.com/v/<?php echo $youtube_video ;?>&rel=1&color1=0x2b405b&color2=0x6b8ab6&border=1"    type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>
      <?php
      
}
      
?>
      </td>
  </tr>
  <tr> 
    <td colspan="2" height="5"></td>
  </tr>
</table>
¿Alguna idea?