Foros del Web » Programando para Internet » PHP »

Captcha duda

Estas en el tema de Captcha duda en el foro de PHP en Foros del Web. Código PHP:   function  randomText ( $length ) {  $pattern  =  "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ;  for( $i = 0 ; $i < $length ; $i ++) {  $key  =  ...
  #1 (permalink)  
Antiguo 09/03/2011, 07:18
 
Fecha de Ingreso: marzo-2011
Mensajes: 2
Antigüedad: 13 años, 1 mes
Puntos: 0
Captcha duda

Código PHP:
 
function randomText($length) { 
$pattern "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
for(
$i=0;$i<$length;$i++) { 
$key $pattern{rand(0,62)}; 

return 
$key


session_start(); 

// PARAMETROS DE LA IMAGEN ////////////////////////////// 
$ancho 100// Ancho de la imágen 
$alto 30// Alto de la imágen 
$lineas 6// Cantidad de lineas de relleno 
$chars 6// Cantidad de caracteres del captcha 

// CREO EL OBJETO IMAGEN Y LOS COLORES A UTILIZAR /////// 
$imagen imagecreate($ancho,$alto); 
$cLineas imagecolorallocate($imagen,140,140,140); 
$cFondo imagecolorallocate($imagen,200,200,200); 
$cTexto imagecolorallocate($imagen,000,000,000); 

// PINTO EL FONDO /////////////////////////////////////// 
imagefill($imagen00$cFondo); 

// AGREGO UNAS LINEAS DE RELLENO //////////////////////// 
for($c=0$c <= $lineas$c++) { 
$x1=rand(0,$ancho); 
$y1=rand(0,$alto); 
$x2=rand(0,$ancho); 
$y2=rand(0,$alto); 
imageline($imagen,$x1$y1$x2$y2$cLineas); 



// GENERO EL TEXTO ALEATORIO //////////////////////////// 
$_SESSION['tmptxt'] = randomText($chars); 

// AGREGO EL TEXTO ALEATORIO A LA IMAGEN //////////////// 
imagestring($imagen5257$_SESSION['tmptxt'], $cTexto); 

// DEVUELVO LA IMAGEN GENERADA ////////////////////////// 
header("Content-type: image/jpeg"true); 
imagejpeg($imagen); 

// DESTRUYO EL OBJETO IMAGEN PARA LIBERAR MEMORIA /////// 
imagedestroy($imagen); 
Hola no consigo que en el servidor local me muestre la imagen.

Tengo wampserver y tengo la libreria gd2 activada.

Comentando la linea de header no me da ningun error aparentemente.

En firefox me muestra http:\\localhost\...... sin mostrar imagen

Y en explorer no muestra la imagen


Muchas gracias por su respuesta
  #2 (permalink)  
Antiguo 09/03/2011, 08:26
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Tema movido desde Frameworks y PHP orientado a objetos a PHP

Etiquetas: captcha, frameworks-y-php-orientado-a-objetos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:11.