<?php 

  include('sesion_capchap.php');
  
  function randomText($length) {
      $pattern = "1234567890abcdefghijklmnopqrstuvwxyz";
      for($i=0;$i<$length;$i++) {
        $key .= $pattern{rand(0,35)};
      }
      return $key;
  }

  $_SESSION['tmptxt'] = randomText(8);
  $captcha = imagecreatefromgif("bgcaptcha.gif");
  $colText = imagecolorallocate($captcha, 0, 0, 0);
  imagestring($captcha, 5, 16, 7, $_SESSION['tmptxt'], $colText);
  header("Content-type: image/gif");
  imagegif($captcha);

?>

