![]() Directorio WAP para móvil, Tablet, iPhone o Smartphone Centro de Noticias de la Universidad de Oriente |
|
|
||
domingo julio 10, 2016 Nombre del archivo:formulario.html<p> FORM PARA ENVIAR DATOS CON VERIFICACION ANTI-BOT </p> <form method="POST" action="procesar_consulta.php"> Nombre: <input type="text" name="nombre"><br> Mensaje: <input type="text" name="mensaje"><br> Imagen de verificacion:<br> <img src="img.php"><br> Verificacion: <input type="text" name="verificacion"><br> <input type="submit" value="Enviar" name="enviar"> </form> Comentarios Creamos el formulario de contacto con el campo para ingresar la imagen que en este caso seria <img src="img.php">. Nombre del archivo:img.php <? header("Content-type: image/png"); $fondo = "fondo.PNG"; $imagen = imagecreatefromPNG($fondo); $caracteres = "1234567890abcdefghijklmnopqrstuvwxyz"; //CARACTERES QE CONTIENE $digitos="6"; for($i=0;$i<$digitos;$i++) { $aleatorio .= $caracteres{rand(0,35)}; } //VARIABLES DE LA IMAGEN ALEATORIA $rojo = rand (200, 255); $verde = rand (200, 255); // ELEGIMOS COLORES CLAROS PORQE EL FONDO ES NEGRO $azul = rand (200, 255); $x = rand (20, 50); $y = rand (18, 23); $angulo = "0"; $letra = "tuletra.ttf"; // EL ARCHIVO TTF DEL TIPO DE LETRA QE VAS A USAR $color = imagecolorallocate ($imagen,$rojo,$verde,$azul); $size = rand(10,12); $nombre_img="$aleatorio.PNG"; imagettftext ($imagen, $size, $angulo, $x, $y, $color, $letra, $aleatorio); imagepng ($imagen); imagepng ($imagen, $nombre_img); session_start(); $_SESSION['verificacion'] = $aleatorio; //CREAMOS UNA SESSION QUE CONTENGA EL TEXTO DE LA IMAGEN imagedestroy ($imagen); ?> Comentarios El php que crea la imagen donde es necesario: * tuletra.ttf (es la fuente que vas a usar para la imagen de la verificacion) * fondo.PNG (debe ser de 111x30 pixeles y fondo oscuro) |
||
— @bolUDOoficial
Comenta o lee lo que otros opinan |
||
COMPÁRTELO:Indica que te gusta y comparte |
||
![]() ![]() ![]() ![]() ![]() |
||
También te puede interesar: Mostrar el calendario de la fecha actual en php |
||
« Pizarra interactiva multiusuario | Validación de un mail con JavaScript y luego con PHP » |
||
![]() |
||
Buscador:
|
||
Síguenos en las redes sociales![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mis cuentas socialesOtras | LinktreeMóvil: (0426 683 6955 - 0412 8226575) - E-mail: [email protected] - [email protected] - WhatsApp: +58 (0426) 683.69.55 / +58 (0412) 822.65.75 ![]() |
||
|
||
|