PATH:
var
/
www
/
vhosts
/
lahuertaatomica.es
/
httpdocs
/
public
/
modules
/
feedback
/
Editing: feedback.php
<?php $error = abs(intval($_GET["error"])); require_once("../../../includes/funciones.php"); require_once("../../../includes/conexion.php"); $conexion = conectar(); //Capturamos el comentario $c = trim(strip_tags($_GET["c"])); $consulta = "select * from clientes where Token = '" . $c . "'"; $registro = mysqli_query($conexion,$consulta); $cliente = mysqli_fetch_assoc($registro); if ($_POST) { $idcliente = abs(intval($_GET["idcliente"])); $nombre = trim(strip_tags($_POST["nombre"])); $cargo = trim(strip_tags($_POST["cargo"])); $comentario = trim(strip_tags($_POST["comentario"])); if ($nombre != "" && $comentario != "") { $consulta = "insert into comentarios (IDCliente, Nombre, Cargo, Comentario) values (" . $idcliente . ", '" . mysqli_real_escape_string($conexion,$nombre) . "', '" . mysqli_real_escape_string($conexion,$cargo) . "', '" . mysqli_real_escape_string($conexion,$comentario) . "')"; $resultado = mysqli_query($conexion,$consulta); if ($resultado) { header("Location: feedback.php?c=" . $c . "&error=1"); } else { header("Location: feedback.php?c=" . $c . "&error=2"); } } else { header("Location: feedback.php?c=" . $c . "&error=3"); } } ?> <!doctype html> <html lang="es"> <head> <meta charset="UTF-8"> <title>Feedback de La Huerta Atómica</title> <link rel="stylesheet" href="../../../css/lha.css"> </head> <body> <br> <div class="contenedor"> <img src="../../../store/logos/<?php echo $cliente["Logo"]; ?>" alt="<?php echo $cliente["Cliente"]; ?>"> <h4>Deja tu comentario</h4> <form method="post" action="feedback.php?idcliente=<?php echo $cliente["IDCliente"]; ?>&c=<?php echo $c; ?>"> <div class="form-group"> <label for="nombre">Tu Nombre *</label> <input type="text" name="nombre" id="nombre" maxlength="50" /> </div> <div class="form-group"> <label for="cargo">Cargo</label> <input type="text" name="cargo" id="cargo" maxlength="50" /> </div> <div class="form-group"> <label for="comentario">Tu Comentario *</label> <textarea name="comentario" id="comentario" maxlength="100"></textarea> </div> <div id="mostrar"> </div> <div class="form-group"> <input type="submit" value="Enviar" /> </div> <div class="form-group"> <?php if (isset($error) && $error != null): ?> <?php switch ($error) { case 1: echo "<p class='error-ok'>Gracias por tu comentario sobre nuestro trabajo</p>"; break; case 2: echo "<p class='error-ko'>Ha ocurrido un error. Por favor, vuelva a intentarlo</p>"; break; case 3: echo "<p class='error-ko'>Los campos marcados con * son obligatorios</p>"; break; } ?> <?php endif; ?> </div> </form> </div> <script type="text/javascript"> var texto = document.getElementById("comentario"); var mostrar = document.getElementById("mostrar"); var max = texto.maxLength; mostrar.innerHTML = "<p>Quedan " + max + " caracteres</p>"; texto.onkeyup = function() { var longitud = max - texto.value.length; mostrar.innerHTML = "<p>Quedan " + longitud + " caracteres</p>"; } </script> </body> </html>
SAVE
CANCEL