Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/12/2010, 16:40
mickell
 
Fecha de Ingreso: julio-2006
Mensajes: 2
Antigüedad: 17 años, 9 meses
Puntos: 0
Ayuda con tag board

Hola a todos, mi problema es que estoy haciendo un tagboard y quiero que el ultimo comentario se vea mas arriba, normalmente el ultimo comentario se graba en la parte de abajo del tag pero quiero hacerlo al reves, ahhh y quiero que no utilizen como nombre una determinada palabra como por ejemplo "administrador".
Aqui el codigo

Gracias de antemano por la respuesta
Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.  
  4. <head>
  5. <meta http-equiv="Content-Language" content="es-pe" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <title>Prueba de tagboard</title>
  8. </head>
  9.  
  10. <body>
  11.  
  12. <table cellpadding="0" cellspacing="0" style="width: 859px; height: 440px">
  13.     <tr>
  14.         <td style="height: 339px; width: 337px">Prueba de tagboard</td>
  15.         <td style="height: 339px">tag
  16.         <table width="50%" height="50%">
  17.  
  18.  
  19. <form action="prueba2.php" method="post">
  20. Nombre:
  21. <br>
  22. <input name="name" type="text" size="30">
  23. <br>
  24. Comentario:
  25. <br>
  26. <textarea cols="30" name="comment"> </textarea>
  27. <br>
  28. <input type="submit" value="Enviar">
  29. </form>
  30.  
  31.  
  32. <?php
  33.         $file = "comentarios.txt";//archivo
  34.         function form_validate () {
  35.  
  36.                 if (sizeof($_POST) < 1) return false;
  37.  
  38.                 foreach ($_POST as $name => $value) {
  39.                         if (empty($name) || !isset($name)) {
  40.                                 return false;
  41.                         }
  42.                 }
  43.                 return true;
  44.         }
  45.  
  46.         function blank_replace ($str) {
  47.                 return str_replace (" ","|",$str);
  48.         }
  49.  
  50.         function stick_escape ($str) {
  51.                 return str_replace ("|"," ",$str);
  52.         }
  53.  
  54.  
  55.         if (form_validate()) {
  56.  
  57.                 $fp = fopen ($file,"at");
  58.                 fwrite ($fp,uniqid(rand(),true)."\t".blank_replace($_POST['name'])."\t".blank_replace($_POST['comment'])."\n");
  59.                 fclose ($fp);
  60.         }
  61.  
  62.         if (!file_exists($file)) {
  63.                 echo "No hay comentarios";
  64.         } else {
  65.  
  66.                 $fp = fopen ($file,"r");
  67.  
  68.                 while ($info = fscanf ($fp,"%s\n%s\n%s\n\n")) {
  69.                         list ($id,$name,$comment) = $info;
  70. ?>
  71.  
  72. <table border="0" width="47%">
  73.   <tr>
  74.     <td width="26%"><b>Nombre:</b> </td>
  75.     <td width="74%"><?=stick_escape($name)?></td>
  76.   </tr>
  77.   <tr>
  78.     <td width="26%"><b>Comentario:</b></td>
  79.     <td width="74%"><?=stick_escape($comment)?></td>
  80.   </tr>
  81. </table>
  82. <br>
  83.  
  84. <?php
  85.                 }
  86.         }
  87.  
  88. ?>
  89.  
  90.  
  91. <hr>
  92.  
  93.  
  94.  
  95.  
  96. </body>
  97.  
  98. </html>

Última edición por mickell; 02/12/2010 a las 16:43 Razón: actualizacion