Ver Mensaje Individual
  #5 (permalink)  
Antiguo 17/09/2015, 18:14
alvaro_trewhela
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: Imagen tipo captcha

Miren esto hice yo:

Creacion de imagen:

captcha.php

Código PHP:
Ver original
  1. <?php
  2. $rand = rand(1, 9999999);
  3. $_SESSION["hash"] = md5($rand);
  4.  
  5.  
  6. header("Content-Type: image/png");
  7. $im = @imagecreate(80, 25) or die("Cannot Initialize new GD image stream");
  8. $background_color = imagecolorallocate($im, 0, 0, 0);
  9. $text_color = imagecolorallocate($im, 225, 14, 91);
  10. imagestring($im, 6, 5, 5, $rand, $text_color);
  11. imagepng($im);
  12. ?>

y ya que tengo la session en md5 hago lo siguente

Código HTML:
Ver original
  1. <form method="post" action="index.php">
  2. Código <img src="captcha.php" />
  3. <input type="text" style="visibility:hidden;" name="captcha2" value="<?php echo $_SESSION["hash"]; ?>" readonly="readonly" />
  4. <input type="text" name="captcha1" /><input type="submit" value="go">
  5. </form>

Lo arranco pero siempre el captcha1 fall