Ver Mensaje Individual
  #26 (permalink)  
Antiguo 24/12/2008, 18:47
Avatar de NnikoO
NnikoO
 
Fecha de Ingreso: agosto-2008
Ubicación: Rosario
Mensajes: 245
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Ayuda Con Guestbook de Kike!!!!!

libro.php

Código php:
Ver original
  1. <?
  2.     include("config.php");
  3.     include("funciones.php");
  4.  
  5.     Template("htmll/tpl_arriba.html"); ?>
  6.           <table width="650" border="2" align="center" cellpadding="3" bordercolor="#FFCCFF" style="border-collapse:collapse">
  7.           <tr>
  8.             <td><br />
  9.               <?
  10.    
  11.    
  12.     switch($_REQUEST['accion'])  {
  13.  
  14.     case "firmar":
  15.     Template("htmll/tpl_formulario.html");
  16.     break;
  17.  
  18.     case "publicar":
  19.  
  20.     $fecha = date("d-m-y H:i a");
  21.  
  22.     $nombre = trim($nombre);
  23.     $email = trim($email);
  24.     $mensaje = trim($mensaje);
  25.  
  26.     if(empty($nombre)) {
  27.         $error[] = $alerta[0];
  28.     }
  29.     if($email != "") {
  30.         if (!ereg("^[^@]+@([a-zA-Z0-9\-]+\.)+[a-zA-Z0-9]{2,}$", $email)) {
  31.             $error[] = $alerta[1];
  32.         }
  33.     }
  34.     if(empty($mensaje)) {
  35.         $error[] = $alerta[2];
  36.     }
  37.  
  38.    
  39.  
  40.     if($FiltroGroserias == "SI") {
  41.     for($i = 0; $i < sizeof($palabrotas); $i++) {
  42.     if(ereg($palabrotas[$i], $nombre) OR ereg($palabrotas[$i], $email) OR ereg($palabrotas[$i], $mensaje)) {       
  43.         $error[] = $alerta[3];
  44.     }
  45.     }
  46.     }
  47.  
  48.     if($error) {
  49.  
  50.     include("htmll/tpl_formulario.html");
  51.  
  52.     } else {
  53.  
  54.    
  55.  
  56.     HTML();
  57.     Remplazar();
  58.     $mensaje = ereg_replace("\r\n","<br>", $mensaje);
  59.  
  60.    
  61.  
  62.     $fp = fopen($FicheroId,"r");
  63.     $id = fread($fp, filesize($FicheroId));
  64.     $id ++;
  65.     fclose($fp);
  66.  
  67.     $fp = fopen($FicheroId, "w");
  68.     fwrite($fp, $id);
  69.     fclose($fp);
  70.  
  71.     $firma = "$id|@|$nombre|@|$email|@|$url|@|$mensaje|@|$fecha|@|\n";
  72.     $fp = fopen($FicheroBase, "a");
  73.     fwrite($fp, $firma);
  74.     fclose($fp);
  75.  
  76.     Template("htmll/tpl_correcto.html");
  77.  
  78.     }
  79.     break;
  80.     default:
  81.  
  82.     // Mostrar todas las firmas
  83.  
  84.     $Base = file($FicheroBase);
  85.     $Orden = array_reverse($Base);
  86.  
  87.     if(empty($paginado)) {
  88.         $paginado = 0;
  89.     }
  90.  
  91.     $Mostrar = $paginado + $LimiteMensajes;
  92.  
  93.     for ($i = $paginado; $i < count($Orden) AND $i < $Mostrar; $i++) {
  94.         $dato = explode("|@|", $Orden[$i]);
  95.  
  96.     $nombre = $dato[1];
  97.     $email = $dato[2];
  98.     $mensaje = $dato[4];
  99.     $fecha = $dato[5];
  100.  
  101.     // Template
  102.  
  103.     Template("htmll/tpl_mensajes.html");
  104.  
  105.     }
  106.  
  107.     echo "<table cellpadding='4' cellspacing='1' width='450' align='center' class='normal'>";
  108.     echo "<tr><td width='50%'>";
  109.     Paginacion();
  110.     echo "</td><td width='50%' align='right'>";
  111.     echo "<b><a href='libro.php?accion=firmar'>Firmar...</a></b>";
  112.     echo "</td></tr></table>";
  113.  
  114.     }
  115.    
  116. ?>

Última edición por AlvaroG; 25/12/2008 a las 12:39 Razón: resaltado de sintaxis