Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/08/2010, 09:35
dezagus
 
Fecha de Ingreso: abril-2010
Ubicación: Ping: BSAS - Arg
Mensajes: 791
Antigüedad: 14 años, 7 meses
Puntos: 25
Problema con Capcha en HostGator

Hola Amigo, estoy mudando mi host local a la web.
Ya gracias a ustedes y a los tutoriales pude pasar todo a mysql y funciona perfectamente.

Me faltan pequeños detalles, probar todo y les pasaré la web una ves finalizada.

Les comento, tengo un problema con el Capcha desde que mudé la web
a HostGator, el error Completo dice esto al ejecutar el php que genera la imagen:

Cita:
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64

Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64

Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64

Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64

Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 64

Warning: imagettftext() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 64

Warning: imageconvolution() expects parameter 1 to be resource, string given in /home/miweb/public_html/captcha/captcha.php on line 74

Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 77

Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 78

Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 79

Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 82

Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/miweb/public_html/captcha/captcha.php on line 83

Uno de los Errores que destaco es:


Cita:
Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 77

Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 78

Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 79

Warning: Cannot modify header information - headers already sent by (output started at /home/miweb/public_html/captcha/captcha.php:64) in /home/miweb/public_html/captcha/captcha.php on line 82

Por lo que tengo entendido, no puede cambiar la información del Head.
Esté es el codigo completo para el que lo quiera usar:


Código PHP:
    #create image and set background color
    
$captcha imagecreatetruecolor(120,35);
    
$background_color imagecolorallocate($captcha255255255);
    
imagefill($captcha00$background_color);
    
    
#generate a random string of 5 characters
    
$string substr(md5(rand()*time()),0,5);

    
#make string uppercase and replace "O" and "0" to avoid mistakes
    
$string strtoupper($string);
    
$string str_replace("O","B"$string);
    
$string str_replace("0","C"$string);

    
#save string in session "captcha" key
    
session_start();
    
$_SESSION["captcha"]=$string;

    
#place each character in a random position
    
$font 'arial.ttf';
    for(
$i=0;$i<5;$i++){
        
$color rand(0,32);
        if(
file_exists($font)){
            
$x=4+$i*23+rand(0,6);
            
$y=rand(18,28);
            
imagettftext  ($captcha15rand(-25,25), $x$yimagecolorallocate($captcha$color$color$color), $font$string[$i]);
        }else{
            
$x=5+$i*24+rand(0,6);
            
$y=rand(1,18);
            
imagestring($captcha5$x$y$string[$i], imagecolorallocate($captcha$color$color$color));
        }
    }
    
    
#applies distorsion to image
    
$matrix = array(array(111), array(1.071.0), array(111));
    
imageconvolution($captcha$matrix1632);

    
#avoids catching
    
header("Expires: 0");
    
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    
header("Cache-Control: private",false); 

    
#return the image
    
header("Content-type: image/gif");
    
imagejpeg($captcha); 
Y esta es la sección que modifica el head:

Código PHP:
    #avoids catching
    
header("Expires: 0");
    
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    
header("Cache-Control: private",false); 

    
#return the image
    
header("Content-type: image/gif");
    
imagejpeg($captcha); 

Veo veo y veo el código y no entiendo cual es el problema, alguien me podria explicar porfavor?

Gracias.