Viewing file: comentarios.php (2.66 KB) -rw-rw-r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<head> <link rel="stylesheet" type="text/css" href="nuevo.css">
<link rel="STYLESHEET" type="text/css" href="estilo.css"> </head> <?php require "./captcha/captcha.php"; require "conn.php"; //echo "<pre>"; //print_r($_REQUEST);
if ($_REQUEST['res']){
//existe comentario!
$fecha_hora=STRVAL(INTVAL((date("H"))+DIF_HORARIA)); IF (STRLEN($fecha_hora)==1){$fecha_hora='0'.$fecha_hora;}
if (trim($_REQUEST['res'])==trim($_REQUEST['cap'])){ $query="insert into comentarios (bookid,usuario,comentario,fecha) values( '{$_REQUEST['bookid']}', '{$_REQUEST['usuario']}', '{$_REQUEST['comentario']}', '".$fecha=date("Y-m-d")." ".$fecha_hora.date(":i:s")."')";
mysql_query($query,$conn); $querysip="update placasci_papyre.sinopsis set comentarios='*' where id={$_REQUEST['bookid']}"; mysql_query($querysip,$conn);
echo "<h1>Gracias por su comentario</h2>";
}else{ echo "<h3>fallo de la operacion matematica antispam. vuelva atras y verifique</h3>"; ?><center><br><a href='javascript:history.back()' style="text-decoration:none"><img src=volver.png border=0></img></a><?php die(); }
}
// este ees el modulo para ver los comentarios por libro. El libroviene como id por post ( o get).
$varid=$_REQUEST['id'];
$query="select titulo from libros where id=$varid"; $res=mysql_query($query,$conn); $rowtitulo=mysql_fetch_array($res); echo "<center><h1>comentarios del libro:<br><b>".strtoupper($rowtitulo['titulo'])."</b></h1>"; $query="select * from comentarios where bookid=$varid order by id asc";
$res=mysql_query($query,$conn); ?><table border=0 width="50%"> <?php $counter=1; while ($row=mysql_fetch_array($res)) { if (intval($counter/2)==($counter/2)){ $colour="#DDDDDD"; }else{ $colour="#CCFF99"; } ?><tr><td bgcolor="<?php echo $colour;?>"><h2>mensaje de <b><?php echo $row['usuario'];?></b> el dia <?php echo $row['fecha'];?></h2><br> <?php echo $row['comentario'];?> </td></tr><tr><td><hr></td></tr>
<?php $counter++; }
?> </table>
<?php
?><FORM METHOD="post" ACTION="<?PHP echo $PHP_SELF ?>">
<p>Tu nombre </p><input type="text" name="usuario" size="30"<br>
<p>Tu comentario del libro:</p>
<p><textarea rows="20" name="comentario" cols="90"></textarea></p> <p><?php echo "(antispam) cuanto es $numero1 $operacion[$numeroperacion] $numero2?";?></p><input type="text" name="cap" size="4" <br> <p><input type="hidden" value="<?php echo $resultado;?>" name="res"> <p><input type="hidden" value="<?php echo $varid;?>" name="bookid"> <p><input type="submit" value="Enviar datos" name="enviar">
<input type="reset" value="Restablecer" name="B2"></p>
</FORM> <a href='entradilla.php' style="text-decoration:none"><img src=volver.png border=0></img></a>
<?php
mysql_close($conn);
?>
|