Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/06/2009, 07:22
Avatar de chulifo
chulifo
 
Fecha de Ingreso: abril-2009
Ubicación: perdido en codigos del PHP, pero aprendo rapido!
Mensajes: 524
Antigüedad: 17 años, 6 meses
Puntos: 18
De acuerdo ayuda con verificacion de captcha

Wenas miren primero tengo un archvoque genera captchas y as muestras aleatoriamente pero quiero poner una linea de texto para la verificacion

tengo es esto
php_captcha.php
Código PHP:
<?php
    
// make random string and paste it onto the image
    
$RandomStr = md5(microtime());// md5 to generate the random string
    
$ResultStr = substr($RandomStr,0,5);//trim 5 digit 
    
$NewImage =imagecreatefromjpeg("img.jpg");//image create by existing image and as back ground 
    
$LineColor = imagecolorallocate($NewImage,251,251,251);//line color 
    
$TextColor = imagecolorallocate($NewImage, 255, 255, 255);//text color-white
    
imageline($NewImage,1,1,40,40,$LineColor);//create line 1 on image 
    
imageline($NewImage,1,100,60,0,$LineColor);//create line 2 on image 
    
imagestring($NewImage, 5, 20, 10, $ResultStr, $TextColor);// Draw a random string horizontally 

    // now lets delete captcha files older than 15 minutes:
    
if ($handle = @opendir("./")) {
      while ((
$filename = readdir($handle)) !== false) {
        if(
time() - filemtime("./" . $filename) > 15 * 60 && substr($filename, strlen($filename) - 4) == '.key') {
          @
unlink("./" . $filename);
        } 
      }
      
closedir($handle);
    }
    
// now save captcha key as file
    
$handle = fopen ("./".$ResultStr.".key", "w+");
    if (!
fwrite($handle, "FreeWebshop.org"))
       {
        
$retVal = false;
    }
    else {
          
fclose($handle);
    }
    
// output image to browser
    
header("Content-type: image/jpeg");// out out the image 
    
imagejpeg($NewImage);//Output image to browser 
?>
y akies que quiero la verificacion!
Código:
<form id="form1" name="form1" method="post" action="">
  <label><img alt="Verificacion De Seguridad" src="php_captcha.php"><br />
  <input name="verificar" type="text" id="verificar" size="5" maxlength="5" />
  </label>
  <p>
    <label>
    <input type="submit" name="Submit" value="Enviar" accesskey="E" />
    </label>
  </p>
</form>
gracias ayudenme!